Skip to content

Search tools

The two search tools that give the model literature and image context: PubMed abstract search and Open-i medical image search. For how they fit alongside the visual tools, see Tools.

search

Search tools for evidence-based radiology analysis.

Provides web search and image search tools for retrieving medical literature and reference images during VLM analysis.

create_search_tools

create_search_tools(
    disabled_tools: set[str] | None = None,
) -> list[Tool]

Create the standard set of search tools for evidence-based analysis.

These tools provide access to medical literature and reference images for supporting evidence-based analysis during multi-turn reasoning.

Parameters:

Name Type Description Default
disabled_tools set[str] | None

Set of tool names to exclude from the returned list

None

Returns:

Type Description
list[Tool]

List of Tool objects ready for registration with ToolRegistry

Example

Create all search tools

tools = create_search_tools()

tools = create_search_tools(disabled_tools={"search_images"})

Source code in src/gaze/tools/search.py
@beartype
def create_search_tools(disabled_tools: set[str] | None = None) -> list[Tool]:
    """Create the standard set of search tools for evidence-based analysis.

    These tools provide access to medical literature and reference images
    for supporting evidence-based analysis during multi-turn reasoning.

    Args:
        disabled_tools: Set of tool names to exclude from the returned list

    Returns:
        List of Tool objects ready for registration with ToolRegistry

    Example:
        # Create all search tools
        tools = create_search_tools()

        # Create tools excluding image search
        tools = create_search_tools(disabled_tools={"search_images"})
    """
    disabled = disabled_tools or set()
    tools: list[Tool] = []

    if "search_web" not in disabled:
        tools.append(
            Tool(
                name="search_web",
                description=(
                    "Search PubMed for medical literature, guidelines, "
                    "research papers, and reference cases."
                ),
                parameters={
                    "query": {
                        "type": "string",
                        "description": (
                            "Medical search query. Include condition, imaging "
                            "modality, and key findings."
                        ),
                    },
                    "search_type": {
                        "type": "string",
                        "description": "Type of search.",
                        "enum": [
                            "diagnosis",
                            "research",
                            "guidelines",
                            "anatomy",
                            "treatment",
                            "differential",
                            "general",
                        ],
                        "default": "general",
                    },
                },
                execute=_execute_search_web,
                requires_image=False,
                prompt_documentation=_SEARCH_WEB_PROMPT_DOC,
                category="search",
            )
        )

    if "search_images" not in disabled:
        tools.append(
            Tool(
                name="search_images",
                description=(
                    "Search NIH Open-i for reference medical images. "
                    "Returns image URLs with captions and metadata."
                ),
                parameters={
                    "query": {
                        "type": "string",
                        "description": "Medical image search query.",
                    },
                    "modality": {
                        "type": "string",
                        "description": "Filter by imaging modality.",
                        "enum": ["MRI", "CT", "X-ray", "Ultrasound", "PET", "Mammography", "any"],
                        "default": "any",
                    },
                    "body_part": {
                        "type": "string",
                        "description": "Filter by body part.",
                        "enum": [
                            "brain",
                            "head",
                            "chest",
                            "abdomen",
                            "spine",
                            "pelvis",
                            "cardiac",
                            "any",
                        ],
                        "default": "any",
                    },
                },
                execute=_execute_search_images,
                requires_image=False,
                prompt_documentation=_SEARCH_IMAGES_PROMPT_DOC,
                category="search",
            )
        )

    return tools