This is a POC for a Search engine / recommender system for any collection of documents. The project allows users to explore large item collections through a chat interface where an AI agent (or the user) manages search filters, orders results by relevance, and provides citations for its responses.
- Tool Calling: The agent uses tools like addSearchTerm and removeSearchTerm to refine the search configuration based on user intent.
- Dynamic Re-ranking: It automatically updates the item ordering to ensure the most relevant results are presented first.
- Citations: Uses a secondary LLM pass (with Zod-guaranteed schemas) to identify which items in the collection justify specific claims in the response. Provides a Citation model to track lineNumber to Item relationships.
- Start postgres with
docker-compose up -d - Run
npm installto install dependencies - Run
npm run db:initializeto initialize the database - Run
npm run devto start the server in development mode - To ingest example data (when the site says "Didnt find a suitable collection in the database. Would you like to ingest pre-defined data?"), click "Ingest" and wait until the page reloads with the example data. This may take a few minutes (<5) until the data is fully ingested.
AZURE_OPENAI_API_KEY=""
AZURE_OPENAI_ENDPOINT=""
AZURE_OPENAI_VERSION=
AZURE_OPENAI_LLM_DEPLOYMENT_NAME_gpt_4o=
USE_AZURE="false"
OPENAI_API_KEY=
OPENAI_MODEL_NAME=
OPENAI_EMBEDDING_MODEL_NAME="text-embedding-ada-002"
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_PORT=5432
DATABASE_URL="postgres://postgres:password@localhost:5432/recommender"
SERPAPI_KEY= # Only needed for data generation that is not based on pre-defined example data - not needed if you follow the steps above to ingest the example data.


