jupyter-ai icon indicating copy to clipboard operation
jupyter-ai copied to clipboard

api_version in GUI not considered, need to set OPENAI_API_VERSION

Open OliverKleinBST opened this issue 1 year ago • 2 comments
trafficstars

Description

I am using Azure as per below setting. The api_version I set in the GUI. When I do so the code complains that I need to set the api_version as parameter or via OPENAI_API_VERSION. even though I have set it in the GUI. The problem disappears when I set environment variable.

Reproduce

{ "model_provider_id": "azure-chat-openai:gpt-35-turbo-16k", "embeddings_provider_id": null, "send_with_shift_enter": false, "fields": { "azure-chat-openai:gpt-35-turbo-16k": { "api_version": "2023-07-01-preview", "azure_endpoint": "https://bst-openai-instance.openai.azure.com" } }, ...

jupyter_ai 2.16.0 langchain 0.1.20 langchain-community 0.0.38 langchain-core 0.1.52 langchain-openai 0.0.8 langchain-text-splitters 0.0.2 openai 1.30.3

OliverKleinBST avatar May 25 '24 10:05 OliverKleinBST

Thank you for opening your first issue in this project! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out Jupyter's Code of Conduct. Also, please try to follow the issue template as it helps other other community members to contribute more effectively. welcome You can meet the other Jovyans by joining our Discourse forum. There is also an intro thread there where you can stop by and say Hi! :wave:
Welcome to the Jupyter community! :tada:

welcome[bot] avatar May 25 '24 10:05 welcome[bot]

I am also running into this issue. Is there a known workaround?

albertmichaelj avatar Aug 06 '24 23:08 albertmichaelj

I think this issues is already resolved somehow. I can pass the api_version using UI.

$ python --version
Python 3.10.12

$ pip list | grep jupyter
jupyter                           1.1.1
jupyter_ai                        2.27.0
jupyter_ai_magics                 2.27.0
jupyter_client                    8.6.3
jupyter-console                   6.6.3
jupyter_core                      5.7.2
jupyter-events                    0.10.0
jupyter-lsp                       2.2.5
jupyter_server                    2.14.2
jupyter_server_terminals          0.5.3
jupyterlab                        4.2.5
jupyterlab_pygments               0.3.0
jupyterlab_server                 2.27.3
jupyterlab_widgets                3.0.13

$ cat /etc/os-release 
PRETTY_NAME="Ubuntu 22.04.4 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.4 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

But, I'm facing other issue, can't pass Base API URL from UI. So, I set AZURE_OPENAI_ENDPOINT insted for now.

I hope your issue is also resolved.

Thank you.

Yuto-24 avatar Nov 05 '24 12:11 Yuto-24

@OliverKleinBST @albertmichaelj @Yuto-24 Hey folks, sorry that this issue went undiscovered by our team for so long.

Good news though. Another contributor was able to provide steps to reproduce a similar bug in #1118. With that, I've been able to open a new PR to fix this: https://github.com/jupyterlab/jupyter-ai/pull/1125

We're aiming to cut a patch release by early next week, after folks return from Thanksgiving.

I sincerely appreciate your patience. Thank you for using Jupyter AI!

dlqqq avatar Nov 27 '24 18:11 dlqqq

Justification for closing this issue once #1125 is merged: the api_version parameter is still listed in AzureChatOpenAI, so the field key is correct. Therefore, this issue is almost certainly the same one documented in #1118, where model fields aren't updated until the server is restart, which is why you all were experiencing this issue.

dlqqq avatar Nov 27 '24 18:11 dlqqq

Confirm that problem is gone with #1125

OliverKleinBST avatar Dec 19 '24 10:12 OliverKleinBST