posthog 6.7.1__py3-none-any.whl → 6.7.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- posthog/ai/anthropic/__init__.py +10 -0
- posthog/ai/anthropic/anthropic.py +93 -63
- posthog/ai/anthropic/anthropic_async.py +86 -20
- posthog/ai/anthropic/anthropic_converter.py +393 -0
- posthog/ai/gemini/__init__.py +12 -1
- posthog/ai/gemini/gemini.py +60 -67
- posthog/ai/gemini/gemini_converter.py +438 -0
- posthog/ai/openai/__init__.py +16 -1
- posthog/ai/openai/openai.py +110 -151
- posthog/ai/openai/openai_async.py +62 -70
- posthog/ai/openai/openai_converter.py +585 -0
- posthog/ai/types.py +142 -0
- posthog/ai/utils.py +205 -253
- posthog/client.py +7 -7
- posthog/test/test_feature_flags.py +2 -2
- posthog/version.py +1 -1
- {posthog-6.7.1.dist-info → posthog-6.7.2.dist-info}/METADATA +1 -1
- {posthog-6.7.1.dist-info → posthog-6.7.2.dist-info}/RECORD +21 -17
- {posthog-6.7.1.dist-info → posthog-6.7.2.dist-info}/WHEEL +0 -0
- {posthog-6.7.1.dist-info → posthog-6.7.2.dist-info}/licenses/LICENSE +0 -0
- {posthog-6.7.1.dist-info → posthog-6.7.2.dist-info}/top_level.txt +0 -0
posthog/client.py
CHANGED
|
@@ -1814,7 +1814,7 @@ class Client(object):
|
|
|
1814
1814
|
)
|
|
1815
1815
|
)
|
|
1816
1816
|
|
|
1817
|
-
response,
|
|
1817
|
+
response, fallback_to_flags = self._get_all_flags_and_payloads_locally(
|
|
1818
1818
|
distinct_id,
|
|
1819
1819
|
groups=groups,
|
|
1820
1820
|
person_properties=person_properties,
|
|
@@ -1822,7 +1822,7 @@ class Client(object):
|
|
|
1822
1822
|
flag_keys_to_evaluate=flag_keys_to_evaluate,
|
|
1823
1823
|
)
|
|
1824
1824
|
|
|
1825
|
-
if
|
|
1825
|
+
if fallback_to_flags and not only_evaluate_locally:
|
|
1826
1826
|
try:
|
|
1827
1827
|
decide_response = self.get_flags_decision(
|
|
1828
1828
|
distinct_id,
|
|
@@ -1858,7 +1858,7 @@ class Client(object):
|
|
|
1858
1858
|
|
|
1859
1859
|
flags: dict[str, FlagValue] = {}
|
|
1860
1860
|
payloads: dict[str, str] = {}
|
|
1861
|
-
|
|
1861
|
+
fallback_to_flags = False
|
|
1862
1862
|
# If loading in previous line failed
|
|
1863
1863
|
if self.feature_flags:
|
|
1864
1864
|
# Filter flags based on flag_keys_to_evaluate if provided
|
|
@@ -1886,19 +1886,19 @@ class Client(object):
|
|
|
1886
1886
|
payloads[flag["key"]] = matched_payload
|
|
1887
1887
|
except InconclusiveMatchError:
|
|
1888
1888
|
# No need to log this, since it's just telling us to fall back to `/flags`
|
|
1889
|
-
|
|
1889
|
+
fallback_to_flags = True
|
|
1890
1890
|
except Exception as e:
|
|
1891
1891
|
self.log.exception(
|
|
1892
1892
|
f"[FEATURE FLAGS] Error while computing variant and payload: {e}"
|
|
1893
1893
|
)
|
|
1894
|
-
|
|
1894
|
+
fallback_to_flags = True
|
|
1895
1895
|
else:
|
|
1896
|
-
|
|
1896
|
+
fallback_to_flags = True
|
|
1897
1897
|
|
|
1898
1898
|
return {
|
|
1899
1899
|
"featureFlags": flags,
|
|
1900
1900
|
"featureFlagPayloads": payloads,
|
|
1901
|
-
},
|
|
1901
|
+
}, fallback_to_flags
|
|
1902
1902
|
|
|
1903
1903
|
def _initialize_flag_cache(self, cache_url):
|
|
1904
1904
|
"""Initialize feature flag cache for graceful degradation during service outages.
|
|
@@ -365,7 +365,7 @@ class TestLocalEvaluation(unittest.TestCase):
|
|
|
365
365
|
|
|
366
366
|
@mock.patch("posthog.client.flags")
|
|
367
367
|
@mock.patch("posthog.client.get")
|
|
368
|
-
def
|
|
368
|
+
def test_feature_flags_fallback_to_flags(self, patch_get, patch_flags):
|
|
369
369
|
patch_flags.return_value = {
|
|
370
370
|
"featureFlags": {"beta-feature": "alakazam", "beta-feature2": "alakazam2"}
|
|
371
371
|
}
|
|
@@ -431,7 +431,7 @@ class TestLocalEvaluation(unittest.TestCase):
|
|
|
431
431
|
|
|
432
432
|
@mock.patch("posthog.client.flags")
|
|
433
433
|
@mock.patch("posthog.client.get")
|
|
434
|
-
def
|
|
434
|
+
def test_feature_flags_dont_fallback_to_flags_when_only_local_evaluation_is_true(
|
|
435
435
|
self, patch_get, patch_flags
|
|
436
436
|
):
|
|
437
437
|
patch_flags.return_value = {
|
posthog/version.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
posthog/__init__.py,sha256=IQ-522ve1cw6pMIQ1DNiQkRPktx0gVTvJTTBH8hokCA,25762
|
|
2
2
|
posthog/args.py,sha256=JUt0vbtF33IzLt3ARgsxMEYYnZo3RNS_LcK4-CjWaco,3298
|
|
3
|
-
posthog/client.py,sha256=
|
|
3
|
+
posthog/client.py,sha256=XgYXnJ6z6P8ZY1XTLDNipIYljaN8Bcv9yuZ96AKzL5A,71512
|
|
4
4
|
posthog/consumer.py,sha256=fdteMZ-deJGMpaQmHyznw_cwQG2Vvld1tmN9LUkZPrY,4608
|
|
5
5
|
posthog/contexts.py,sha256=FWdM84ibI7jJEKpNGVnjTXi7PWBQRpDUjLOuFkLxFYI,9387
|
|
6
6
|
posthog/exception_capture.py,sha256=pmKtjQ6QY6zs4u_-ZA4H1gCyR3iI4sfqCQG_jwe_bKo,1774
|
|
@@ -11,21 +11,25 @@ posthog/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
11
11
|
posthog/request.py,sha256=CaONBN7a5RD8xiSShVMgHEd9XxKWM6ZQTLZypiqABhA,6168
|
|
12
12
|
posthog/types.py,sha256=Dl3aFGX9XUR0wMmK12r2s5Hjan9jL4HpQ9GHpVcEq5U,10207
|
|
13
13
|
posthog/utils.py,sha256=-0w-OLcCaoldkbBebPzQyBzLJSo9G9yBOg8NDVz7La8,16088
|
|
14
|
-
posthog/version.py,sha256=
|
|
14
|
+
posthog/version.py,sha256=5_SqKJ01JbRPG9x4t8JTHffIB0KktqfXyvL6EK2L4Vg,87
|
|
15
15
|
posthog/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
posthog/ai/sanitization.py,sha256=owipZ4eJYtd4JTI-CM_klatclXaeaIec3XJBOUfsOnQ,5770
|
|
17
|
-
posthog/ai/
|
|
18
|
-
posthog/ai/
|
|
19
|
-
posthog/ai/anthropic/
|
|
20
|
-
posthog/ai/anthropic/
|
|
17
|
+
posthog/ai/types.py,sha256=OsB6u855BdZNl5TyVx6Bxm80fT0dfbfnL9Yr5GsIbOQ,3755
|
|
18
|
+
posthog/ai/utils.py,sha256=VgRdBHbe6j5Uux-Pq2KyMcHo2LrzoFp98GxAySVGEOI,20639
|
|
19
|
+
posthog/ai/anthropic/__init__.py,sha256=8nTvETZzkfW-P3zBMmp06GOHs0N-xyOGu7Oa4di_lno,669
|
|
20
|
+
posthog/ai/anthropic/anthropic.py,sha256=aU-P06osLjwhbulVfpaqIAI0LHHsLvD_ZNXvRYWzUOA,8731
|
|
21
|
+
posthog/ai/anthropic/anthropic_async.py,sha256=GOHBa3LvLTGRopiWKPEomU16HNkXRk97Jq5Q647UmTM,10107
|
|
22
|
+
posthog/ai/anthropic/anthropic_converter.py,sha256=HAgD6sj0gHlmNPhNWycevE3ZVIjeD2jWgIvHSBjLVIk,11397
|
|
21
23
|
posthog/ai/anthropic/anthropic_providers.py,sha256=Q_v7U4wgieIkvii-Bqh4pLx5pEgbrHmgsCG8lUkKb_0,2103
|
|
22
|
-
posthog/ai/gemini/__init__.py,sha256=
|
|
23
|
-
posthog/ai/gemini/gemini.py,sha256=
|
|
24
|
+
posthog/ai/gemini/__init__.py,sha256=JV_9-gBR87leHgZW4XAYZP7LSl4YaXeuhqDUpA8HygA,383
|
|
25
|
+
posthog/ai/gemini/gemini.py,sha256=O3THgdoMWghlQXgnP-fSQbscXxzSiL5FTyE_JKH4tUg,14897
|
|
26
|
+
posthog/ai/gemini/gemini_converter.py,sha256=fB1hedKInKXQAV0XpBxB8edznDI8_LNnJWYHqms5CEU,13486
|
|
24
27
|
posthog/ai/langchain/__init__.py,sha256=9CqAwLynTGj3ASAR80C3PmdTdrYGmu99tz0JL-HPFgI,70
|
|
25
28
|
posthog/ai/langchain/callbacks.py,sha256=vkcOUch82N6BJPDTZTmTHVrRu0ZpLdFZqgt_LEqwGPg,29491
|
|
26
|
-
posthog/ai/openai/__init__.py,sha256=
|
|
27
|
-
posthog/ai/openai/openai.py,sha256=
|
|
28
|
-
posthog/ai/openai/openai_async.py,sha256=
|
|
29
|
+
posthog/ai/openai/__init__.py,sha256=u4OuUT7k1NgFj0TrxjuyegOg7a_UA8nAU6a-Hszr0OM,490
|
|
30
|
+
posthog/ai/openai/openai.py,sha256=0kIPmQuc2Y1d5AoWSbJfF3tJSvDLak1ha1E5eUOPnns,20231
|
|
31
|
+
posthog/ai/openai/openai_async.py,sha256=Ix-3KNOCEhSs1BcBPNF2Is2wA-zOHAlHxIKIbihof4Y,21687
|
|
32
|
+
posthog/ai/openai/openai_converter.py,sha256=AgF0VX6-I9UtS5fRby3XNAIIwV-o2000KaW6QVIcPtk,19543
|
|
29
33
|
posthog/ai/openai/openai_providers.py,sha256=zQIFTXHS2-dBKQX7FZxTFo7rIj5iiN7VHm9_2RzuDs8,3941
|
|
30
34
|
posthog/integrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
31
35
|
posthog/integrations/django.py,sha256=opHfViMcWTKFh_qQTavrNJ6qI0cc7-35UFA7dz0Lhfo,6777
|
|
@@ -37,14 +41,14 @@ posthog/test/test_contexts.py,sha256=GDYpQNGhdzyA3--ia3WPao_4dqyLUpkWm1NMVm2L-So
|
|
|
37
41
|
posthog/test/test_exception_capture.py,sha256=Zs6PP6xAZpHaHB1FDHSqgkPNlhC7iOhmj1kqwui4Xe8,1054
|
|
38
42
|
posthog/test/test_feature_flag.py,sha256=yIMJkoRtdJr91Y6Rb0PPlpZWBIR394TgWhccnlf-vYE,6815
|
|
39
43
|
posthog/test/test_feature_flag_result.py,sha256=jbdTgqlFbgvUlAoRWjguk3IvuzXgN2qbfn77gF_SqJU,15871
|
|
40
|
-
posthog/test/test_feature_flags.py,sha256=
|
|
44
|
+
posthog/test/test_feature_flags.py,sha256=SuE5Yame9sWd7lgt7LFdAPskUVRT0RXA5mnSMHkVHEI,213004
|
|
41
45
|
posthog/test/test_module.py,sha256=DGuD1O5czaEPICQBX1B--x_pHG6vdSfwgWZTqH2D9tM,1061
|
|
42
46
|
posthog/test/test_request.py,sha256=l19WVyZQc4Iqmh_bpnAFOj4nGRpDK1iO-o5aJDQfFdo,4449
|
|
43
47
|
posthog/test/test_size_limited_dict.py,sha256=Wom7BkzpHmusHilZy0SV3PNzhw7ucuQgqrx86jf8euo,765
|
|
44
48
|
posthog/test/test_types.py,sha256=csLuBiz6RMV36cpg9LVIor4Khq6MfjjGxYXodx5VttY,7586
|
|
45
49
|
posthog/test/test_utils.py,sha256=NUs2bgqrVuMdnKRq52syizgglt5_7wxxZl3dDMun-Tg,9602
|
|
46
|
-
posthog-6.7.
|
|
47
|
-
posthog-6.7.
|
|
48
|
-
posthog-6.7.
|
|
49
|
-
posthog-6.7.
|
|
50
|
-
posthog-6.7.
|
|
50
|
+
posthog-6.7.2.dist-info/licenses/LICENSE,sha256=wGf9JBotDkSygFj43m49oiKlFnpMnn97keiZKF-40vE,2450
|
|
51
|
+
posthog-6.7.2.dist-info/METADATA,sha256=TAvQSB8e14DishVRV6jzbwqa_imXk4L4FPpwxChsrQg,6015
|
|
52
|
+
posthog-6.7.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
53
|
+
posthog-6.7.2.dist-info/top_level.txt,sha256=7FBLsRjIUHVKQsXIhozuI3k-mun1tapp8iZO9EmUPEw,8
|
|
54
|
+
posthog-6.7.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|