QuivrHQ / quivr

Open-source RAG Framework for building GenAI Second Brains 🧠 Build productivity assistant (RAG) ⚡️🤖 Chat with your docs (PDF, CSV, ...) & apps using Langchain, GPT 3.5 / 4 turbo, Private, Anthropic, VertexAI, Ollama, LLMs, Groq that you can share with users ! Efficient retrieval augmented generation framework
https://quivr.com
Other
34.12k stars 3.34k forks source link

[Bug]: UnpickleableExceptionWrapper('postgrest.exceptions', 'APIError', ('{\'code\': \'42P01\', \'details\': None, \'hint\': None, \'message\': \'relation "public.syncs_active" does not exist\'}',), 'Error 42P01:\nMessage: relation "public.syncs_active" does not exist') #2617

Open littlezbq opened 1 month ago

littlezbq commented 1 month ago

What happened?

i follow exactly as the documentation to deploy quivr and it succeed. I can create brain and upload files to it, but when I try to talk to my brain, he returned nothing but a blank to me, and the page didn't jump any error windows. hope someone can help me figure out what happened

Relevant log output

worker        | [2024-05-25 08:40:00,013: INFO/MainProcess] Task process_sync_active[09035e44-ef66-44a0-9038-c1498a54762e] received
worker        | [2024-05-25 08:40:00,015: INFO/MainProcess] Task celery_worker.process_integration_brain_sync[401a9420-33ba-4ffa-9d8a-fb32bd16a3d1] received
worker        | [2024-05-25 08:40:00,033: INFO/ForkPoolWorker-7] HTTP Request: GET http://host.docker.internal:54321/rest/v1/syncs_active?select=%2A&last_synced=lt.2024-05-25T02%3A40%3A00.016987 "HTTP/1.1 404 Not Found"
worker        | [2024-05-25 08:40:00,033: INFO/ForkPoolWorker-8] HTTP Request: GET http://host.docker.internal:54321/rest/v1/integrations_user?select=%2A%2C%20integrations%20%28%29&integrations.integration_name=eq.notion "HTTP/1.1 200 OK"
worker        | [2024-05-25 08:40:00,039: ERROR/ForkPoolWorker-7] Task process_sync_active[09035e44-ef66-44a0-9038-c1498a54762e] raised unexpected: UnpickleableExceptionWrapper('postgrest.exceptions', 'APIError', ('{\'code\': \'42P01\', \'details\': None, \'hint\': None, \'message\': \'relation "public.syncs_active" does not exist\'}',), 'Error 42P01:\nMessage: relation "public.syncs_active" does not exist')
worker        | Traceback (most recent call last):
worker        |   File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 453, in trace_task
worker        |     R = retval = fun(*args, **kwargs)
worker        |                  ^^^^^^^^^^^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 736, in __protected_call__
worker        |     return self.run(*args, **kwargs)
worker        |            ^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/code/modules/sync/tasks.py", line 17, in process_sync_active
worker        |     loop.run_until_complete(_process_sync_active())
worker        |   File "/usr/local/lib/python3.11/site-packages/nest_asyncio.py", line 98, in run_until_complete
worker        |     return f.result()
worker        |            ^^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/asyncio/futures.py", line 203, in result
worker        |     raise self._exception.with_traceback(self._exception_tb)
worker        |   File "/usr/local/lib/python3.11/asyncio/tasks.py", line 277, in __step
worker        |     result = coro.send(None)
worker        |              ^^^^^^^^^^^^^^^
worker        |   File "/code/modules/sync/tasks.py", line 39, in _process_sync_active
worker        |     active = await sync_active_service.get_syncs_active_in_interval()
worker        |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/code/modules/sync/service/sync_service.py", line 79, in get_syncs_active_in_interval
worker        |     return await self.repository.get_syncs_active_in_interval()
worker        |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
worker        |   File "/code/modules/sync/repository/sync.py", line 183, in get_syncs_active_in_interval
worker        |     .execute()
worker        |      ^^^^^^^^^
worker        |   File "/usr/local/lib/python3.11/site-packages/postgrest/_sync/request_builder.py", line 78, in execute
worker        |     raise APIError(r.json())
worker        | celery.utils.serialization.UnpickleableExceptionWrapper: Error 42P01:
worker        | Message: relation "public.syncs_active" does not exist
worker        | [2024-05-25 08:40:00,043: INFO/ForkPoolWorker-8] Task celery_worker.process_integration_brain_sync[401a9420-33ba-4ffa-9d8a-fb32bd16a3d1] succeeded in 0.02665457400144078s: None

Twitter / LinkedIn details

No response

dosubot[bot] commented 1 month ago

Hello, @littlezbq! I'm here to assist you with any bugs, questions, or contributions. Let's work together to resolve the issue you're facing.

The error "relation 'public.syncs_active' does not exist" indicates that the table public.syncs_active is not found in the database. This could be due to the table not being created successfully during the deployment.

Based on the provided SQL migration script, the table public.syncs_active should be created with the following command:

create table "public"."syncs_active" (
    "id" bigint generated by default as identity not null,
    "name" text not null,
    "syncs_user_id" bigint not null,
    "user_id" uuid not null default gen_random_uuid(),
    "settings" jsonb,
    "last_synced" timestamp with time zone not null default (now() AT TIME ZONE 'utc'::text),
    "sync_interval_minutes" integer default 360
);

To resolve this issue, ensure that the migration script has been executed successfully. You can verify the existence of the table by running the following query in your database:

SELECT * FROM information_schema.tables WHERE table_name = 'syncs_active';

If the table does not exist, re-run the migration script to create the table. If the table exists, ensure that the correct schema (public) is being referenced in your application [1].

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.

littlezbq commented 1 month ago

it works, no error like this anymore, but the brain still return blank to me, no error in logs checked on docker.

dosubot[bot] commented 1 month ago

To troubleshoot the issue where the brain returns a blank response despite no errors in the logs and the public.syncs_active table issue being resolved, you can follow these steps:

  1. Check Current Brain and Prompt: Ensure that currentBrain and currentPrompt are correctly set. If either is null or not properly set, the brain might not have the necessary context to generate a response.

  2. Verify Fetching Status: Confirm that isFetchingBrains is false to ensure that the brains have been fetched and are available.

  3. Inspect Brain Details: Check the currentBrainDetails fetched by useBrainFetcher to ensure that the brain's details are correctly retrieved.

  4. Review State Management: Ensure that the state management for currentBrainId, currentPromptId, allBrains, and publicPrompts is functioning correctly and that the IDs match the expected values.

  5. Check API Call Responses: Ensure that the API calls made by the brain are returning valid responses. The APIBrainQA class in backend/modules/brain/api_brain_qa.py handles API calls and responses. Verify that the get_api_call_response_as_text method is correctly processing the API responses and that no exceptions are being raised.

  6. Log Steps and Responses: Utilize the log_steps method in the APIBrainQA class to log each step of the process. This can help identify where the issue might be occurring. Additionally, ensure that the make_completion method is correctly handling the responses and not exceeding the recursive call limit.

Here is a code snippet to help you verify these aspects:

// Ensure currentBrain and currentPrompt are set
if (!currentBrain) {
  console.error("Current brain is not set.");
  return;
}

if (!currentPrompt) {
  console.error("Current prompt is not set.");
  return;
}

// Ensure brains are fetched
if (isFetchingBrains) {
  console.error("Brains are still being fetched.");
  return;
}

// Check current brain details
if (!currentBrainDetails) {
  console.error("Current brain details are not available.");
  return;
}

// Log the current state for debugging
console.log("Current Brain ID:", currentBrainId);
console.log("Current Prompt ID:", currentPromptId);
console.log("All Brains:", allBrains);
console.log("Public Prompts:", publicPrompts);
console.log("Current Brain Details:", currentBrainDetails);

By verifying these aspects and ensuring that the API calls and responses are correctly handled, you can identify any discrepancies or missing information that might be causing the blank response [1][2].

#### Details **About Dosu** This response is meant to be useful and save you time. It is **not meant to be a precise solution**, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

To continue the conversation, mention @dosu.