feat(backend): tool support in send agent prompt, regularize inference messages (wip)
This commit is contained in:
1 parent
2ba8096a3c
commit
659b7497fb
6 files changed
+127
-57
No files matched your search
+2
-9
@@ -218,24 +218,17 @@ class ToolCall:
|
||||
is_error: Whether the result represents an error.
|
||||
"""
|
||||
|
||||
def __init__(self, tool_name, arguments={}, id=None):
|
||||
def __init__(self, tool_name, arguments={}, id=None, result=None):
|
||||
self.id = id or ""
|
||||
self.tool_name = tool_name
|
||||
self.arguments = arguments
|
||||
|
||||
self.result = None
|
||||
self.result = result
|
||||
|
||||
def __repr__(self):
|
||||
id_prefix = self.id + ', ' if self.id else ''
|
||||
return f"ToolCall({id_prefix}tool={self.tool_name!r}, args={self.arguments!r})"
|
||||
|
||||
def call_message(self):
|
||||
raise Exception("TODO: Llama message for tool call")
|
||||
|
||||
def result_message(self):
|
||||
from inference import LlamaMessage
|
||||
return LlamaMessage("tool", self.result)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helpers to format tool specs per engine
|
||||
|
||||
Reference in new issue
Block a user