Skip to content

output ToolMessage content blocks from generate_streaming_response() #274

@yangm2

Description

@yangm2

The ToolMessage blocks are logged but not returned in the output stream ...

# Messages sent back by a tool
case ToolMessage():
for b in m.content_blocks:
match b["type"]:
case "text":
self.logger.info(b["text"])
case "invalid_tool_call":
self.logger.error(b)
case _:
self.logger.debug(f"ToolMessage: {m}")

We don't want to send these to the frontend but generate_streaming_response() is also used in the LangSmith evaluation runs it would be useful to get the tool call and the tool response in the experiment outputs to get a better picture to debug where a problem might be.

Either generate_streaming_response() needs to return more blocks or run_langsmith_evalutions.py needs to call a different (helper) function.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendBot implementation and other backend concernsenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions