feat: add defaultHeaders support to all LLM providers#17
Draft
feat: add defaultHeaders support to all LLM providers#17
Conversation
Add defaultHeaders configuration option to all LLM providers (OpenAI, Anthropic, Azure, Mistral, Llama, Bedrock, Vertex Studio), enabling custom metadata and authentication mechanisms similar to the official OpenAI client. - Add mergeHeaders utility function for proper header precedence - Update all provider config types to include defaultHeaders field - Implement header merging in all fetch calls and SDK initializations - Priority: required headers > default headers (prevents auth override)
|
|
Add unit tests for defaultHeaders support across all LLM providers: - Test mergeHeaders utility function (7 tests) - Verify proper header precedence (required > default) - Test edge cases (empty, undefined, overlapping headers) - Test fetch-based providers (12 tests) - Anthropic: defaultHeaders in fetch calls - Mistral: header merging with Authorization - Llama: header merging with custom and auth headers - Vertex Studio: Content-Type precedence - Azure: header merging with apiKey and accessToken auth - Test OpenAI SDK integration (8 tests) - llmOpenAI: defaultHeaders passed to SDK constructor - llmOpenAIResponses: defaultHeaders with jsonSchema config - Verify baseURL and defaultHeaders work together All 27 new tests pass. Existing unit tests remain unaffected.
Member
|
Needs documentation too. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add defaultHeaders configuration option to all LLM providers (OpenAI, Anthropic, Azure, Mistral, Llama, Bedrock, Vertex Studio), enabling custom metadata and authentication mechanisms similar to the official OpenAI client.