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 aiohttp
|
||||
from tokenizers import Tokenizer
|
||||
import pkg_resources
|
||||
encoding = tiktoken.get_encoding("cl100k_base")
|
||||
import importlib.metadata
|
||||
from .integrations.traceloop import TraceloopLogger
|
||||
|
@ -723,7 +724,8 @@ def token_counter(model="", text=None, messages: Optional[List] = None):
|
|||
# anthropic
|
||||
elif model in litellm.anthropic_models:
|
||||
# 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)
|
||||
# Decode the JSON data from utf-8
|
||||
json_data_decoded = json.dumps(json_data, ensure_ascii=False)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[tool.poetry]
|
||||
name = "litellm"
|
||||
version = "0.1.735"
|
||||
version = "0.1.736"
|
||||
description = "Library to easily interface with LLM API providers"
|
||||
authors = ["BerriAI"]
|
||||
license = "MIT License"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue