Farfalle is an open-source, AI-driven search engine. It’s a Perplexity clone project that allows users to run local large language models (LLMs) or use cloud models for search and question answering.
The project aims to provide a self-hosted search solution that can utilize local models like llama3, mistral, gemma, and phi3, as well as cloud models such as Groq/Llama3 or OpenAI/gpt4-o.
Project Features
Use Cases
Farfalle is suitable for scenarios requiring a customized search engine, especially for users looking to enhance their search experience with AI technology. Whether you’re an individual developer, a business, or an educational institution, Farfalle can be used to build a search engine tailored to specific needs.
Tech Stack
- Frontend: Next.js
- Backend: FastAPI
- Search API: SearXNG or Tavily
- Logging: Logfire
- Rate Limiting: Redis
- Component Library: shadcn/ui
Key Features
- Support for multiple search providers (Tavily, Searxng)
- Question answering using cloud models (OpenAI/gpt4-o, OpenAI/gpt3.5-turbo, Groq/Llama3)
- Question answering using local models (llama3, mistral, gemma, phi3)
Usage Guide
Prerequisites
- Install Docker
- If running local models, install Ollama and download supported models
- Obtain API keys:
- Tavily (optional)
- OpenAI (optional)
- Groq (optional)
Installation Steps
- Clone the repository:
git clone git@github.com:rashadphz/farfalle.git
cd farfalle
- Add environment variables:
Create a.env
file and add the following variables: For Tavily (requires API key):
TAVILY_API_KEY=...
SEARCH_PROVIDER=tavily
For Searxng (no API key required):
SEARCH_PROVIDER=searxng
Optional cloud model API keys:
OPENAI_API_KEY=...
GROQ_API_KEY=...
- Run containers:
Use Docker Compose to start the services:
docker-compose -f docker-compose.dev.yaml up -d
Then visit http://localhost:3000 in your browser to view the application.
Deployment
Backend Deployment
Deploy the backend using Render.
Frontend Deployment
Deploy the frontend using Vercel, using the copied backend URL as the NEXT_PUBLIC_API_URL
environment variable.
Note: This article content is for reference only. Please refer to the official GitHub page for the latest project features and instructions.
Thank you for reading! Don’t forget to follow, like, and share if you found this helpful.