Abonia1 / Context-Based-LLMChatbot

Use vector search or embedding technique to feed addtional knowledge base to LLM like GPT-3, BLOOMZ
MIT License
100 stars 37 forks source link

openai api key #4

Closed text2sql closed 1 year ago

text2sql commented 1 year ago

keep getting this error File "/Users/..../python3.10/site-packages/openai/api_requestor.py", line 682, in _interpret_response_line raise self.handle_error_response( openai.error.AuthenticationError: Incorrect API key provided: YOUR-OPE***-KEY. You can find your API key at https://platform.openai.com/account/api-keys. " i tested my api key with other chatbots and it 's working fine even though i added a new api key both in .env and also did the export in the terminal as export openai_api_key="key" are you experiencing the same problem? which model do you use gpt4 or gpt3.5? do you have a twitter account ? thank you!

Abonia1 commented 1 year ago

Hello, I have never got this error.It seems you should recheck your API key. Just add the api key in config file here

For example , access it like as follow:

from langchain.embeddings.openai import OpenAIEmbeddings
import config 
embeddings = OpenAIEmbeddings(openai_api_key=config.OPENAI_API_KEY)

Here I have tested with GPT-3 and you can find more info in chat.py:

  doc_chain = load_qa_chain(
        llm=OpenAI(
            openai_api_key = config.OPENAI_API_KEY,
            model_name="text-davinci-003",
            temperature=0,
            max_tokens=300,
        ),
        chain_type="stuff",
        prompt=prompt_template,
    )

Hope it helps!

Abonia1 commented 1 year ago

Closed the issue as consider the above solution solved the issue.