-
Notifications
You must be signed in to change notification settings - Fork 55
fix(llma): default prompts url #423
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ class TestPrompts(unittest.TestCase): | |
| } | ||
|
|
||
| def create_mock_posthog( | ||
| self, personal_api_key="phx_test_key", host="https://app.posthog.com" | ||
| self, personal_api_key="phx_test_key", host="https://us.posthog.com" | ||
| ): | ||
|
Comment on lines
35
to
37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] Test helper default host hard-codes US cloud.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: posthog/test/ai/test_prompts.py
Line: 35:37
Comment:
[P2] Test helper default host hard-codes US cloud.
`create_mock_posthog(..., host="https://us.posthog.com")` bakes a region-specific assumption into most tests, which makes it harder to catch regressions where `host` handling differs between regions / self-hosted. It’d be more robust to keep the default host aligned with the SDK default (or parameterize host in the specific assertions that care about it).
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
||
| """Create a mock PostHog client.""" | ||
| mock = MagicMock() | ||
|
|
@@ -61,7 +61,7 @@ def test_successfully_fetch_a_prompt(self, mock_get_session): | |
| call_args = mock_get.call_args | ||
| self.assertEqual( | ||
| call_args[0][0], | ||
| "https://app.posthog.com/api/environments/@current/llm_prompts/name/test-prompt/", | ||
| "https://us.posthog.com/api/environments/@current/llm_prompts/name/test-prompt/", | ||
| ) | ||
| self.assertIn("Authorization", call_args[1]["headers"]) | ||
| self.assertEqual( | ||
|
|
@@ -333,7 +333,7 @@ def test_url_encode_prompt_names_with_special_characters(self, mock_get_session) | |
| call_args = mock_get.call_args | ||
| self.assertEqual( | ||
| call_args[0][0], | ||
| "https://app.posthog.com/api/environments/@current/llm_prompts/name/prompt%20with%20spaces%2Fand%2Fslashes/", | ||
| "https://us.posthog.com/api/environments/@current/llm_prompts/name/prompt%20with%20spaces%2Fand%2Fslashes/", | ||
| ) | ||
|
|
||
| @patch("posthog.ai.prompts._get_session") | ||
|
|
@@ -350,7 +350,7 @@ def test_work_with_direct_options_no_posthog_client(self, mock_get_session): | |
| call_args = mock_get.call_args | ||
| self.assertEqual( | ||
| call_args[0][0], | ||
| "https://app.posthog.com/api/environments/@current/llm_prompts/name/test-prompt/", | ||
| "https://us.posthog.com/api/environments/@current/llm_prompts/name/test-prompt/", | ||
| ) | ||
| self.assertEqual( | ||
| call_args[1]["headers"]["Authorization"], "Bearer phx_direct_key" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| VERSION = "7.8.1" | ||
| VERSION = "7.8.2" | ||
|
|
||
| if __name__ == "__main__": | ||
| print(VERSION, end="") # noqa: T201 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] Default cloud host likely shouldn’t change from
app.posthog.comtous.posthog.com.Changing
APP_ENDPOINTtohttps://us.posthog.comalters the default API base for anyone who previously relied on the implicit default (including EU Cloud users). If the intent is to fix the prompts API specifically, consider either keepingAPP_ENDPOINTasapp.posthog.comor deriving the prompts base from an existing canonical host constant used elsewhere in the SDK (or documenting thathostmust be set for non-US regions).Prompt To Fix With AI