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

Using openui with AzureOpenai #128

Open
NikitaRawat2003 opened this issue May 16, 2024 · 5 comments
Open

Using openui with AzureOpenai #128

NikitaRawat2003 opened this issue May 16, 2024 · 5 comments

Comments

@NikitaRawat2003
Copy link

I have Azureopenai Credentials and i was wondering if the openui can be used with Azureopenai

@vanpelt
Copy link
Contributor

vanpelt commented May 16, 2024

I'm using the native OpenAI client which I imagine supports it. You can just change the code here.

@NikitaRawat2003
Copy link
Author

i tried changing the code as you mentioned ,but still facing a lot of errors

@bxav
Copy link

bxav commented May 28, 2024

Thanks @vanpelt works perfectly for me with gpt-4o.
@NikitaRawat2003 the fastest way to try it, is to create on your azure instance a deployment that as the same name as the model name in openai ("gpt-3.5-turbo", "gpt-4o", "gpt-4-turbo") and then import AsyncAzureOpenAI from openai
and replace:

# openai = AsyncOpenAI(
#     base_url=config.OPENAI_BASE_URL,
#     api_key=config.OPENAI_API_KEY)

openai = AsyncAzureOpenAI(
    api_key=config.OPENAI_API_KEY,  
    api_version="2024-02-01",
    azure_endpoint=config.OPENAI_BASE_URL)

@gyxter
Copy link

gyxter commented May 28, 2024

Thanks @vanpelt works perfectly for me with gpt-4o. @NikitaRawat2003 the fastest way to try it, is to create on your azure instance a deployment that as the same name as the model name in openai ("gpt-3.5-turbo", "gpt-4o", "gpt-4-turbo") and then import AsyncAzureOpenAI from openai and replace:

# openai = AsyncOpenAI(
#     base_url=config.OPENAI_BASE_URL,
#     api_key=config.OPENAI_API_KEY)

openai = AsyncAzureOpenAI(
    api_key=config.OPENAI_API_KEY,  
    api_version="2024-02-01",
    azure_endpoint=config.OPENAI_BASE_URL)

did you add your endpoint and key in the config.py file? can you show me how you did it?

@bxav
Copy link

bxav commented May 28, 2024

did you add your endpoint and key in the config.py file? can you show me how you did it?

@gyxter No need to change anything in the config.py, I reuse the variables. You can do as in the doc, you can export your variable in the terminal:

export OPENAI_API_KEY=*****
export OPENAI_BASE_URL=https://{your-instance}.openai.azure.com/
cd backend
python -m openui

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants