uwoneko / infinite-craft-gpt-server

An alternative server for infinite craft that uses openai api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Choices error when combinding things

NoobExploits opened this issue · comments

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'

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