Closed M-Sakr closed 1 month ago
you absolutely can, set the OPENAI_API_ENDPOINT
to your azure base url to do that, and use your azure openai key for the api key as well
@steve8708
Thank you for this wonderful project. I would like to use this amazing application with Azure OpenAI as well. However, when I tried to use it, a 404 error was displayed.
% npx micro-agent config set OPENAI_API_ENDPOINT=https://${NAME}.openai.azure.com/openai/deployments/gpt-35-turbo-16k
% npx micro-agent config set OPENAI_KEY=${AZURE OPENAI API KEY}
% npx micro-agent config set MODEL=gpt-35-turbo-16k
% npx micro-agent
┌ 🦾 Micro Agent
│
◇ What would you like to do?
│ hello world
│
◒
✖ 404 Resource not found
at APIError.generate (file:///micro-agent/node_modules/openai/error.mjs:50:20)
at OpenAI.makeStatusError (file:///micro-agent/node_modules/openai/core.mjs:268:25)
at OpenAI.makeRequest (file:///micro-agent/node_modules/openai/core.mjs:312:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async getSimpleCompletion (file:///micro-agent/node_modules/@builder.io/micro-agent/dist/cli.mjs:1056:22)
at async getFileSuggestion (file:///micro-agent/node_modules/@builder.io/micro-agent/dist/cli.mjs:955:9)
at async interactiveMode (file:///micro-agent/node_modules/@builder.io/micro-agent/dist/cli.mjs:735:33)
at async file:///micro-agent/node_modules/@builder.io/micro-agent/dist/cli.mjs:1777:11
Is the usage correct? Upon checking the code, it looks like the following, but in the case of Azure, we may need to pass the API key in the header.
before
const openai = new OpenAI({
apiKey: openaiKey,
baseURL: endpoint
});
after
const client = new OpenAI({
apiKey: openaiKey,
baseURL: endpoint
defaultHeaders: {
"api-key": openaiKey,
},
defaultQuery: {
"api-version": "2024-05-01-preview",
},
});
client.chat.completions
.create({
model: "gpt-35-turbo-16k",
messages: [{ role: "user", content: "hello world" }],
})
.then((e) => {
console.log(e);
});
Hi, i'm big fan of your project, i use azure ai, and i have instance at openai.azure.com, is there a way to use it?, how can i configure it?