Private
Public Access
0
0
This commit is contained in:
2026-06-06 00:40:07 -04:00
parent 053f5d867a
commit e670fc1c3e
6 changed files with 60 additions and 102 deletions
+5 -7
View File
@@ -189,18 +189,16 @@ class GeminiCliAdapter:
self.last_latency = current_latency
return {
"text": accumulated_text,
"text": accumulated_text,
"tool_calls": tool_calls,
"stderr": stderr_final
"stderr": stderr_final
}
def count_tokens(self, contents: list[str]) -> int:
"""
Provides a character-based token estimation for the Gemini CLI.
Uses 4 chars/token as a conservative average.
[C: tests/test_gemini_cli_adapter_parity.py:TestGeminiCliAdapterParity.test_count_tokens_fallback]
Provides a character-based token estimation for the Gemini CLI.
Uses 4 chars/token as a conservative average.
[C: tests/test_gemini_cli_adapter_parity.py:TestGeminiCliAdapterParity.test_count_tokens_fallback]
"""
total_chars = len("\n".join(contents))
return total_chars // 4