alondmnt / joplin-plugin-jarvis

Joplin (note-taking) assistant running a very intelligent system (OpenAI/GPT, Hugging Face, Gemini, Llama, Universal Sentence Encoder, etc.)
GNU Affero General Public License v3.0
225 stars 22 forks source link

Azure OpenAI support? #31

Open mabahj opened 2 months ago

mabahj commented 2 months ago

Ref #9 where it seems like Azure OpenAI should work but maybe a bit untested.

I am very intrigued by your project, so I am trying to make it work with Azure. However, I am getting some error messages and I am not quite sure how to set it up. I am trying Jarvis: Chat for now. Are you able to give me some hints?

I've tried these two alternatives:

Setting Value
Model: OpenAI API Key my-key-xyz-123
Chat: Model (online/offline) OpenAI or compatible: custom model
Chat: Custom model API endpoint https://xxxxx.openai.azure.com
Chat: OpenAI (or compatible) custom model ID gpt-4o (also tried gpt-4)
Error message from Jarvis Error message: Resource not found
Setting Value
Model: OpenAI API Key my-key-xyz-123
Chat: Model (online/offline) OpenAI or compatible: custom model
Chat: Custom model API endpoint xxxxx.openai.azure.com
Chat: OpenAI (or compatible) custom model ID gpt-4o (also tried gpt-4)
Error message from Jarvis Request Timeout (60 sec)
(Note that this error appears after 1-2 seconds.)

I have a small python script I've used to verify my Azure OpenAI endpoint ID, API key and model names.

mabahj commented 1 month ago

I found https://learn.microsoft.com/en-us/azure/ai-services/openai/reference so I also tried

https://{endpoint}.openai.azure.com/openai/deployments/{deployment-id}/completions?api-version=2024-06-01 https://{endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version=2024-06-01

Where I replaced {endpoint} and {deployment-id} with my data. I also tried the API version I have running on my python test script. And I also tried without specifying the API version.

alondmnt commented 1 month ago

I don't have access to Azure OpenAI, but based on their docs the latter option seems to be correct.

What is the error that you get?

Have you tried setting your deployment ID as your Chat: OpenAI (or compatible) custom model ID?

mabahj commented 1 month ago

Thanks for following up! Appreciated!

The error message I am receiving is Request Timeout (60 sec) from Jarvis, nothing else. Note that this error appears after 1-2 seconds, sometimes 5-10. My Chat: Timeout (sec) setting is 60 seconds, so it is a bit odd. It does not seem to actually time out.

error1

Chat: OpenAI (or compatible) custom model ID is set to the Deployment Name from Azure. Note that I cannot find an "Deployment ID" specifically listed in the list of deployments at Azure, but the Deployment Name is a custom field and I am pretty sure it is the same as a "Deployment ID". Related, I found this document https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/switching-endpoints that describes the differences between OpenAI and Azure OpenAI. It seems to support that Deployment Name is what I'm supposed to use? Either way, it could be a good document unless you've already seen it.

I tried to enable debug logging (https://joplinapp.org/help/apps/debugging/) but the logs did not contain anything from Jarvis. Any logs somewhere that I can provide, if that helps?