#1 PDF Application on GitHub that lets you edit PDFs on any device anywhere
TypeScript dockerhacktoberfestjavapdfpdf-converterpdf-editorpdf-manipulationpdf-mergerpdf-ocrpdf-toolspdf-web-appspdfmergerself-hosted
Teach the router with one example per capability (#7771)
Anthony Stirling77bbf4069c37
diff --git a/engine/src/stirling/agents/orchestrator.py b/engine/src/stirling/agents/orchestrator.pyindex 0ef4345e06..0508a84454 100644--- a/engine/src/stirling/agents/orchestrator.py+++ b/engine/src/stirling/agents/orchestrator.py@@ -7,6 +7,7 @@ from typing import Literal, assert_neverfrom pydantic import ConfigDict, Fieldfrom pydantic_ai import Agentfrom pydantic_ai.output import NativeOutput, ToolOutput+from pydantic_ai.settings import ModelSettingsfrom pydantic_ai.tools import RunContextfrom stirling.agents.output_mode import output_retries, uses_tool_output@@ -65,10 +66,23 @@ _ROUTER_SYSTEM_PROMPT = ("- pdf_create: generate a NEW document from scratch (invoice, report, letter) - no input file.\n""- unsupported: none of the above fit, or the user asks about the assistant itself; put a ""helpful message in 'message'.\n"- "Respond with the capability and (only for unsupported) a message."+ "Respond with the capability and (only for unsupported) a message.\n"+ "\n"+ "Decide by what the user wants BACK. Information read out of the document is pdf_question; "+ "a changed file handed back is pdf_edit. Mentioning a document is not asking to change it.\n"+ ' "Is there a table of contents?" -> pdf_question\n'+ ' "Add a table of contents" -> pdf_edit\n'+ ' "Put a note on every paragraph that needs work" -> pdf_review\n'+ ' "Build me a purchase order from scratch" -> pdf_create\n'+ ' "Make a rule that stamps every upload" -> user_spec\n'+ ' "Which version of the app is this?" -> unsupported')+def _router_model_settings(runtime: AppRuntime) -> ModelSettings:+ return {**runtime.fast_model_settings, "temperature": 0.0}++class OrchestratorAgent:def __init__(self, runtime: AppRuntime) -> None:self.runtime = runtime@@ -146,7 +160,7 @@ class OrchestratorAgent:output_type=NativeOutput([_RouteDecision]),retries=output_retries(runtime.settings.chat_provider),system_prompt=_ROUTER_SYSTEM_PROMPT,- model_settings=runtime.fast_model_settings,+ model_settings=_router_model_settings(runtime),)if self._route_via_enumelse None