BerriAI / litellm

Python SDK, Proxy Server (LLM Gateway) to call 100+ LLM APIs in OpenAI format - [Bedrock, Azure, OpenAI, VertexAI, Cohere, Anthropic, Sagemaker, HuggingFace, Replicate, Groq]
https://docs.litellm.ai/docs/
Other
14.13k stars 1.67k forks source link

[Bug] Sagemaker Embedding endpoint exception with text_inputs key #2608

Open gauravnbcu opened 8 months ago

gauravnbcu commented 8 months ago

This causes Exception https://github.com/BerriAI/litellm/blob/cace0bd6fbd77e3abf4723db7c1d459c90e5abe2/litellm/llms/sagemaker.py#L593

{ "error": { "message": "Received client error (400) from primary with message \"{\n \"code\": 400,\n \"type\": \"InternalServerException\",\n \"message\": \"text input must be of typestr(single example),List[str](batch or single pretokenized example) orList[List[str]](batch of pretokenized examples).\"\n}\n\". See https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#logEventViewer:group=/aws/sagemaker/Endpoints/hf-bge-large-en-v15 in account <> for more information.", "type": null, "param": null, "code": 500 } }

Should be changed to data = json.dumps({"inputs": input}).encode("utf-8")

ishaan-jaff commented 8 months ago

@gauravnbcu can I see how you're making the call to litellm ?

gauravnbcu commented 8 months ago

Through Postman POST call for /v1/embeddings with following body { "model":"bge-embedding-large", "input":"this is a test sentence" }

ishaan-jaff commented 8 months ago

@gauravnbcu can we live debug this together ? Want to make sure I understand the issue: I'm on here if you're free: https://meet.google.com/psj-bgtf-uba

Sharing a link to my cal for your convenience: https://calendly.com/d/4mp-gd3-k5k/berriai-1-1-onboarding-litellm-hosted-version?month=2023-10

gauravnbcu commented 8 months ago

Sure, We can meet at 3pm EST or earlier, let me know your availability

ishaan-jaff commented 8 months ago

@gauravnbcu what's the best email to send an invite to? You can DM on Linkedin if you prefer: https://www.linkedin.com/in/reffajnaahsi/

gauravnbcu commented 8 months ago

@ishaan-jaff Can we use https://meet.google.com/psj-bgtf-uba now ?

ishaan-jaff commented 8 months ago

@gauravnbcu I scheduled a meeting for 3pm EST / 12pm PT here https://calendar.app.google/6fZ7aEBgYkiuH21n6

gauravnbcu commented 7 months ago

@ishaan-jaff Are you guys on planning to fix this or not