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

Azure OpenAI Assistants API #239

Open
bruffridge opened this issue Jul 30, 2024 · 3 comments
Open

Azure OpenAI Assistants API #239

bruffridge opened this issue Jul 30, 2024 · 3 comments
Assignees
Labels
advice Information how to use/implement the component enhancement New feature or request

Comments

@bruffridge
Copy link

bruffridge commented Jul 30, 2024

Has anyone tried deep-chat with Azure Assistants API? I'm in the process of getting an Azure OpenAI account setup, and thought I'd ask to see if deep-chat supports it.

Looks like MS has an NPM package for it too:
https://learn.microsoft.com/en-us/javascript/api/overview/azure/openai-readme?view=azure-node-preview

@OvidijusParsiunas OvidijusParsiunas self-assigned this Jul 30, 2024
@OvidijusParsiunas OvidijusParsiunas added enhancement New feature or request advice Information how to use/implement the component labels Jul 30, 2024
@OvidijusParsiunas
Copy link
Owner

OvidijusParsiunas commented Jul 30, 2024

Hi @bruffridge.

I personally haven't had the chance to play around with it.

Due to a high amount of other features that I have in the priority list - its exploration would unfortunately need to wait. However if you are keen to use it, you can always adapt it along with its npm library by simply using the handler function.

Let me know what your findings are. Thanks!

@bruffridge
Copy link
Author

It has become a requirement for my project to support Assistants API on Azure. I don't think deep-chat will support Assistants API on Azure without a couple of changes.

1. User-defined API endpoint prefixes

Looks like deep-chat would need to add support for user-defined API endpoints for Azure perhaps by creating a new file azureOpenAIAssistantIO.ts or modifying openAIAssistantIO.ts

For example, in this file:

private static readonly THREAD_PREFIX = 'https://api.openai.com/v1/threads';

The API endpoint for OpenAIAssistants is hardcoded as https://api.openai.com/v1/threads whereas its equivalent prefix on Azure is https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads according to the Azure OpenAI Assistants API docs here -> https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-reference?tabs=rest and Assistants Quickstart here -> https://learn.microsoft.com/en-us/azure/ai-services/openai/assistants-quickstart?tabs=command-line%2Ctypescript&pivots=rest-api

2. API_KEY header change

Another difference is instead of setting the api-key as Authorization: Bearer OPENAI_API_KEY header, in Azure it is set as a custom api-key header

curl https://YOUR_RESOURCE_NAME.openai.azure.com/openai/threads \
  -H "Content-Type: application/json" \
  -H "api-key: $AZURE_OPENAI_API_KEY" \
  -d ''

Otherwise I think the API methods are parameters are identical between the two. As such, I don't think adding support will be too difficult, but I might be missing something. I could fork and try to implement and then submit a PR. Thoughts?

@OvidijusParsiunas
Copy link
Owner

Hi @bruffridge.
That sounds good! You are more than welcome to create a PR and I can make any further changes to adhere to our API and coding patterns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
advice Information how to use/implement the component enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants