File size: 2,368 Bytes
0ccfe4a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0569d05
 
 
 
 
 
 
 
 
2e5367f
 
 
 
 
 
 
 
 
 
0ccfe4a
0569d05
0ccfe4a
2e5367f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from __future__ import annotations

import json
from pathlib import Path

import anthropic

_DATA = Path(__file__).parent / "data" / "tools"


def _load(name: str) -> dict:
    return json.loads((_DATA / f"{name}.json").read_text())


EXTRACT_ENTITIES_TOOL: anthropic.types.ToolParam = {
    "name": "extract_entities",
    "description": (
        "Extract biomedical entities and relationships from an ALS paper abstract. "
        "For each entity, identify its type (Gene, Protein, Compound, Pathway, Phenotype, or Mechanism), "
        "the exact name as it appears in the text, and the confidence of the identification. "
        "For relationships, identify the source entity, target entity, and the type of relationship."
    ),
    "input_schema": _load("extract_entities"),
}

SEARCH_LANDSCAPE_TOOL: anthropic.types.ToolParam = {
    "name": "search_research_landscape",
    "description": (
        "Search the ALS research knowledge base by combining knowledge graph traversal and "
        "vector similarity search. Provide the entities you identified in the physician's query "
        "and the original query text. Returns ranked papers, related biological entities, "
        "and linked clinical trials."
    ),
    "input_schema": _load("search_landscape"),
}

EXTRACT_TRIAL_TARGETS_TOOL: anthropic.types.ToolParam = {
    "name": "extract_trial_targets",
    "description": (
        "Extract the primary biological target(s) of an ALS clinical trial — the gene, protein, "
        "compound, or mechanism being tested or modulated. Call once per trial."
    ),
    "input_schema": _load("extract_trial_targets"),
}

CLASSIFY_THERAPY_TOOL: anthropic.types.ToolParam = {
    "name": "classify_therapy",
    "description": (
        "Classify one experimental ALS therapy: its canonical name, modality, molecular target, "
        "mechanism of action, and best-fit mechanism class from the ALS taxonomy. "
        "Call once per therapy, echoing back the therapy_key verbatim."
    ),
    "input_schema": _load("classify_therapy"),
}

EXTRACTION_TOOLS: list[anthropic.types.ToolParam] = [EXTRACT_ENTITIES_TOOL]
TRIAL_EXTRACTION_TOOLS: list[anthropic.types.ToolParam] = [EXTRACT_TRIAL_TARGETS_TOOL]
RESEARCH_TOOLS: list[anthropic.types.ToolParam] = [SEARCH_LANDSCAPE_TOOL]
LANDSCAPE_TOOLS: list[anthropic.types.ToolParam] = [CLASSIFY_THERAPY_TOOL]