datagero / pico-scholar

AI-Human collaboration platform that accelerates systematic reviews by organizing academic literature, building AI tools, and expanding into new domains to enhance the global knowledge catalog.
0 stars 0 forks source link

Implement Backend for Query Expansion and Advanced Querying #16

Open datagero opened 3 days ago

datagero commented 3 days ago

Context - Read the docs: Query Engine: https://docs.llamaindex.ai/en/stable/module_guides/deploying/query_engine/ Sub Question: https://docs.llamaindex.ai/en/stable/api_reference/query_engine/sub_question/ Query Transform Cookbook: https://docs.llamaindex.ai/en/stable/examples/query_transformations/query_transform_cookbook/

Objective: Provide backend functionality to generate and manage query expansions, transformations, and routing options to improve query relevance and search results. The backend will power the Advanced Querying UI by returning multiple related queries based on the user’s input.

Details:

API Endpoint for Query Expansion: • Create an endpoint that accepts the user’s initial query and a flag for Advanced Querying. • Use an LLM model (e.g., OpenAI API or fine-tuned model) to generate:

  1. Expanded Queries: Broaden the original query context.
  2. Transformed Queries: Modify the query for clarity and meaning.

Backend Logic: • Ensure queries are associated with the correct project and saved in the database if selected by the user.

Database Schema Update: • Ensure the backend stores both user-created queries and system-generated query expansions under the appropriate project.

Dependencies: • Integration with LLM or embedding model for query generation. • Backend endpoints for storing queries and projects.

Acceptance Criteria: • API endpoint receives user queries and returns expanded, transformed, and routed queries. • Relevant queries are saved and linked to the project in the database upon user selection.

Priority: Medium Estimated Effort: