Skip to content

Commit

Permalink
Merge pull request #744 from madeindjs/fix-kg-description
Browse files Browse the repository at this point in the history
feat(writer): include description in `GraphTool`
  • Loading branch information
ramedina86 authored Feb 20, 2025
2 parents f72eccd + 1dfd8b5 commit 29ad187
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/writer/ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class Tool(TypedDict, total=False):
class GraphTool(Tool):
graph_ids: List[str]
subqueries: bool
description: Optional[str]


class FunctionToolParameterMeta(TypedDict):
Expand Down Expand Up @@ -1419,7 +1420,8 @@ def validate_graph_ids(graph_ids: List[str]) -> bool:
"graph_ids": tool_instance["graph_ids"],
"subqueries": tool_instance.get(
"subqueries", False
)
),
"description": tool_instance.get("description", None)
}
}
)
Expand Down
10 changes: 6 additions & 4 deletions src/writer/blocks/writerchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,12 @@ def run(self):
parameters=tool_raw.get("parameters")
)
elif tool_type == "graph":
tool = {
"type": "graph",
"graph_ids": tool_raw.get("graph_ids")
}
tool = writer.ai.GraphTool(
type="graph",
graph_ids=tool_raw.get("graph_ids"),
subqueries=False,
description=tool_name,
)
else:
continue
tools.append(tool)
Expand Down

0 comments on commit 29ad187

Please sign in to comment.