posthoganalytics 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.
- posthoganalytics/ai/langchain/callbacks.py +8 -1
- posthoganalytics/version.py +1 -1
- {posthoganalytics-6.7.12.dist-info → posthoganalytics-6.7.13.dist-info}/METADATA +1 -1
- {posthoganalytics-6.7.12.dist-info → posthoganalytics-6.7.13.dist-info}/RECORD +7 -7
- {posthoganalytics-6.7.12.dist-info → posthoganalytics-6.7.13.dist-info}/WHEEL +0 -0
- {posthoganalytics-6.7.12.dist-info → posthoganalytics-6.7.13.dist-info}/licenses/LICENSE +0 -0
- {posthoganalytics-6.7.12.dist-info → posthoganalytics-6.7.13.dist-info}/top_level.txt +0 -0
|
@@ -758,12 +758,19 @@ def _parse_usage_model(
|
|
|
758
758
|
"cache_read": "cache_read_tokens",
|
|
759
759
|
"reasoning": "reasoning_tokens",
|
|
760
760
|
}
|
|
761
|
-
|
|
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:
|
posthoganalytics/version.py
CHANGED
|
@@ -11,7 +11,7 @@ posthoganalytics/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
11
11
|
posthoganalytics/request.py,sha256=Bsl2c5WwONKPQzwWMmKPX5VgOlwSiIcSNfhXgoz62Y8,6186
|
|
12
12
|
posthoganalytics/types.py,sha256=Dl3aFGX9XUR0wMmK12r2s5Hjan9jL4HpQ9GHpVcEq5U,10207
|
|
13
13
|
posthoganalytics/utils.py,sha256=-0w-OLcCaoldkbBebPzQyBzLJSo9G9yBOg8NDVz7La8,16088
|
|
14
|
-
posthoganalytics/version.py,sha256=
|
|
14
|
+
posthoganalytics/version.py,sha256=z7yZYOCp6BXEykkelq-f1lmR2VlKyCNAOJq990CeISk,88
|
|
15
15
|
posthoganalytics/ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
posthoganalytics/ai/sanitization.py,sha256=owipZ4eJYtd4JTI-CM_klatclXaeaIec3XJBOUfsOnQ,5770
|
|
17
17
|
posthoganalytics/ai/types.py,sha256=ceubs4K9xf8vQx7wokq1NL9hPtxyS7D7sUOuT7Lx1lM,3237
|
|
@@ -25,7 +25,7 @@ posthoganalytics/ai/gemini/__init__.py,sha256=JV_9-gBR87leHgZW4XAYZP7LSl4YaXeuhq
|
|
|
25
25
|
posthoganalytics/ai/gemini/gemini.py,sha256=A2acjT_m8ru2YwgIk15aN21CRVEl2jh8pbqjmHplMC8,15035
|
|
26
26
|
posthoganalytics/ai/gemini/gemini_converter.py,sha256=WzRsid-FjXRyhAI5wQ9-tjTapYVCTRKuMPcZFYKUdIo,16027
|
|
27
27
|
posthoganalytics/ai/langchain/__init__.py,sha256=9CqAwLynTGj3ASAR80C3PmdTdrYGmu99tz0JL-HPFgI,70
|
|
28
|
-
posthoganalytics/ai/langchain/callbacks.py,sha256=
|
|
28
|
+
posthoganalytics/ai/langchain/callbacks.py,sha256=syDeSb4hOrwxjEtlmRodVhdgVAQi8iwg1Z63YHNUhvA,30297
|
|
29
29
|
posthoganalytics/ai/openai/__init__.py,sha256=u4OuUT7k1NgFj0TrxjuyegOg7a_UA8nAU6a-Hszr0OM,490
|
|
30
30
|
posthoganalytics/ai/openai/openai.py,sha256=I05NruE9grWezM_EgOZBiG5Ej_gABsDcYKN0pRQWvzU,20235
|
|
31
31
|
posthoganalytics/ai/openai/openai_async.py,sha256=YAaj8Q-X3bExx-BXLWUOtdTMdj3RKe8bUkTyjamNURo,21829
|
|
@@ -47,8 +47,8 @@ posthoganalytics/test/test_request.py,sha256=Zc0VbkjpVmj8mKokQm9rzdgTr0b1U44vvMY
|
|
|
47
47
|
posthoganalytics/test/test_size_limited_dict.py,sha256=-5IQjIEr_-Dql24M0HusdR_XroOMrtgiT0v6ZQCRvzo,774
|
|
48
48
|
posthoganalytics/test/test_types.py,sha256=bRPHdwVpP7hu7emsplU8UVyzSQptv6PaG5lAoOD_BtM,7595
|
|
49
49
|
posthoganalytics/test/test_utils.py,sha256=sqUTbfweVcxxFRd3WDMFXqPMyU6DvzOBeAOc68Py9aw,9620
|
|
50
|
-
posthoganalytics-6.7.
|
|
51
|
-
posthoganalytics-6.7.
|
|
52
|
-
posthoganalytics-6.7.
|
|
53
|
-
posthoganalytics-6.7.
|
|
54
|
-
posthoganalytics-6.7.
|
|
50
|
+
posthoganalytics-6.7.13.dist-info/licenses/LICENSE,sha256=wGf9JBotDkSygFj43m49oiKlFnpMnn97keiZKF-40vE,2450
|
|
51
|
+
posthoganalytics-6.7.13.dist-info/METADATA,sha256=kno2ysdSn_QVgMzZE5DmGV8TXvNLL3jZvUZLWAjedIo,6025
|
|
52
|
+
posthoganalytics-6.7.13.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
53
|
+
posthoganalytics-6.7.13.dist-info/top_level.txt,sha256=8QsNIqIkBh1p2TXvKp0Em9ZLZKwe3uIqCETyW4s1GOE,17
|
|
54
|
+
posthoganalytics-6.7.13.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|