-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
NotFoundError: 404 status code (no body) error, when hosted inference URL is used inside OpenAI #4542
Comments
🤖 Based on the error message you've shared, it seems like the server is unable to find the resource you're requesting. This could be due to an incorrect endpoint or the model you're trying to use is not available. In your code, you're trying to use a baseURL of "http://localhost:PORT/v1". Please ensure that you have a server running on this URL and that it's correctly configured to handle the requests from the OpenAI model. If you're using a local server for testing, replace "PORT" with the actual port number where your server is running. If you're trying to use a hosted model from OpenAI, you should use the correct baseURL for OpenAI's API. Here's an example of how to do it: import { OpenAI } from "@langchain/openai";
const model = new OpenAI({
temperature: 0.9,
openAIApiKey: "xyz",
configuration: {
baseURL: "https://api.openai.com/v1",
},
});
const res = await model.call(
"Tell me a story about a boy"
);
console.log({ res }); In this example, the baseURL is set to "https://api.openai.com/v1", which is the correct baseURL for OpenAI's API. Also, please ensure that you're using the correct OpenAI API key. The key should be passed as the If you're still encountering the issue after checking these points, it would be helpful if you could provide more details about your setup and the exact steps you're taking when the error occurs. This will help in identifying the root cause of the issue and finding a suitable solution. For more information, you can refer to the LangChainJS documentation and the OpenAI API documentation. I hope this helps! If you have any more questions, feel free to ask. Sources
|
I am using huggingface text-generation inference endpoints. so the URL is "http://x.x.x.x:PORT/v1" |
The text was updated successfully, but these errors were encountered: