Unable to bind tools with Chatollama #26607
Unanswered
shobhitagnihotri69
asked this question in
Q&A
Replies: 1 comment
-
To bind tools with from typing import List
from langchain_core.tools import tool
from langchain_ollama import ChatOllama
@tool
def validate_user(user_id: int, addresses: List[str]) -> bool:
"""Validate user using historical addresses.
Args:
user_id (int): the user ID.
addresses (List[str]): Previous addresses as a list of strings.
"""
return True
llm = ChatOllama(
model="llama3.1",
temperature=0,
).bind_tools([validate_user])
result = llm.invoke(
"Could you validate user 123? They previously lived at "
"123 Fake St in Boston MA and 234 Pretend Boulevard in "
"Houston TX."
)
result.tool_calls This code demonstrates how to create a tool using the |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to build agent with llama3.1 ,but I am unable to bind tools with llm
![Uploading Screenshot 2024-09-18 at 09.01.39.png…]()
Beta Was this translation helpful? Give feedback.
All reactions