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

Add support for Azure Open AI Embeddings to Jupyter AI #940

Merged
merged 3 commits into from
Aug 14, 2024

Conversation

gsrikant7
Copy link
Contributor

This PR adds Azure Open AI embeddings provider to be able to use embedding use cases like /learn from jupyter-ai UI.

Related issue - #349

Caveats: It expects that the model_id and the deployment_name are same for the embeddings model. It currently does not support custom deployment names.

For example, to use text-embedding-ada-002 embedding model, create a deployment with name text-embedding-ada-002 and use it.

@gsrikant7 gsrikant7 marked this pull request as ready for review August 7, 2024 14:08
@gsrikant7 gsrikant7 changed the title Add support for Azure Open AI Embeddings to Jupyter AI [FEATURE] Add support for Azure Open AI Embeddings to Jupyter AI Aug 7, 2024
@gsrikant7
Copy link
Contributor Author

Can someone please add the label to this PR? I am not seeing the option. Maybe because I do not have contributor/owner access.

@krassowski krassowski added the enhancement New feature or request label Aug 7, 2024
@gsrikant7 gsrikant7 changed the title [FEATURE] Add support for Azure Open AI Embeddings to Jupyter AI Add support for Azure Open AI Embeddings to Jupyter AI Aug 7, 2024
@gsrikant7
Copy link
Contributor Author

It would also be nice if someone can point to the necessary literature to add support for deployment names.

Copy link
Collaborator

@srdas srdas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gsrikant7 Thanks so much for opening this PR! I have reviewed the code changes and tested your branch and checked that the drop down menus now correctly show the required fields and options.
image
However, I do not have an API key for an Azure account, so cannot test if it works as intended with /learn and then with '/ask. Would you be able to add screenshots to demonstrate that the enhancement works as intended? (Show that the embedding model has learned a single doc and that /ask` delivers answers showing that the document information has been retrieved and presented in the response.)

@gsrikant7
Copy link
Contributor Author

Thanks for reviewing. I have tested this and have shared the screenshot @srdas

JupyterAIAzureEmbeddingsSupport

@srdas srdas merged commit 271877b into jupyterlab:main Aug 14, 2024
8 checks passed
@srdas srdas linked an issue Aug 14, 2024 that may be closed by this pull request
@bjornarfjelldal
Copy link

Hi!

I am getting this error when trying /learn on Azure:

Learn documents in /home/jovyan/docs failed. 1 validation error for AzureOpenAIEmbeddingsProvider root Must provide one of the base_url or azure_endpoint arguments, or the AZURE_OPENAI_ENDPOINT environment variable (type=value_error).

I have created a deployment of text-embedding-ada-002 named text-embedding-ada-002.

Normal interaction works, so API key and endpoint is correctly set.

@albertmichaelj
Copy link

@bjornarfjelldal I had the same issue. If you set the environmental variable AZURE_OPENAI_ENDPOINT to the endpoint, then it will work. This feature is not fully properly integrated, but the environmental variable workaround seems to be functional at this point.

@bjornarfjelldal
Copy link

bjornarfjelldal commented Aug 26, 2024

Hi, @albertmichaelj ! I forgot to mention that in the previous post, but I've tried to set

export AZURE_OPENAI_ENDPOINT=myendpointurl in the terminal. But I guess this might not catched by jupyter-ai allready running. Is the only solution then to add it to my dockerfile to be pre-loaded?

@albertmichaelj
Copy link

You will have to set the environmental variable when launching the Docker container. This can be done from the docker run command. The environmental variable won't take effect if you set it from the command line within the docker container (or if you set it in your environment before launching the docker container, since environmental variables are not inherited by docker containers).

Marchlak pushed a commit to Marchlak/jupyter-ai that referenced this pull request Oct 28, 2024
* Add support for Azure Open AI Embeddings to jupyter AI

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: Srikant Garnaik <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
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.

Use the /learn command under the Azure OpenAI configuration.
5 participants