vladiliescu / azure-chatbot-ui

An open source ChatGPT UI modified to use Azure OpenAI models.
https://chatbotui.com
MIT License
24 stars 12 forks source link

OpenAI key necessary to get started #1

Open leodambrosi opened 1 year ago

leodambrosi commented 1 year ago

Reproduce

I followed the local installation procedure and unfortunately doesn't work:

OPENAI_AZURE_API_KEY=<Key>
OPENAI_AZURE_API_HOST="https://XXXXXX.openai.azure.com/"
OPENAI_AZURE_API_VERSION="2023-03-15-preview"

Screenshot of the output:

image

FYI @vladiliescu

vladiliescu commented 1 year ago

@leodambrosi you're missing the model deployment.

leodambrosi commented 1 year ago

@vladiliescu you are right. It was missing. However I retried with the following .env.local

OPENAI_AZURE_API_KEY=<key>
OPENAI_AZURE_API_HOST="https://<endpoint>.openai.azure.com/openai/deployments/<Model deployment name>"
OPENAI_AZURE_API_VERSION="2023-03-15-preview"

And got the same error:

image

My enviroment:

vladiliescu commented 1 year ago

Does calling the REST api from curl work for you? See here for instructions.

kotobuki09 commented 1 year ago

I got the same issue! Even after adding .env.local file as you instructed but the chat section still cannot start. The REST API work for me for sure

#Note: The openai-python library support for Azure OpenAI is in preview.
import os
import openai
openai.api_type = "azure"
openai.api_base = "https://XXXX.openai.azure.com/"
openai.api_version = "2023-03-15-preview"
openai.api_key = "XXXXXXXX"

response = openai.ChatCompletion.create(
  engine="gpt4_32k",
  messages = [
    {"role":"system","content":"You are an AI assistant."},
    {"role":"user","content":"tell me about yourself?"}
  ],
  temperature=0.5,
  #max_tokens=800,
  top_p=0.95,
  frequency_penalty=0,
  presence_penalty=0,
  stop=None)

print(response.choices[0])

but I don't setup GOOGLE_API_KEY and GOOGLE_CSE_ID. Can we remove it or we must have to set it up?

vladiliescu commented 1 year ago

To be honest I'm not sure what's going on with your setup. I've cloned the repo in a new location, configured it to use a GPT-32k deployment (env.local below), npm i, npm run dev and it works. Are you getting any errors in the console?

# Chatbot UI
DEFAULT_SYSTEM_PROMPT=You are ChatGPT, a large language model trained by OpenAI. Follow the user's instructions carefully. Respond using markdown.
OPENAI_AZURE_API_KEY=someazureaiapikey
OPENAI_AZURE_API_HOST="https://someresourcename.openai.azure.com/openai/deployments/somemodelname"
OPENAI_AZURE_API_VERSION="2023-03-15-preview"

# Google
GOOGLE_API_KEY=YOUR_API_KEY
GOOGLE_CSE_ID=YOUR_ENGINE_ID

I've also ignored GOOGLE_* settings, they don't seem to affect the bot working/not working.

kotobuki09 commented 1 year ago

I don't know what the actual problem is but the interface still remains the same as the main repo which requires OpenAI API to access it not like the picture you post on your fork. There is no error on the console at all.

PS E:\azure-chatbot-ui> npm run dev

> ai-chatbot-starter@0.1.0 dev
> next dev

ready - started server on 0.0.0.0:3000, url: http://localhost:3000
info  - Loaded env from E:\azure-chatbot-ui\.env.local
event - compiled client and server successfully in 2.1s (233 modules)
wait  - compiling...
event - compiled successfully in 269 ms (194 modules)
wait  - compiling / (client and server)...
event - compiled client and server successfully in 2.2s (5469 modules)
vladiliescu commented 1 year ago

I haven't posted any picture on my fork, the pic comes from the original repo. So, what happens when you click the new chat button? Why do you say it doesn't work?

kotobuki09 commented 1 year ago

https://i.imgur.com/oZD4hzp.gif You're right! I thought you make a chance so they remove the OpenAI key function on it! You can see in the link that I couldn't start the section at all.

vladiliescu commented 1 year ago

Unfortunately I don't have a way to reproduce this - if you want to investigate this further, you can take a look at the code in index.ts -- that's what I've updated to use Azure OpenAI -- and try debugging it to see what's going on.

leodambrosi commented 1 year ago

Does calling the REST api from curl work for you? See here for instructions.

Yes, it does work