Skip to content
This repository was archived by the owner on Feb 11, 2025. It is now read-only.

Conversation

@singularity-sg
Copy link
Contributor

Description

We want to extend the OpenAiClient so that additional headers could be inserted into the client for reasons like network routing/usage control/audits etc.

Approach

I've simply added the additionalHeaders field into the OpenAiClient so that it can be used by an interceptor for injecting headers whenever a call is made to OpenAI or a proxy.

@singularity-sg singularity-sg force-pushed the singularity-sg/allow-headers-in-openai-client branch from 75b09b3 to 925669f Compare March 12, 2024 05:53
langchain4j
langchain4j previously approved these changes Mar 12, 2024
Copy link
Contributor

@langchain4j langchain4j left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@singularity-sg great job, thanks you! Just a small nitpick regarding naming :)

@ai-for-java ai-for-java merged commit 5fb4b94 into ai-for-java:main Mar 12, 2024
ai-for-java pushed a commit that referenced this pull request Mar 12, 2024
…derInjector before RequestLoggingInterceptor, so that all headers are logged
@singularity-sg singularity-sg deleted the singularity-sg/allow-headers-in-openai-client branch March 18, 2024 01:39
ai-for-java pushed a commit that referenced this pull request Mar 19, 2024
# Description This is a follow up bug fix to an earlier PR #19 that sets the generic header interceptor only when `CustomHeaders` are present. We should inject other headers from `User-Agent` or `Organization-Id` regardless of the presence of `CustomHeaders` cc: @langchain4j
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

4 participants