llm-gemini 0.19__py3-none-any.whl → 0.19.1__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: llm-gemini
3
- Version: 0.19
3
+ Version: 0.19.1
4
4
  Summary: LLM plugin to access Google's Gemini family of models
5
5
  Author: Simon Willison
6
6
  License: Apache-2.0
@@ -0,0 +1,7 @@
1
+ llm_gemini.py,sha256=GJp1oDwcdLXy2QAYwp7jGN0KZsbmj_pJcqktYRC139Q,18700
2
+ llm_gemini-0.19.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
+ llm_gemini-0.19.1.dist-info/METADATA,sha256=PsXdnxt56uLdmbYnnCF9PZgQUi2EBx9uZEgEFW0l3IQ,8119
4
+ llm_gemini-0.19.1.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
5
+ llm_gemini-0.19.1.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
+ llm_gemini-0.19.1.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
+ llm_gemini-0.19.1.dist-info/RECORD,,
llm_gemini.py CHANGED
@@ -369,7 +369,10 @@ class _SharedGemini:
369
369
  candidate.pop("content", None)
370
370
  usage = response.response_json.pop("usageMetadata")
371
371
  input_tokens = usage.pop("promptTokenCount", None)
372
- output_tokens = usage.pop("candidatesTokenCount", None)
372
+ # See https://github.com/simonw/llm-gemini/issues/75#issuecomment-2861827509
373
+ candidates_token_count = usage.get("candidatesTokenCount") or 0
374
+ thoughts_token_count = usage.get("thoughtsTokenCount") or 0
375
+ output_tokens = candidates_token_count + thoughts_token_count
373
376
  usage.pop("totalTokenCount", None)
374
377
  if input_tokens is not None:
375
378
  response.set_usage(
@@ -1,7 +0,0 @@
1
- llm_gemini.py,sha256=RDPAY0wcCioPz-XeNMIXMah0lqHwGPeVlRnZLvTk4os,18457
2
- llm_gemini-0.19.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
3
- llm_gemini-0.19.dist-info/METADATA,sha256=u4XlQNQ2xVn3KRiDuvz2Tq33pqxbkFkFJl_ST5eYIQY,8117
4
- llm_gemini-0.19.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
5
- llm_gemini-0.19.dist-info/entry_points.txt,sha256=n544bpgUPIBc5l_cnwsTxPc3gMGJHPtAyqBNp-CkMWk,26
6
- llm_gemini-0.19.dist-info/top_level.txt,sha256=WUQmG6_2QKbT_8W4HH93qyKl_0SUteL4Ra6_PhyNGKU,11
7
- llm_gemini-0.19.dist-info/RECORD,,