Disable special token restriction for claude ai

This commit is contained in:
xihajun 2024-03-03 23:43:03 +00:00 committed by GitHub
parent b283588eb8
commit 14a19fc601
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -200,10 +200,10 @@ def completion(
## CALCULATING USAGE
prompt_tokens = len(
encoding.encode(prompt)
encoding.encode(prompt,disallowed_special=())
) ##[TODO] use the anthropic tokenizer here
completion_tokens = len(
encoding.encode(model_response["choices"][0]["message"].get("content", ""))
encoding.encode(model_response["choices"][0]["message"].get("content", ""),disallowed_special=())
) ##[TODO] use the anthropic tokenizer here
model_response["created"] = int(time.time())