Skip to content
Discussion options

You must be logged in to vote

ah i see. i don't see any issues with the examples you pasted, and both types of tool definitions that you show work perfectly fine for me:

from langchain_core.pydantic_v1 import BaseModel, Field
from langchain_core.tools import tool
from langgraph.prebuilt import create_react_agent
from langchain_openai import ChatOpenAI

@tool
def add(a: int, b: int) -> int:
    """Adds a and b."""
    return a + b

class Add(BaseModel):
    """Add two integers together."""

    a: int = Field(..., description="First integer")
    b: int = Field(..., description="Second integer")

model = ChatOpenAI(model="gpt-4o-mini")
tools = [Add]  # `add` works just as well
agent = create_react_agent(model, tools)  #…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@cekcreator
Comment options

@hwchase17
Comment options

@vbarda
Comment options

Answer selected by cekcreator
@cekcreator
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants