From 65f6ba67d60343ad8561335c60ccb31257244d58 Mon Sep 17 00:00:00 2001 From: Radu Raicea Date: Wed, 4 Feb 2026 10:06:47 -0500 Subject: [PATCH] fix(llma): default prompts url --- CHANGELOG.md | 4 ++++ posthog/ai/prompts.py | 6 +++--- posthog/test/ai/test_prompts.py | 8 ++++---- posthog/version.py | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f6f14f55..15fcdd98 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 7.8.2 - 2026-02-04 + +fix(llma): fix prompts default url + # 7.8.1 - 2026-02-03 fix(llma): small fixes for prompt management diff --git a/posthog/ai/prompts.py b/posthog/ai/prompts.py index 49f3213b..b2f95861 100644 --- a/posthog/ai/prompts.py +++ b/posthog/ai/prompts.py @@ -15,7 +15,7 @@ log = logging.getLogger("posthog") -APP_ENDPOINT = "https://app.posthog.com" +APP_ENDPOINT = "https://us.posthog.com" DEFAULT_CACHE_TTL_SECONDS = 300 # 5 minutes PromptVariables = Dict[str, Union[str, int, float, bool]] @@ -50,11 +50,11 @@ class Prompts: from posthog.ai.prompts import Prompts # With PostHog client - posthog = Posthog('phc_xxx', host='https://app.posthog.com', personal_api_key='phx_xxx') + posthog = Posthog('phc_xxx', host='https://us.posthog.com', personal_api_key='phx_xxx') prompts = Prompts(posthog) # Or with direct options (no PostHog client needed) - prompts = Prompts(personal_api_key='phx_xxx', host='https://app.posthog.com') + prompts = Prompts(personal_api_key='phx_xxx', host='https://us.posthog.com') # Fetch with caching and fallback template = prompts.get('support-system-prompt', fallback='You are a helpful assistant.') diff --git a/posthog/test/ai/test_prompts.py b/posthog/test/ai/test_prompts.py index 13821225..11943c69 100644 --- a/posthog/test/ai/test_prompts.py +++ b/posthog/test/ai/test_prompts.py @@ -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" ): """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" diff --git a/posthog/version.py b/posthog/version.py index db5d0690..8fbab572 100644 --- a/posthog/version.py +++ b/posthog/version.py @@ -1,4 +1,4 @@ -VERSION = "7.8.1" +VERSION = "7.8.2" if __name__ == "__main__": print(VERSION, end="") # noqa: T201