feat: introduce display image tool for enhanced image rendering in chat with metadata support

This commit is contained in:
Anish Sarkar 2025-12-23 01:11:56 +05:30
parent 4b69fdf214
commit da7cb81252
8 changed files with 709 additions and 1 deletions

View file

@ -14,6 +14,7 @@ from langgraph.types import Checkpointer
from sqlalchemy.ext.asyncio import AsyncSession
from app.agents.new_chat.context import SurfSenseContextSchema
from app.agents.new_chat.display_image import create_display_image_tool
from app.agents.new_chat.knowledge_base import create_search_knowledge_base_tool
from app.agents.new_chat.link_preview import create_link_preview_tool
from app.agents.new_chat.podcast import create_generate_podcast_tool
@ -36,6 +37,7 @@ def create_surfsense_deep_agent(
enable_citations: bool = True,
enable_podcast: bool = True,
enable_link_preview: bool = True,
enable_display_image: bool = True,
additional_tools: Sequence[BaseTool] | None = None,
):
"""
@ -57,6 +59,8 @@ def create_surfsense_deep_agent(
When True and user_id is provided, the agent can generate podcasts.
enable_link_preview: Whether to include the link preview tool (default: True).
When True, the agent can fetch and display rich link previews.
enable_display_image: Whether to include the display image tool (default: True).
When True, the agent can display images with metadata.
additional_tools: Optional sequence of additional tools to inject into the agent.
The search_knowledge_base tool will always be included.
@ -87,6 +91,11 @@ def create_surfsense_deep_agent(
link_preview_tool = create_link_preview_tool()
tools.append(link_preview_tool)
# Add display image tool if enabled
if enable_display_image:
display_image_tool = create_display_image_tool()
tools.append(display_image_tool)
if additional_tools:
tools.extend(additional_tools)