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

500 Internal Server Error, 502 error #597

Closed
pandaupc opened this issue Jul 11, 2023 · 2 comments
Closed

500 Internal Server Error, 502 error #597

pandaupc opened this issue Jul 11, 2023 · 2 comments
Labels

Comments

@pandaupc
Copy link

Certainly, here is the complete transcription of the error:

I'm currently able to import files and provide regular answers. However, an error occurs when providing document-based answers. Upon investigation, the error seems to occur when fetching the context for computing similarity, specifically when calling the similarity interface of Supabase. The error message is as follows:

arduino
Copy code
INFO: 127.0.0.1:59312 - "POST /chat/ef77183d-85bb-4389-afe9-6d13dcc0237b/question?brain_id=242a3a9c-f0a5-4993-b9f1-44efdf22c2b4 HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
...
File "/Users/huida/Applications/anaconda3/lib/python3.10/site-packages/fastapi/routing.py", line 163, in run_endpoint_function
return await dependant.call(**values)
File "/Users/huida/code/quivr/backend/routes/chat_routes.py", line 197, in create_question_handler
chat_answer = gpt_answer_generator.generate_answer(chat_question.question)
File "/Users/huida/code/quivr/backend/llm/openai_functions.py", line 204, in generate_answer
messages=self._construct_prompt(
File "/Users/huida/code/quivr/backend/llm/openai_functions.py", line 158, in _construct_prompt
chat_context = self._get_context(question)
File "/Users/huida/code/quivr/backend/llm/openai_functions.py", line 128, in _get_context
return self.vector_store.similarity_search(query=question)
File "/Users/huida/code/quivr/backend/vectorstore/supabase.py", line 42, in similarity_search
).execute()
File "/Users/huida/Applications/anaconda3/lib/python3.10/site-packages/postgrest/_sync/request_builder.py", line 55, in execute
r = self.session.request(
File "/Users/huida/Applications/anaconda3/lib/python3.10/site-packages/httpx/_client.py", line 821, in request
return self.send(request, auth=auth, follow_redirects=follow_redirects)
...
httpx.ReadTimeout: The read operation timed out
In the Supabase interface manager, a 502 error is displayed, but other interface calls are functioning normally.

@bolshoytoster
Copy link

@pandaupc There is a related issue of the supabase-py repo. Their solution was to increase the server's timeout from the default of 5 seconds. I suggest doing this as a temporary solution, but someone should probably look into why it's taking so long.


To increase the timeout, you'll have to make the same change in 3 files:
In backend/models/settings.py, add the line from supabase.lib.client_options import ClientOptions anywhere at the top of the file, then on line 30:
https://github.com/StanGirard/quivr/blob/72924b52bca989f68cf8bdb1be95451dc0fae602/backend/models/settings.py#L29-L31

Add , options=ClientOptions(timeout=60), where 60 is the timeout in seconds.

In backend/llm/openai.py, add the same line to the top of the file, then add the same bit to the end of line 70:
https://github.com/StanGirard/quivr/blob/72924b52bca989f68cf8bdb1be95451dc0fae602/backend/llm/openai.py#L69-L71

In backend/llm/openai_functions.py, add the same line to the top of the file, then add the same bit to the end of line 81:
https://github.com/StanGirard/quivr/blob/72924b52bca989f68cf8bdb1be95451dc0fae602/backend/llm/openai_functions.py#L80-L82

@github-actions
Copy link
Contributor

Thanks for your contributions, we'll be closing this issue as it has gone stale. Feel free to reopen if you'd like to continue the discussion.

@github-actions github-actions bot added the Stale label Aug 29, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants