Skip to content

Azure embedding requests return 404 - malformed URL construction #3163

@philspbr

Description

@philspbr

Description
When using Azure as the embedding provider for folders/sources, file uploads fail during the embedding phase with a 404 Resource Not Found error. The root cause is a malformed URL being constructed with a duplicate /embeddings path segment.
The embedding_endpoint stored in EmbeddingConfig is pre-constructed with the full path including /embeddings?api-version=.... However, when the OpenAI Python SDK's client.embeddings.create() method is called, it automatically appends /embeddings to the base URL. This results in the path appearing twice:

Expected URL
POST https://<azure-resource>.cognitiveservices.azure.com/openai/deployments/text-embedding-3-small/embeddings?api-version=2024-02-15-preview

Actual URL
POST https://<azure-resource>.cognitiveservices.azure.com/openai/deployments/text-embedding-3-small/embeddings?api-version=2024-02-15-preview/embeddings

Steps to reproduce

  1. Configure Letta with Azure embedding provider
  2. Create an agent with Azure embeddings
  3. Create a folder using the agent's embedding configuration
  4. Upload a file to the folder
  5. Observe 404 errors in the logs during the embedding phase

Suggested Fix
The embedding_endpoint should either not include the /embeddings suffix (letting the SDK add it), or be used as the complete URL without the SDK appending additional path segments. The fix is likely in letta/llm_api/azure_client.py or wherever the Azure embedding endpoint URL is constructed.

Setup
Letta self-hosted 0.16.2

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