Skip to content

Tool Calling - A newbies challenge unsolved #2855

Closed Answered by kimamil
kimamil asked this question in Q&A
Discussion options

You must be logged in to vote

The issue is with the way I used .bind_tools()

.bind_tools() returns a new Runnable, the result must be reassigned to the variable of the initial Runnable.

Slightly modified code that runs perfectly:

import random
import string
from langchain_core.tools import tool
from langchain_openai import ChatOpenAI

from langgraph.checkpoint.memory import MemorySaver
from langgraph.graph import StateGraph, MessagesState, START, END
from langgraph.prebuilt import ToolNode, tools_condition


memory = MemorySaver()


@tool
def password(length: int) -> str:
    """Create strong passwords."""
    return ''.join(
        random.choices(
            string.ascii_letters
            + string.digits
        …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kimamil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant