mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-01 11:02:37 +00:00
Community/Partner: Adding Azure community and partner user agent to better track usage in Python (#29561)
- This pull request includes various changes to add a `user_agent` parameter to Azure OpenAI, Azure Search and Whisper in the Community and Partner packages. This helps in identifying the source of API requests so we can better track usage and help support the community better. I will also be adding the user_agent to the new `langchain-azure` repo as well. - No issue connected or updated dependencies. - Utilises existing tests and docs --------- Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
@@ -643,7 +643,10 @@ class AzureChatOpenAI(BaseChatOpenAI):
|
||||
"organization": self.openai_organization,
|
||||
"base_url": self.openai_api_base,
|
||||
"timeout": self.request_timeout,
|
||||
"default_headers": self.default_headers,
|
||||
"default_headers": {
|
||||
**(self.default_headers or {}),
|
||||
"User-Agent": "langchain-partner-python-azure-openai",
|
||||
},
|
||||
"default_query": self.default_query,
|
||||
}
|
||||
if self.max_retries is not None:
|
||||
|
@@ -198,7 +198,10 @@ class AzureOpenAIEmbeddings(OpenAIEmbeddings): # type: ignore[override]
|
||||
"base_url": self.openai_api_base,
|
||||
"timeout": self.request_timeout,
|
||||
"max_retries": self.max_retries,
|
||||
"default_headers": self.default_headers,
|
||||
"default_headers": {
|
||||
**(self.default_headers or {}),
|
||||
"User-Agent": "langchain-partner-python-azure-openai",
|
||||
},
|
||||
"default_query": self.default_query,
|
||||
}
|
||||
if not self.client:
|
||||
|
@@ -153,7 +153,10 @@ class AzureOpenAI(BaseOpenAI):
|
||||
"base_url": self.openai_api_base,
|
||||
"timeout": self.request_timeout,
|
||||
"max_retries": self.max_retries,
|
||||
"default_headers": self.default_headers,
|
||||
"default_headers": {
|
||||
**(self.default_headers or {}),
|
||||
"User-Agent": "langchain-partner-python-azure-openai",
|
||||
},
|
||||
"default_query": self.default_query,
|
||||
}
|
||||
if not self.client:
|
||||
|
Reference in New Issue
Block a user