oobabooga / text-generation-webui

A Gradio web UI for Large Language Models.
GNU Affero General Public License v3.0
40.83k stars 5.34k forks source link

API returns 500 #5916

Closed Boof2015 closed 1 day ago

Boof2015 commented 7 months ago

Describe the bug

Using the FastAPI returns a 500 internal server error for v1/chat/completions. When it doesn't error, the (custom) front end reports an invalid response object, must be 'chat.completion'

Is there an existing issue for this?

Reproduction

Use the API for a front end, or go to localhost:5000/docs and run a v1/chat/completions "try it out"

Screenshot

No response

Logs

Exception in ASGI application
Traceback (most recent call last):
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/uvicorn/protocols/http/httptools_impl.py", line 419, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 84, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/applications.py", line 123, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/middleware/errors.py", line 186, in __call__
    raise exc
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/middleware/errors.py", line 164, in __call__
    await self.app(scope, receive, _send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/middleware/cors.py", line 91, in __call__
    await self.simple_response(scope, receive, send, request_headers=headers)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/middleware/cors.py", line 146, in simple_response
    await self.app(scope, receive, send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/routing.py", line 758, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/routing.py", line 778, in app
    await route.handle(scope, receive, send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/routing.py", line 299, in handle
    await self.app(scope, receive, send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/routing.py", line 79, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
    raise exc
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
    await app(scope, receive, sender)
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
    response = await func(request)
               ^^^^^^^^^^^^^^^^^^^
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/fastapi/routing.py", line 299, in app
    raise e
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/fastapi/routing.py", line 294, in app
    raw_response = await run_endpoint_function(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aim/Desktop/AI/text-generation-webui-main/installer_files/env/lib/python3.11/site-packages/fastapi/routing.py", line 191, in run_endpoint_function
    return await dependant.call(**values)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aim/Desktop/AI/text-generation-webui-main/extensions/openai/script.py", line 139, in openai_chat_completions
    response = OAIcompletions.chat_completions(to_dict(request_data), is_legacy=is_legacy)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aim/Desktop/AI/text-generation-webui-main/extensions/openai/completions.py", line 545, in chat_completions
    return deque(generator, maxlen=1).pop()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/aim/Desktop/AI/text-generation-webui-main/extensions/openai/completions.py", line 218, in chat_completions_common
    raise InvalidRequestError(message="functions is not supported.", param='functions')
extensions.openai.errors.InvalidRequestError

System Info

Pop-os 22.04 LTS. Nvidia RTX 3060 12GB
mercuryyy commented 6 months ago

I am having the same issue, anyone able to find out any info ?

Its not giving any error log for me just "Internal Server Error"

github-actions[bot] commented 1 day ago

This issue has been closed due to inactivity for 6 months. If you believe it is still relevant, please leave a comment below. You can tag a developer in your comment.