-
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
baseURL parameter of ChatOpenAI not working for Nvidia Nemotron #7356
Comments
The issue you're encountering with the
If these steps do not resolve the issue, you may need to look into creating a custom integration for Nvidia Nemotron that aligns with its specific API requirements. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
@dosu I am trying to use api endpoint that is openai compatible. import OpenAI from 'openai';
const openai = new OpenAI({
apiKey: '$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC',
baseURL: 'https://integrate.api.nvidia.com/v1',
})
async function main() {
const completion = await openai.chat.completions.create({
model: "nvidia/llama-3.1-nemotron-70b-instruct",
messages: [{"role":"user","content":"Write a limerick about the wonders of GPU computing."}],
temperature: 0.5,
top_p: 1,
max_tokens: 1024,
stream: true,
})
for await (const chunk of completion) {
process.stdout.write(chunk.choices[0]?.delta?.content || '')
}
}
main(); Here is the doc on how to use the nemotron model direclty form the nvidia website. Now my question is how can I change the baseURL where the ChatOpenAI hits and send the body to that baseURL ? |
Yes, you can change the import { ChatOpenAI } from "@langchain/openai";
const llmWithNvidiaAPI = new ChatOpenAI({
apiKey: '$API_KEY_REQUIRED_IF_EXECUTING_OUTSIDE_NGC',
temperature: 0.5,
configuration: {
baseURL: "https://integrate.api.nvidia.com/v1", // Nvidia API endpoint
},
model: "nvidia/llama-3.1-nemotron-70b-instruct",
maxTokens: 1024,
stream: true,
});
await llmWithNvidiaAPI.invoke("Write a limerick about the wonders of GPU computing."); This setup allows you to specify a custom base URL, directing requests to the Nvidia API endpoint. Ensure that the API key and other parameters are correctly configured to match Nvidia's requirements [1]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
@dosu This is exactly what I am doing but it does not work.
|
To resolve the 401 status code error when using the Nvidia API with the
These steps should help address the authentication error [1][2]. To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
Checked other resources
Example Code
This is my code to select the model
P.S: All the api key are correct , it not the issue with that, I tested in thunderclient, the api key works and I get the response back.
Error Message and Stack Trace (if applicable)
401 status code (no body)
Error: 401 status code (no body)
at APIError.generate (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/openai/error.mjs:63:20)
at OpenAI.makeStatusError (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/openai/core.mjs:323:65)
at OpenAI.makeRequest (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected][email protected][email protected]/node_modules/openai/core.mjs:367:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async eval (webpack-internal:///(rsc)/./node_modules/.pnpm/@langchain[email protected][email protected]/node_modules/@langchain/openai/dist/chat_models.js:814:29)
at async RetryOperation.eval [as _fn] (webpack-internal:///(rsc)/./node_modules/.pnpm/[email protected]/node_modules/p-retry/index.js:50:12)
Description
I am building a AI app where we can chose different AI models to certain task. I want to use this nemotron model but seems like it is not implemented in langchain and the
baseURL
of doing the thing is also does not work.System Info
pnpm 9.6,
windows 11
node js 20.x
The text was updated successfully, but these errors were encountered: