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

Choices error when combinding things #2

Open
ghost opened this issue Feb 24, 2024 · 1 comment
Open

Choices error when combinding things #2

ghost opened this issue Feb 24, 2024 · 1 comment

Comments

@ghost
Copy link

ghost commented Feb 24, 2024

Logs:

Traceback (most recent call last):
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\uvicorn\protocols\http\h11_impl.py", line 412, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\uvicorn\middleware\proxy_headers.py", line 84, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\applications.py", line 1054, in call
await super().call(scope, receive, send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\applications.py", line 123, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 186, in call
raise exc
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\errors.py", line 164, in call
await self.app(scope, receive, _send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\cors.py", line 91, in call
await self.simple_response(scope, receive, send, request_headers=headers)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\cors.py", line 146, in simple_response
await self.app(scope, receive, send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\middleware\exceptions.py", line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
raise exc
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 758, in call
await self.middleware_stack(scope, receive, send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 778, in app
await route.handle(scope, receive, send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 299, in handle
await self.app(scope, receive, send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 79, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 64, in wrapped_app
raise exc
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\starlette\routing.py", line 74, in app
response = await func(request)
^^^^^^^^^^^^^^^^^^^
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 278, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Bob\AppData\Local\Programs\Python\Python312\Lib\site-packages\fastapi\routing.py", line 191, in run_endpoint_function
return await dependant.call(**values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Bob\Downloads\Test\server.py", line 54, in pair
completion = await chat_completion(messages)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Bob\Downloads\Test\utils.py", line 34, in chat_completion
return response_json["choices"][0]["message"]["content"]
~~~~~~~~~~~~~^^^^^^^^^^^
KeyError: 'choices'

@uwoneko
Copy link
Owner

uwoneko commented Mar 2, 2024

are you sure that your api key is set up properly
try to add print(response_json) before theline where error happens and see what it prints

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

1 participant