-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(openai): update azure user agent #7543
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import process from "node:process"; | ||
import { type ClientOptions, AzureOpenAI as AzureOpenAIClient } from "openai"; | ||
import { | ||
LangSmithParams, | ||
|
@@ -504,9 +505,7 @@ export class AzureChatOpenAI extends ChatOpenAI { | |
|
||
params.defaultHeaders = { | ||
...params.defaultHeaders, | ||
"User-Agent": params.defaultHeaders?.["User-Agent"] | ||
? `${params.defaultHeaders["User-Agent"]}: langchainjs-azure-openai-v2` | ||
: `langchainjs-azure-openai-v2`, | ||
"User-Agent": `langchainjs-azure-openai/2.0.0 (node.js/${process.version}; ${process.platform}; ${process.arch}) ${params.defaultHeaders?.["User-Agent"] || ""}` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should the version be pulled from a variable, so this doesnt have to be reset on future releases? @sinedied ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately we don't have a way to do this at the moment 😞 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @johnpapa the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we would need to manually some process to bump a statically specified version on release. We do it here: https://github.com/langchain-ai/langsmith-sdk/blob/main/js/src/index.ts#L21 I just haven't had time to set it up |
||
}; | ||
|
||
this.client = new AzureOpenAIClient({ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh hmm actually this will break non-node environments - can we use this instead? https://github.com/langchain-ai/langchainjs/blob/main/langchain-core/src/utils/env.ts#L40