Skip to content

Propagate custom headers for OpenAI embeddings#6575

Open
flex-ilsub wants to merge 1 commit into
spring-projects:mainfrom
flex-ilsub:fix-embedding-custom-headers
Open

Propagate custom headers for OpenAI embeddings#6575
flex-ilsub wants to merge 1 commit into
spring-projects:mainfrom
flex-ilsub:fix-embedding-custom-headers

Conversation

@flex-ilsub

Copy link
Copy Markdown

OpenAiEmbeddingOptions#toOpenAiCreateParams built the request from model/input/user/encodingFormat/dimensions only, silently dropping per-call customHeaders. As a result, a shared embedding client could not forward per-request headers (e.g. distributed-tracing identifiers or LLM-gateway headers) to the OpenAI API.

This mirrors the fix already applied to chat (OpenAiChatModel#createRequest, propagating per-call headers via putAdditionalHeader) and images (#6083), applying the same pattern to the embedding path.

Fixes #6574

🤖 Generated with Claude Code

OpenAiEmbeddingOptions#toOpenAiCreateParams built the request from
model/input/user/encodingFormat/dimensions only, silently dropping
per-call customHeaders. This mirrors the fix already applied to chat
(OpenAiChatModel#createRequest) and images (spring-projects#6083), so a single
embedding client can forward per-request headers (e.g. tracing or
gateway identifiers) to the OpenAI API.

Fixes spring-projects#6574

Signed-off-by: Il Sub Bang <ilsub@flex.team>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@flex-ilsub

Copy link
Copy Markdown
Author

Please let me know if it's an issue that Claude is listed as Co-Authored-By in the commit. If it is, I can amend the commit and recreate the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Per-call customHeaders not propagated in OpenAiEmbeddingOptions

3 participants