-
Couldn't load subscription status.
- Fork 19.5k
Open
Labels
feature requestrequest for an enhancement / additional functionalityrequest for an enhancement / additional functionality
Description
Checked other resources
- This is a feature request, not a bug report or usage question.
- I added a clear and descriptive title that summarizes the feature request.
- I used the GitHub search to find a similar feature request and didn't find it.
- I checked the LangChain documentation and API reference to see if this feature already exists.
- This is not related to the langchain-community package.
Feature Description
The title says it all really. I have read that this functionality now exists, but when I run the below:
from langchain.tools import tool
from pydantic import BaseModel, Field
from typing import Literal, Optional
from models import gpt5
class AddOneSchema(BaseModel):
n: int = Field(..., description="Number to add one to.")
class ExtractTextSchema(BaseModel):
text: str = Field(..., description="Text to extract substring from.")
i: int = Field(..., description="Initial index.")
j: int = Field(..., description="Final index.")
@tool(args_schema=AddOneSchema)
def add_one(n):
"""add one to number"""
return n + 1
@tool(args_schema=ExtractTextSchema)
def extract_text(text, i, j):
"""Extract a substring from text between two integers"""
return text[i:j]
class NextAction(BaseModel):
next_tool: Literal["extract_text", "add_one"]
reason: Optional[str] = Field(..., description="Why this tool was chosen")
llm = gpt5.with_structured_output(
schema=NextAction,
method="json_schema",
tools=[add_one, extract_text],
strict=True,
)
response = llm.invoke('Use your tools to add one to two')
I get None as my response.
Use Case
I want to simultaneously have an agent call tools and dictate flow to other nodes/subgraphs if necessary, without multiple LLM calls.
Proposed Solution
No response
Alternatives Considered
No response
Additional Context
No response
Metadata
Metadata
Assignees
Labels
feature requestrequest for an enhancement / additional functionalityrequest for an enhancement / additional functionality