mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-05 04:17:32 +00:00
Add ToolPromptFormat to ChatFormat.encode_message so that tools are encoded properly
This commit is contained in:
parent
decbbc127b
commit
69d9655ecd
4 changed files with 21 additions and 5 deletions
|
@ -44,7 +44,12 @@ EventType = AgenticSystemTurnResponseEventType
|
|||
|
||||
|
||||
class EventLogger:
|
||||
async def log(self, event_generator, stream=True):
|
||||
async def log(
|
||||
self,
|
||||
event_generator,
|
||||
stream=True,
|
||||
tool_prompt_format: ToolPromptFormat = ToolPromptFormat.json,
|
||||
):
|
||||
previous_event_type = None
|
||||
previous_step_type = None
|
||||
|
||||
|
@ -132,7 +137,9 @@ class EventLogger:
|
|||
if event_type == EventType.step_complete.value:
|
||||
response = event.payload.step_details.model_response
|
||||
if response.tool_calls:
|
||||
content = ToolUtils.encode_tool_call(response.tool_calls[0])
|
||||
content = ToolUtils.encode_tool_call(
|
||||
response.tool_calls[0], tool_prompt_format
|
||||
)
|
||||
else:
|
||||
content = response.content
|
||||
yield event, LogEvent(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue