Is there a way to instantiate an AzureChatOpenAI object that routes requests to a custom API which implements all relevant endpoints from OpenAI? #31189
Unanswered
Dennis-Gruendel-EAG
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked other resources
Commit to Help
Example Code
Description
I have a custom API that mimicks the chat/completions endpoint from OpenAI, but also does some necessary authentication which is why I also need to provide the Bearer token in the request header. As I am using the model for agentic workflows with several tools, I would like to keep using the AzureChatOpenAI class. Is it possible to set it up in a way where it only needs the URL of my backend API and the header, and it would call my backend API just like it would call the Azure OpenAI endpoint?
If I try to instantiate it like in my code example, I get:
And if I provide dummy values for azureOpenAIApiKey, azureOpenAIApiInstanceName, azureOpenAIApiDeploymentName, azureOpenAIApiVersion, my custom API does not register a call and I will get a connection timeout after more than a minute.
System Info
@langchain/openai@>=0.1.0 <0.6.0", "@langchain/openai@^0.5.5; @langchain/openai@~0.0.14
MacOS
Typescript 5.8.2
Beta Was this translation helpful? Give feedback.
All reactions