Skip to content

/v1/embeddings expects a list of string input but not a single string not in list format #73

@AaronSeibert

Description

@AaronSeibert

Based on https://platform.openai.com/docs/api-reference/embeddings, the input field should be either string or array type. I'm utilizing a client that's generating a 422 response from mlx-openai-server. I tried sending a sample request based on the openai docs:

❯ curl http://localhost:8000/v1/embeddings -H "Content-Type: application/json" -d '{"input":"embed this", "model": "mlx-community/all-MiniLM-L6-v2-4bit", "encoding_format": "float"}'

And I get the following response:
{"detail":[{"type":"list_type","loc":["body","input"],"msg":"Input should be a valid list","input":"embed this"}]}

When converting the input field to an array, it works successfully. However, this shows an incompatibility with the openai api specification

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions