posthog 6.7.12__py3-none-any.whl → 6.7.13__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.
@@ -758,12 +758,19 @@ def _parse_usage_model(
758
758
  "cache_read": "cache_read_tokens",
759
759
  "reasoning": "reasoning_tokens",
760
760
  }
761
- return ModelUsage(
761
+ normalized_usage = ModelUsage(
762
762
  **{
763
763
  dataclass_key: parsed_usage.get(mapped_key) or 0
764
764
  for mapped_key, dataclass_key in field_mapping.items()
765
765
  },
766
766
  )
767
+ # In LangChain, input_tokens is the sum of input and cache read tokens.
768
+ # Our cost calculation expects them to be separate, for Anthropic.
769
+ if normalized_usage.input_tokens and normalized_usage.cache_read_tokens:
770
+ normalized_usage.input_tokens = max(
771
+ normalized_usage.input_tokens - normalized_usage.cache_read_tokens, 0
772
+ )
773
+ return normalized_usage
767
774
 
768
775
 
769
776
  def _parse_usage(response: LLMResult) -> ModelUsage:
posthog/version.py CHANGED
@@ -1,4 +1,4 @@
1
- VERSION = "6.7.12"
1
+ VERSION = "6.7.13"
2
2
 
3
3
  if __name__ == "__main__":
4
4
  print(VERSION, end="") # noqa: T201
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: posthog
3
- Version: 6.7.12
3
+ Version: 6.7.13
4
4
  Summary: Integrate PostHog into any python application.
5
5
  Home-page: https://github.com/posthog/posthog-python
6
6
  Author: Posthog
@@ -11,7 +11,7 @@ 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=Xccfj-7JKyvSLDAdLr_RHvSeKlklk1btmrlKdJ-haUU,88
14
+ posthog/version.py,sha256=z7yZYOCp6BXEykkelq-f1lmR2VlKyCNAOJq990CeISk,88
15
15
  posthog/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
16
  posthog/ai/sanitization.py,sha256=owipZ4eJYtd4JTI-CM_klatclXaeaIec3XJBOUfsOnQ,5770
17
17
  posthog/ai/types.py,sha256=ceubs4K9xf8vQx7wokq1NL9hPtxyS7D7sUOuT7Lx1lM,3237
@@ -25,7 +25,7 @@ posthog/ai/gemini/__init__.py,sha256=JV_9-gBR87leHgZW4XAYZP7LSl4YaXeuhqDUpA8HygA
25
25
  posthog/ai/gemini/gemini.py,sha256=-c2MnBeask6SrAbFZ7XXZ_OMcuglTBRdnFe_ROVgXWQ,14972
26
26
  posthog/ai/gemini/gemini_converter.py,sha256=0LM5OXsCWjg8eazi06VI5Fc4LSGxSUvg-_XpZVll78A,16009
27
27
  posthog/ai/langchain/__init__.py,sha256=9CqAwLynTGj3ASAR80C3PmdTdrYGmu99tz0JL-HPFgI,70
28
- posthog/ai/langchain/callbacks.py,sha256=9bGsuBemnRApeMKwlNZR4Twg_iXOQ55IEhDS15-dr-c,29860
28
+ posthog/ai/langchain/callbacks.py,sha256=5cjBFTNmHYhWxDWSAjIRfHvTebO8M6D5D37CR9vvoAg,30261
29
29
  posthog/ai/openai/__init__.py,sha256=u4OuUT7k1NgFj0TrxjuyegOg7a_UA8nAU6a-Hszr0OM,490
30
30
  posthog/ai/openai/openai.py,sha256=ts95vdvWH7h0TX4FpLLK_wU_7H0MP3eZBEg0S-lsCKw,20127
31
31
  posthog/ai/openai/openai_async.py,sha256=QFewU-8VBW1BhrNHkKCFuW57jqu2RSnF2VZ9mDuxjbE,21775
@@ -47,8 +47,8 @@ posthog/test/test_request.py,sha256=l19WVyZQc4Iqmh_bpnAFOj4nGRpDK1iO-o5aJDQfFdo,
47
47
  posthog/test/test_size_limited_dict.py,sha256=Wom7BkzpHmusHilZy0SV3PNzhw7ucuQgqrx86jf8euo,765
48
48
  posthog/test/test_types.py,sha256=csLuBiz6RMV36cpg9LVIor4Khq6MfjjGxYXodx5VttY,7586
49
49
  posthog/test/test_utils.py,sha256=NUs2bgqrVuMdnKRq52syizgglt5_7wxxZl3dDMun-Tg,9602
50
- posthog-6.7.12.dist-info/licenses/LICENSE,sha256=wGf9JBotDkSygFj43m49oiKlFnpMnn97keiZKF-40vE,2450
51
- posthog-6.7.12.dist-info/METADATA,sha256=6ngwQgmYnwNE63rqfYXlbVMTOSR2PCXOyGldah7k8ZU,6016
52
- posthog-6.7.12.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
- posthog-6.7.12.dist-info/top_level.txt,sha256=7FBLsRjIUHVKQsXIhozuI3k-mun1tapp8iZO9EmUPEw,8
54
- posthog-6.7.12.dist-info/RECORD,,
50
+ posthog-6.7.13.dist-info/licenses/LICENSE,sha256=wGf9JBotDkSygFj43m49oiKlFnpMnn97keiZKF-40vE,2450
51
+ posthog-6.7.13.dist-info/METADATA,sha256=oygdmI-Z86nkRzTW6m_2L6xNf63WQJMPghCgIMHo3bI,6016
52
+ posthog-6.7.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
+ posthog-6.7.13.dist-info/top_level.txt,sha256=7FBLsRjIUHVKQsXIhozuI3k-mun1tapp8iZO9EmUPEw,8
54
+ posthog-6.7.13.dist-info/RECORD,,