forked from phoenix/litellm-mirror
fix anthropic json location bug
This commit is contained in:
parent
9ef0ad9e66
commit
e1d0c6096c
4 changed files with 4 additions and 2 deletions
Binary file not shown.
Binary file not shown.
|
@ -8,6 +8,7 @@ import tiktoken
|
||||||
import uuid
|
import uuid
|
||||||
import aiohttp
|
import aiohttp
|
||||||
from tokenizers import Tokenizer
|
from tokenizers import Tokenizer
|
||||||
|
import pkg_resources
|
||||||
encoding = tiktoken.get_encoding("cl100k_base")
|
encoding = tiktoken.get_encoding("cl100k_base")
|
||||||
import importlib.metadata
|
import importlib.metadata
|
||||||
from .integrations.traceloop import TraceloopLogger
|
from .integrations.traceloop import TraceloopLogger
|
||||||
|
@ -723,7 +724,8 @@ def token_counter(model="", text=None, messages: Optional[List] = None):
|
||||||
# anthropic
|
# anthropic
|
||||||
elif model in litellm.anthropic_models:
|
elif model in litellm.anthropic_models:
|
||||||
# Read the JSON file
|
# Read the JSON file
|
||||||
with open('../llms/tokenizers/anthropic_tokenizer.json', 'r') as f:
|
filename = pkg_resources.resource_filename(__name__, 'llms/tokenizers/anthropic_tokenizer.json')
|
||||||
|
with open(filename, 'r') as f:
|
||||||
json_data = json.load(f)
|
json_data = json.load(f)
|
||||||
# Decode the JSON data from utf-8
|
# Decode the JSON data from utf-8
|
||||||
json_data_decoded = json.dumps(json_data, ensure_ascii=False)
|
json_data_decoded = json.dumps(json_data, ensure_ascii=False)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "litellm"
|
name = "litellm"
|
||||||
version = "0.1.735"
|
version = "0.1.736"
|
||||||
description = "Library to easily interface with LLM API providers"
|
description = "Library to easily interface with LLM API providers"
|
||||||
authors = ["BerriAI"]
|
authors = ["BerriAI"]
|
||||||
license = "MIT License"
|
license = "MIT License"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue