fix: openai tool tokens (#2026)

This commit is contained in:
Yeuoly
2024-01-14 15:51:05 +08:00
committed by GitHub
parent d8c0d722d2
commit 149102927b
2 changed files with 26 additions and 2 deletions

View File

@@ -765,7 +765,6 @@ class OpenAILargeLanguageModel(_CommonOpenAI, LargeLanguageModel):
num_tokens = 0
for tool in tools:
num_tokens += len(encoding.encode('type'))
num_tokens += len(encoding.encode(tool.get("type")))
num_tokens += len(encoding.encode('function'))
# calculate num tokens for function object