Skip to content

Embedding API fails to deserialize base64 #40

Description

@DireMunchkin

I was trying out Maple Proxy for text embedding when I ran into this issue. I was using it for Obsidian Copilot. Copilot requests "encoding_format": "base64", which is allowed by the OpenAI API.

This is correctly returned from the backend, but the Maple Proxy tried and failed to deserialize the response as floatinstead, leading to a error in the proxy and failing to pass on the response back to the client.

Steps to reproduce:

# Works fine (default float format):
curl -X POST 'http://localhost:8080/v1/embeddings' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <key>' \
  -d '{"model": "nomic-embed-text", "input": "Hello!"}'

# Returns 500 Internal Server Error:
curl -X POST 'http://localhost:8080/v1/embeddings' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <key>' \
  -d '{"model": "nomic-embed-text", "input": "Hello!", "encoding_format": "base64"}'

This then leads the Maple Proxy to throw this error:

Serialization error: invalid type: string "<base64...>", expected a sequence

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions