|
1 | 1 | """ |
2 | 2 | SurfSense New Chat Agent Module. |
3 | 3 |
|
4 | | -This module provides the SurfSense deep agent with configurable tools |
5 | | -for knowledge base search, podcast generation, and more. |
| 4 | +This module provides the SurfSense deep agent with configurable tools, |
| 5 | +middleware, and preloaded knowledge-base filesystem behavior. |
6 | 6 |
|
7 | 7 | Directory Structure: |
8 | | -- tools/: All agent tools (knowledge_base, podcast, generate_image, etc.) |
| 8 | +- tools/: All agent tools (podcast, generate_image, web, memory, etc.) |
| 9 | +- middleware/: Custom middleware (knowledge search, filesystem, dedup, etc.) |
9 | 10 | - chat_deepagent.py: Main agent factory |
10 | 11 | - system_prompt.py: System prompts and instructions |
11 | 12 | - context.py: Context schema for the agent |
|
23 | 24 | # LLM config |
24 | 25 | from .llm_config import create_chat_litellm_from_config, load_llm_config_from_yaml |
25 | 26 |
|
| 27 | +# Middleware |
| 28 | +from .middleware import ( |
| 29 | + DedupHITLToolCallsMiddleware, |
| 30 | + KnowledgeBaseSearchMiddleware, |
| 31 | + SurfSenseFilesystemMiddleware, |
| 32 | +) |
| 33 | + |
26 | 34 | # System prompt |
27 | 35 | from .system_prompt import ( |
28 | 36 | SURFSENSE_CITATION_INSTRUCTIONS, |
|
39 | 47 | build_tools, |
40 | 48 | create_generate_podcast_tool, |
41 | 49 | create_scrape_webpage_tool, |
42 | | - create_search_knowledge_base_tool, |
43 | 50 | format_documents_for_context, |
44 | 51 | get_all_tool_names, |
45 | 52 | get_default_enabled_tools, |
|
53 | 60 | # System prompt |
54 | 61 | "SURFSENSE_CITATION_INSTRUCTIONS", |
55 | 62 | "SURFSENSE_SYSTEM_PROMPT", |
| 63 | + # Middleware |
| 64 | + "DedupHITLToolCallsMiddleware", |
| 65 | + "KnowledgeBaseSearchMiddleware", |
56 | 66 | # Context |
57 | 67 | "SurfSenseContextSchema", |
| 68 | + "SurfSenseFilesystemMiddleware", |
58 | 69 | "ToolDefinition", |
59 | 70 | "build_surfsense_system_prompt", |
60 | 71 | "build_tools", |
|
63 | 74 | # Tool factories |
64 | 75 | "create_generate_podcast_tool", |
65 | 76 | "create_scrape_webpage_tool", |
66 | | - "create_search_knowledge_base_tool", |
67 | 77 | # Agent factory |
68 | 78 | "create_surfsense_deep_agent", |
69 | 79 | # Knowledge base utilities |
|
0 commit comments