Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rfc] core: make tool_call_id optional #28064

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

vbarda
Copy link
Contributor

@vbarda vbarda commented Nov 12, 2024

This would allow tools to return ToolMessage directly from the tools, and populate it with additional fields. For example, this would allow tools to return control flow information in langgraph.

Simple example:

from langchain_core.tools import tool
from langchain_core.messages import ToolMessage

@tool
def multiply(a: int, b: int):
    """Multiplies two numbers"""
    result = a * b
    return ToolMessage(content=str(result))

multiply.invoke({"args": {"a": 13, "b": 2}, "type": "tool_call", "id": "1"})

@tool
def transfer_to_agent_a():
    """Routes to agent A."""
    return ToolMessage(content="Transferred to agent A!", command=GraphCommand(goto="agent_a")))

transfer_to_agent_a.invoke({"args": {}, "type": "tool_call", "id": "1"})

Copy link

vercel bot commented Nov 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
langchain ⬜️ Ignored (Inspect) Nov 12, 2024 8:10pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Triage
Development

Successfully merging this pull request may close these issues.

1 participant