feat(agent): Pretty decent first pass at agent mode

This commit is contained in:
Willie Zutz 2025-06-09 23:00:25 -06:00
parent 3f1f437d4f
commit b4e2585856
18 changed files with 2380 additions and 5193 deletions

View file

@ -61,7 +61,7 @@ The API accepts a JSON object in the request body, where you define the focus mo
- `speed`: Prioritize speed and get the quickest possible answer. Minimum effort retrieving web content. - Only uses SearXNG result previews.
- `balanced`: Find the right balance between speed and accuracy. Medium effort retrieving web content. - Uses web scraping technologies to retrieve partial content from full web pages.
- `quality`: Get the most thorough and accurate answer. High effort retrieving web content. Requires a good AI model. May take a long time. - Uses web scraping technologies to retrieve and summarize full web content.
- `agent`: Use an agentic workflow to answer complex multi-part questions. This mode requires a model that is trained for tool use.
- **`query`** (string, required): The search query or question.

View file

@ -8,15 +8,13 @@ Perplexica's architecture consists of the following key components:
4. **LLMs (Large Language Models)**: Utilized by agents and chains for tasks like understanding content, writing responses, and citing sources. Examples include Claude, GPTs, etc.
5. **Embedding Models**: To improve the accuracy of search results, embedding models re-rank the results using similarity search algorithms such as cosine similarity and dot product distance.
6. **Web Content**
- In Quality mode the application uses Crawlee, Playwright, and Chromium to load web content into a real full browser
- This significantly increases the size of the docker image and also means it can only run on x64 architectures
- The docker build has been updated to restrict images to linux/amd64 architecture
- In Balanced mode, the application uses JSDoc and Mozilla's Readability to retrieve and rank relevant segments of web content
- This approach is less successful than Quality as it doesn't use a full web browser and can't load dynamic content
- It is also more prone to being blocked by ads or scraping detection
- Because it only uses segments of web content, it can be less accurate than Quality mode
- In Agent mode, the application uses an agentic workflow to answer complex multi-part questions
- The agent can use reasoning steps to provide comprehensive answers to complex questions
- Agent mode is experimental and may consume lots of tokens and take a long time to produce responses
- In Balanced mode, the application retrieves web content using Playwright and Mozilla Readability to extract relevant segments of web content
- Because it only uses segments of web content, it can be less accurate than Agent mode
- In Speed mode, the application only uses the preview content returned by SearXNG
- This content is provided by the search engines and contains minimal context from the actual web page
- This mode is the least accurate and is often prone to hallucination
- This content is provided by the search engines and contains minimal context from the actual web page
- This mode is the least accurate and is often prone to hallucination
For a more detailed explanation of how these components work together, see [WORKING.md](https://github.com/ItzCrazyKns/Perplexica/tree/master/docs/architecture/WORKING.md).