Skip to content

Fix/issue 10113 embeddings use non default tokenizer #10629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3 changes: 2 additions & 1 deletion litellm/proxy/proxy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -3814,14 +3814,15 @@ async def embeddings( # noqa: PLR0915
if m["model_name"] == data["model"] and (
m["litellm_params"]["model"] in litellm.open_ai_embedding_models
or m["litellm_params"]["model"].startswith("azure/")
or m["litellm_params"]["model"].startswith("hosted_vllm/")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a unit test for this in test_proxy_server.py in tests/litellm -

So there are no future regressions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ideally - this can be a list in constants.py - stating the list of Llmproviders which support an input of array of tokens

Constants.py file -

DEFAULT_BATCH_SIZE = 512

example list -

LITELLM_CHAT_PROVIDERS = [

):
pass
else:
# non-openai/azure embedding model called with token input
input_list = []
for i in data["input"]:
input_list.append(
litellm.decode(model="gpt-3.5-turbo", tokens=i)
litellm.decode(model=m["model_name"], tokens=i)
)
data["input"] = input_list
break
Expand Down
Loading