re-work tool definitions, fix FastAPI issues, fix tool regressions

This commit is contained in:
Ashwin Bharambe 2024-08-24 22:07:06 -07:00
parent 8d14d4228b
commit 8efe614719
11 changed files with 144 additions and 104 deletions

View file

@ -22,6 +22,7 @@ from .ipython_tool.code_execution import (
)
from llama_toolchain.inference.api import * # noqa: F403
from llama_toolchain.agentic_system.api import * # noqa: F403
from .base import BaseTool
@ -55,9 +56,6 @@ class SingleMessageBuiltinTool(BaseTool):
tool_name=tool_call.tool_name,
content=response,
)
if attachment := interpret_content_as_attachment(response):
message.content = attachment
return [message]
@abstractmethod
@ -316,7 +314,4 @@ class CodeInterpreterTool(BaseTool):
tool_name=tool_call.tool_name,
content="\n".join(pieces),
)
if attachment := interpret_content_as_attachment(res["stdout"]):
message.content = attachment
return [message]

View file

@ -12,9 +12,6 @@ from typing import Dict, List
from llama_models.llama3.api.datatypes import * # noqa: F403
from llama_toolchain.agentic_system.api import * # noqa: F403
# TODO: this is symptomatic of us needing to pull more tooling related utilities
from llama_toolchain.tools.builtin import interpret_content_as_attachment
class CustomTool:
"""
@ -94,9 +91,6 @@ class SingleMessageCustomTool(CustomTool):
tool_name=tool_call.tool_name,
content=response_str,
)
if attachment := interpret_content_as_attachment(response_str):
message.content = attachment
return [message]
@abstractmethod