seanpixel / Teenage-AGI

MIT License
896 stars 107 forks source link

problem calling embeddings API #7

Closed estiens closed 1 year ago

estiens commented 1 year ago
Traceback (most recent call last):
  File "/app/main.py", line 24, in <module>
    print("\n", agent.action(userInput))
                ^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/agent.py", line 142, in action
    internal_thought, top_matches = self.internalThought(query)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/agent.py", line 121, in internalThought
    query_embedding = get_ada_embedding(query)
                      ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/agent.py", line 61, in get_ada_embedding
    return openai.Embedding.create(input=[text], model="text-embedding-ada-002")[
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/api_resources/embedding.py", line 33, in create
    response = super().create(*args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
                           ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/api_requestor.py", line 226, in request
    resp, got_stream = self._interpret_response(result, stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/openai/api_requestor.py", line 619, in _interpret_response
    self._interpret_response_line(
  File "/usr/local/lib/python3.11/site-packages/openai/api_requestor.py", line 682, in _interpret_response_line
    raise self.handle_error_response(
openai.error.InvalidRequestError: [''] is not valid under any of the given schemas - 'input'

(after second instruction given) running in docker

seanpixel commented 1 year ago

Did you not give anything to the agent? Just press Enter with no input? I should catch that error.

seanpixel commented 1 year ago

This should have fixed it https://github.com/seanpixel/Teenage-AGI/commit/b3e514c3f0c691eb64d47503399315e43de8c5d6

estiens commented 1 year ago

I did actually type something - and it has happened a few times now but not with a pattern I see, it definitely happens if you ever just hit enter without typing something (just checked)