Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions llm/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,9 @@ def log_to_db(self, db):
"tool_call_id": tool_call.tool_call_id,
}
)
tools_by_name = {tool.name: tool for tool in self.prompt.tools}
for tool_result in self.prompt.tool_results:
matching_tool = tools_by_name.get(tool_result.name)
instance_id = None
if tool_result.instance:
try:
Expand All @@ -959,8 +961,15 @@ def log_to_db(self, db):
db["tool_instances"]
.insert(
{
"plugin": tool.plugin,
"name": tool.name.split("_")[0],
"plugin": getattr(
matching_tool, "plugin", None
)
or getattr(tool_result.instance, "plugin", None),
"name": (
matching_tool.name.split("_")[0]
if matching_tool
else tool_result.instance.__class__.__name__
),
"arguments": json.dumps(
tool_result.instance._config
),
Expand Down
4 changes: 2 additions & 2 deletions tests/test_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ def test_toolbox_logging_async(logs_db, tmpdir):
"name": "Memory_set",
"output": "null",
"instance": {
"name": "Filesystem",
"name": "Memory",
"plugin": "ToolboxPlugin",
"arguments": "{}",
},
Expand All @@ -949,7 +949,7 @@ def test_toolbox_logging_async(logs_db, tmpdir):
"name": "Memory_get",
"output": "two",
"instance": {
"name": "Filesystem",
"name": "Memory",
"plugin": "ToolboxPlugin",
"arguments": "{}",
},
Expand Down