-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Can‘t use custom baseUrl #3565
Comments
🤖 Hello @weirdo21371480, I'm Dosu, a friendly bot here to assist while you wait for a human maintainer. I'm here to help you solve bugs, answer questions, and guide you in becoming a contributor to langchainjs. Let's get started! Based on the information you've provided, it seems like you're trying to use a custom Here's how you can do it: import { OpenAIEmbeddings } from "langchain/embeddings/openai";
const embeddings = new OpenAIEmbeddings({
openAIApiKey: "YOUR-API-KEY", // In Node.js defaults to process.env.OPENAI_API_KEY
batchSize: 512, // Default value if omitted is 512. Max is 2048
configuration: {
baseURL: "https://your_custom_url.com",
},
}); In this code, the If you're trying to use a custom API endpoint with the same structure as Azure OpenAI, you can adjust the import { OpenAI } from "langchain/llms/openai";
const model = new OpenAI(
{ temperature: 0 },
{ basePath: "https://your-custom-api.com/v1" } // replace with your API endpoint
);
const res = await model.call(
"What would be a good company name a company that makes colorful socks?"
);
console.log(res); In this example, LangChain will send the request to If you're still encountering issues, could you please provide more details about the error message or behavior you're experiencing? This will help me better understand the problem and provide a more accurate solution. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
@dosu-bot. |
🤖 I'm here to help! Could you please provide more details about what you've tried and what specific issue you're encountering? This will help me understand the problem better and provide you with the most accurate assistance. This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
const llm = new OpenAI({
modelName: "gpt-3.5-turbo-instruct",
openAIApiKey: process.env.Open_API_KEY,
configuration: {
baseURL: "https://api.132999.xyz/v1/",
},
temperature: 0.5
});
const chain = loadQAStuffChain(llm);
const fields = {
modelName: "gpt-3.5-turbo-instruct",
openAIApiKey: process.env.Open_API_KEY,
configuration: {
baseURL: "https://api.132999.xyz/v1/",
}
};
const embeddings = new OpenAIEmbeddings(fields);
Is it same as the langchain/embeddings/openai? It doesn't work yet.
The text was updated successfully, but these errors were encountered: