Significant-Gravitas / AutoGPT

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
https://agpt.co
Other
168.08k stars 44.35k forks source link

Error communicating with OpenAI: Invalid URL 'your-base-url-for-azure/embeddings' #323

Closed gavinblair closed 1 year ago

gavinblair commented 1 year ago

Duplicates

Steps to reproduce 🕹

I get this error after describing the goals of my AI. It does not seem to matter what is entered.

Current behavior 😯

After entering my goals I get this error: Error communicating with OpenAI: Invalid URL 'your-base-url-for-azure/embeddings'

I have USE_AZURE=False in .env. I tried removing the AZURE api lines, with the same result.

Expected behavior 🤔

It should not cause the error.

Your prompt 📝

❯ python3 scripts/main.py --continuous --gpt3only --speak                                                       ─╯
Continuous Mode:  ENABLED
WARNING:  Continuous mode is not recommended. It is potentially dangerous and may cause your AI to run forever or carry out actions you would not usually authorise. Use at your own risk.
Speak Mode:  ENABLED
GPT3.5 Only Mode:  ENABLED
Welcome back!  Would you like me to return to being doctor-zimmerman?
Continue with the last settings?
Name:  doctor-zimmerman
Role:  an ai designed to look up what time it is.
Goals: ['get the current time', 'shut down']
Continue (y/n): y
Using memory of type: PineconeMemory
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_requestor.py", line 516, in request_raw
    result = _thread_context.session.request(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/sessions.py", line 573, in request
    prep = self.prepare_request(req)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/sessions.py", line 484, in prepare_request
    p.prepare(
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 368, in prepare
    self.prepare_url(url, params)
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/requests/models.py", line 439, in prepare_url
    raise MissingSchema(
requests.exceptions.MissingSchema: Invalid URL 'your-base-url-for-azure/embeddings': No scheme supplied. Perhaps you meant https://your-base-url-for-azure/embeddings?

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/Users/gavinblair/Projects/personal/autogpt/scripts/main.py", line 295, in <module>
    assistant_reply = chat.chat_with_ai(
                      ^^^^^^^^^^^^^^^^^^
  File "/Users/gavinblair/Projects/personal/autogpt/scripts/chat.py", line 69, in chat_with_ai
    relevant_memory = permanent_memory.get_relevant(str(full_message_history[-5:]), 10)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gavinblair/Projects/personal/autogpt/scripts/memory.py", line 55, in get_relevant
    query_embedding = get_ada_embedding(data)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gavinblair/Projects/personal/autogpt/scripts/memory.py", line 10, in get_ada_embedding
    return openai.Embedding.create(input=[text], model="text-embedding-ada-002")["data"][0]["embedding"]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_resources/embedding.py", line 33, in create
    response = super().create(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_requestor.py", line 216, in request
    result = self.request_raw(
             ^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/openai/api_requestor.py", line 528, in request_raw
    raise error.APIConnectionError(
openai.error.APIConnectionError: Error communicating with OpenAI: Invalid URL 'your-base-url-for-azure/embeddings': No scheme supplied. Perhaps you meant https://your-base-url-for-azure/embeddings?
SpectreAlister commented 1 year ago

Same problem

jdrusso commented 1 year ago

Unset the $OPENAI_API_BASE environment variable, fixed it for me.

gavinblair commented 1 year ago

that worked!