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 and OpenAI proxy support #322

Merged
merged 2 commits into from
Aug 14, 2023
Merged

Conversation

dlqqq
Copy link
Member

@dlqqq dlqqq commented Aug 7, 2023

Issues closed

Description

  • Adds UI fields for other kwargs accepted by LangChain OpenAI providers: base API URL, OpenAI organization, etc.
  • Provides Azure OpenAI support by implementing AzureChatOpenAIProvider class.
  • Adds a new provider field model_id_label, which is used to indicate what should be used as the local model ID when using a registry provider.
    • SageMaker Endpoints: "Endpoint name"
    • Azure OpenAI: "Deployment name"

@dlqqq dlqqq added enhancement New feature or request backport-1.x labels Aug 7, 2023
@dlqqq
Copy link
Member Author

dlqqq commented Aug 7, 2023

I've edited the model field labels to indicate whether each field is required or optional. There is a better way to do this, and I am tracking this in a separate issue: #323

@dlqqq
Copy link
Member Author

dlqqq commented Aug 7, 2023

@klauern @wanbao118 Unfortunately our team does not have an OpenAI proxy or an Azure deployment available to us. Can each of you test this branch to see if this fixes your respective issue?

I would recommend testing this branch via Conda:

# clone this branch
git clone git@github.com:jupyterlab/jupyter-ai.git
cd jupyter-ai/
git remote add dlqqq git@github.com:dlqqq/jupyter-ai.git
git fetch dlqqq
git checkout better-openai

# install locally in new Conda env
conda create -yn jai-test python=3.11
conda activate jai-test
pip install jupyterlab~=4.0
jlpm && jlpm build && jlpm dev-install
jupyter lab

@klauern
Copy link

klauern commented Aug 8, 2023

Hello @dlqqq ! I think this works! I haven't tried all of the features, but this seems to indicate that it's using the alternate base API URL correctly:

CleanShot 2023-08-08 at 10 28 16

and the logs seem to be showing fine as well:

CleanShot 2023-08-08 at 10 29 22

@anammari
Copy link

anammari commented Aug 9, 2023

I need to integrate the Azure Open AI LLMs into jupyter-ai as well. Any idea of the EDR?

Note: I've tried the steps above to test the better-openai branch but encoutered errors with uninstalling a package (urllib3 2.0.4). I'm working on Windows / WSL2.

@dlqqq
Copy link
Member Author

dlqqq commented Aug 9, 2023

@anammari If you could post the error trace, that would be helpful. We want to improve Windows compatibility, so any leads are appreciated. 🤗

@anammari
Copy link

anammari commented Aug 11, 2023

@anammari If you could post the error trace, that would be helpful. We want to improve Windows compatibility, so any leads are appreciated. 🤗

Thanks @dlqqq

I couldn't log the error in WSL2 (VM crashed unexpectedly while executing the jlpm steps).

However I've tried again using Anaconda in Windows, which hasn't given me any errors this time.

I've tested the Q&A part and it seems to work.

Azure OpenAI credentials entry:

image

Testing Q&A: (Successful)

image

However the magic command has failed with:

AuthenticationError: Incorrect API key provided: ********************. You can find your API key at https://platform.openai.com/account/api-keys.

Is Azure OpenAI supported in magics?

@dlqqq
Copy link
Member Author

dlqqq commented Aug 14, 2023

@anammari Thank you very much for verifying the Azure's availability in the Chat UI! We're excited to make this experience available as fast as possible to our users, so we will be tracking magics support for Azure OpenAI in a separate issue. See: #341

@dlqqq dlqqq changed the title Azure OpenAI support Azure OpenAI and OpenAI proxy support Aug 14, 2023
@dlqqq dlqqq merged commit c689c6c into jupyterlab:main Aug 14, 2023
4 checks passed
@gdmcdonald
Copy link

Thanks for adding and merging the feature to use AzureOpenAI. I'm still confused on how exactly to get it going. Where should I look for instructions? It's not a supported model in the documentation.

dbelgrod pushed a commit to dbelgrod/jupyter-ai that referenced this pull request Jun 10, 2024
* implement Azure OpenAI support and model ID labels

* pre-commit
Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* implement Azure OpenAI support and model ID labels

* pre-commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow specifying OPENAI_API_BASE to override API location Azure OpenAI as Provider Azure Open AI Support?
5 participants