Skip to content

Handle support for tokenized input for embeddings using langchain AzureOpenAIEmbeddings #87

@kdawg500

Description

@kdawg500

Using the regular Azure OpenAI client to get embeddings the request body looks something like this:
{ "model": "text-embedding-3-small", "input": "The quick brown fox jumps over the lazy dog.", "encoding_format": "base64" }

This return a successful response.

However when using the langchain AzureOpenAIEmbeddings class to generate embeddings the payload looks like this:
{ "model": "text-embedding-3-small", "input": [15339, 1917], "encoding_format": "base64" }

This returns a 500 status code. As far as I am aware its because of langchain is using tiktoken to convert the input string into tokenIds for optimization purposes. Can support for this be added or am I barking up the wrong tree?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions