Skip to content
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

how to change default endpoint from Azure OpenAi to normal open ai ? #1523

Open
rogerbarretocode opened this issue Nov 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@rogerbarretocode
Copy link

when trying to use contextawareagent example from the docs i get this error AuthenticationError: 401 Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.
at Function.generate (C:\Users\roger\OneDrive\Desktop\bloom\node_modules\openai\src\error.ts:74:14)
at AzureOpenAI.makeStatusError (C:\Users\roger\OneDrive\Desktop\bloom\node_modules\openai\src\core.ts:435:21)
at AzureOpenAI.makeRequest (C:\Users\roger\OneDrive\Desktop\bloom\node_modules\openai\src\core.ts:499:24)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Function.getOpenAIEmbedding (C:\Users\roger\OneDrive\Desktop\bloom\node_modules@llamaindex\openai\dist\index.js:1066:26)
at async batchEmbeddings (file:///C:/Users/roger/OneDrive/Desktop/bloom/node_modules/@llamaindex/core/embeddings/dist/index.js:237:32)
at async Function.getTextEmbeddingsBatch (file:///C:/Users/roger/OneDrive/Desktop/bloom/node_modules/@llamaindex/core/embeddings/dist/index.js:220:16)
at async file:///C:/Users/roger/OneDrive/Desktop/bloom/node_modules/@llamaindex/core/embeddings/dist/index.js:190:36
at async VectorStoreIndex.getNodeEmbeddingResults (file:///C:/Users/roger/OneDrive/Desktop/bloom/node_modules/llamaindex/dist/indices/vectorStore/index.js:87:17)
at async VectorStoreIndex.insertNodes (file:///C:/Users/roger/OneDrive/Desktop/bloom/node_modules/llamaindex/dist/indices/vectorStore/index.js:186:17)
at async VectorStoreIndex.buildIndexFromNodes (file:///C:/Users/roger/OneDrive/Desktop/bloom/node_modules/llamaindex/dist/indices/vectorStore/index.js:99:9)
at async VectorStoreIndex.init (file:///C:/Users/roger/OneDrive/Desktop/bloom/node_modules/llamaindex/dist/indices/vectorStore/index.js:49:13)
at async VectorStoreIndex.fromDocuments (file:///C:/Users/roger/OneDrive/Desktop/bloom/node_modules/llamaindex/dist/indices/vectorStore/index.js:128:16)
at async createContextAwareAgent (C:\Users\roger\OneDrive\Desktop\bloom\ragagent.ts:22:17) {
status: 401,
headers: {
'apim-request-id': '22e73053-aa17-4f7a-b33a-3578b4ad68e5',
connection: 'keep-alive',
'content-length': '224',
'content-type': 'application/json',
date: 'Mon, 25 Nov 2024 13:17:21 GMT'
},
request_id: undefined,
error: {
code: '401',
message: 'Access denied due to invalid subscription key or wrong API endpoint. Make sure to provide a valid key for an active subscription and use a correct regional API endpoint for your resource.'
},
code: '401',
param: undefined,
type: undefined
}

looks like its defaulting to azure open ai endpoint but i am using the api key from open ai website . what part of my code do i change ?

Settings.llm= new OpenAI({
apiKey: "",
model: 'gpt-4o-mini',
temperature: 0,
},
)

// Create the Context-Aware Agent
const agent = new OpenAIContextAwareAgent({
tools:([]),
contextRetriever: retriever,
});

// Use the agent to answer queries
const response = await agent.chat({
message: "What is LlamaIndex used for?",
});

console.log("Agent Response:", response.response);
}

createContextAwareAgent().catch(console.error);

@rogerbarretocode rogerbarretocode added the bug Something isn't working label Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant