Rahul Bhatewara
RRunPod
•Created by Rahul Bhatewara on 5/13/2025 in #⚡|serverless
Serverless Text Embedding - 400
I'm using a text embedding serverless endpoint to run an instance of "sentence-transformers/all-MiniLM-L6-v2". I keep getting a bad request 400 error. The old code I had (using openAI SDK) stopped working and I've tried to configure based on new documentation without any luck. Would greatly appreciate any help!
New
---------
runpod.api_key = os.getenv("RUNPOD_API_KEY")
cleaned_text = {"prompt": "Hello, World!"}
endpoint = runpod.Endpoint("i10xxxxxxxxvp")
run_request = endpoint.run("Your text to embed here")
Old (worked before)
-------
cleaned_text = 'This is clean text.'
Initialize OpenAI client with RunPod configuration
api_key = os.getenv("RUNPOD_API_KEY")
client = OpenAI(
api_key=api_key,
base_url= os.getenv("https://api.runpod.ai/v2/i10rxxxxxxxxxxxp/openai/v1")
)
Get embedding using OpenAI-compatible endpoint
response = client.embeddings.create(
model="sentence-transformers/all-MiniLM-L6-v2",
input=cleaned_text
)
embedding = response.data[0].embedding
17 replies