Closed fkohrt closed 3 months ago
You don't need to use the environment variables for Azure Assistants at all (also you don't need to use the default values, you can easily change them).
This is an Assistant I have on Azure, and I do not have any environment variables set for Assistants/Azure.
https://docs.librechat.ai/install/configuration/azure_openai.html#using-assistants-with-azure
Here's my working setup with the librechat.yaml
file:
version: 1.0.5
cache: true
endpoints:
azureOpenAI:
titleModel: "gpt-3.5-turbo-1106"
titleConvo: true
assistants: true # <-------- critical
groups:
- group: "region-westus"
apiKey: "${WESTUS_API_KEY}"
instanceName: "region-westus"
version: "2024-03-01-preview"
models:
gpt-3.5-turbo:
deploymentName: "gpt-35-turbo"
gpt-3.5-turbo-1106:
deploymentName: "gpt-35-turbo-1106"
gpt-4:
deploymentName: "gpt-4"
- group: "region-sweden"
apiKey: "${SWEDEN_API_KEY}"
instanceName: "region-sweden"
deploymentName: gpt-4-1106-preview
version: "2024-03-01-preview"
assistants: true # <-------- critical
models:
gpt-4-turbo: true
- group: "azure-openai"
apiKey: "${AZURE_OAI_API_KEY}"
instanceName: "azure-openai"
deploymentName: gpt-4-1106-preview
version: "2024-03-01-preview"
assistants: true # <-------- critical
models:
gpt-4-1106-preview: true
gpt-4-vision-preview:
deploymentName: gpt-4-vision-preview
Also make sure to use docker compose pull
if using docker to pull the latest built image.
I am not sure I understand what you are saying. At first, I configured Azure OpenAI as follows:
.env
librechat.yaml
docker-compose.override.yml
Now with that setup, upon login to LibreChat I see the following error message in the console:
XHR request to /api/assistants?order=asc
: 500 Internal Server Error
Response {"message":"Error listing assistants"}
Also, in the logs (docker compose logs | less -R
) I can see the following:
LibreChat | 2024-03-23 20:00:37 error: [/assistants] Error listing assistants User-provided key not found
And the log file logs/error-2024-03-23.log
shows this:
{"level":"error","message":"[/assistants] Error listing assistants User-provided key not found","stack":"Error: User-provided key not found\n at getUserKey (/app/api/server/services/UserService.js:27:11)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async initializeClient (/app/api/server/services/Endpoints/assistants/initializeClient.js:33:18)\n at async listAssistants (/app/api/server/services/Endpoints/assistants/index.js:19:22)\n at async Promise.all (index 0)\n at async listAssistantsForAzure (/app/api/server/services/Endpoints/assistants/index.js:50:27)\n at async /app/api/server/routes/assistants/assistants.js:160:14"}
I cannot see existing assistants nor can I create new ones using the assistant builder. Only if I comment out the line ASSISTANTS_API_KEY=user_provided
within .env
, I don't get the error message anymore and can successfully chat with Azure OpenAI assistants. What alternative do you suggest to resolve the error message I get?
@danny-avila Maybe you can have a look at this again?
@danny-avila Maybe you can have a look at this again?
I don't understand what the issue is with doing this:
Only if I comment out the line ASSISTANTS_API_KEY=user_provided within .env, I don't get the error message anymore and can successfully chat with Azure OpenAI assistants. What alternative do you suggest to resolve the error message I get?
Setting up Azure through the yaml file implies you are providing the credentials, so there is no need to set ASSISTANTS_API_KEY=user_provided
My point is that somebody who wants to use Azure OpenAI models needs to know that ASSISTANTS_API_KEY=user_provided
is set by default and needs to "unset" it in order for their Azure assistants to work.
The documentation could benefit from telling Azure users that they need to make a change to the default .env
, which is what I was trying to implement in #2173.
My point is that somebody who wants to use Azure OpenAI models needs to know that
ASSISTANTS_API_KEY=user_provided
is set by default and needs to "unset" it in order for their Azure assistants to work.The documentation could benefit from telling Azure users that they need to make a change to the default
.env
, which what I was trying to implement in #2173.
Oh I see, so sorry to misunderstand you. This makes a lot more sense now, I think I reviewed that PR in haste with a couple other things going on, my bad. Glad you brought this up again. I'll review again and merge
What happened?
The default
.env
contains the lineASSISTANTS_API_KEY=user_provided
. When pre-configuring Azure OpenAI models, this setting makes it impossible to use assistants due to a missing user provided key. Only by commenting the line out the Azure setup works.Steps to Reproduce
Configure Azure OpenAI models with assistants enabled. Try to use the assistant builder to create a new assistant, see the error message.
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Screenshots
No response
Code of Conduct