Tool Calling with LangChain

Поділитися
Вставка
  • Опубліковано 27 вер 2024

КОМЕНТАРІ • 31

  • @ajaybeniwal203
    @ajaybeniwal203 5 місяців тому +6

    Are these updates available in typescript package as well ?

  • @pazarazi
    @pazarazi 5 місяців тому

    Thanks for sharing.
    BTW, links that point to resource page of "Tool calling agent shows how to create an agent that uses the standardized tool calling interface: " are invalid.

  • @lshagh6045
    @lshagh6045 5 місяців тому

    In case we needed to use an LLM model that is opensource like Llama2 I can see that you depricated the previous agent library which enables us to do so

  • @MavVRX
    @MavVRX 5 місяців тому +2

    Unfortunately, it doesn't work with Ollama yet :( object has no attribute 'bind_tools'

    • @nikoG2000
      @nikoG2000 5 місяців тому

      How have you tried to use Ollama? Have you tried the following way:
      from langchain_community.chat_models import ChatOllama
      llm = ChatOllama(model="llama2", format="json", temperature=0)

    • @MavVRX
      @MavVRX 5 місяців тому

      @@nikoG2000 Yes, tried, doesn't work as the community version of Ollama has yet to implement binding functions and tools.

  • @lionelshaghlil1754
    @lionelshaghlil1754 5 місяців тому +1

    Did you notice that when choosing the openai gpt4 as a model, the result was empty.
    Am I missing something please,
    I was implementing a similar code and faced the same problem, the result showed me empty content despite calling the function successfully, Thanks

    • @severlight
      @severlight 3 місяці тому

      same, were you able to resolve it?

  • @juliustuckayo8973
    @juliustuckayo8973 5 місяців тому +1

    Very clear explanation! Love Python! Keep em comming 🎉

  • @AngelMartinez-ge2gs
    @AngelMartinez-ge2gs 5 місяців тому

    Good vid. Could you elaborate on the difference between `create_tool_calling_agent()` and other agents commonly used such as create_react_agent?

    • @maruthikonjeti4572
      @maruthikonjeti4572 5 місяців тому

      As per my knowledge, create_react_agent works on ReAct based agents, whereas here it's more customized to users and they can convert a normal LLM into an agent

    • @LangChain
      @LangChain  5 місяців тому +2

      Some LLMs are tuned to output these "tool calls" with an expected format. This agent takes advantage of those features, whereas ReAct typically relies on prompting the LLM to follow a certain natural language pattern (e.g., "Thought: ", "Action: ", etc.).

    • @Kenykore
      @Kenykore 5 місяців тому

      So would this be more stable than react pattern

  • @ihateorangecat
    @ihateorangecat 5 місяців тому +1

    I hate Python. 🙂

    • @LangChain
      @LangChain  5 місяців тому +2

      We released the same feature in JS too, in case that's more your speed! js.langchain.com/docs/modules/model_io/chat/function_calling

    • @hiranga
      @hiranga 5 місяців тому

      @@LangChain is this working with ChatGroq/Mixtral?

    • @sepia_tone
      @sepia_tone 5 місяців тому

      @@LangChain ... link that point to resource page of "Tool calling agent shows how to create an agent that uses the standardized tool calling interface: " is invalid.

  • @svenst
    @svenst 2 місяці тому

    I'd like to know how to implement chat function calling with streaming=true and as an api endpoint. It feels like langchain and llamaindex are optimizing for colab notebooks without streaming, but none of the examples I've seen so far are real world use cases. So I would apprechiate if u could come up with some sort of real world examples.

  • @anirban3974
    @anirban3974 Місяць тому

    When to use bind_tools and when to ue create_tool_calling_agent?

  • @SashaBaych
    @SashaBaych 5 місяців тому +1

    Chester, thank you for a very clear walkthrough!
    Guys, can somebody please clarify what would be the difference between just invoking the model with binded tools as opposed to creating agent with tools using a method shown in the tutorial. Especially in the context of the langgraph. I see so many tutorials on langgraph but only few of them use AgentExecutors. Do I even need to use AgentExecutors with langgraph?

  • @waneyvin
    @waneyvin 5 місяців тому +1

    thanks a lot for your infomation and is it compatibile to all llm? and what is the difference between bind_tools and create_react_agent, does agent think before they choose the tool?

  • @unhandledexception1948
    @unhandledexception1948 4 місяці тому +1

    you guys really rock ! always ahead of the curve bringing innovations in this space ;-)

  • @gordeyvasilev
    @gordeyvasilev 2 місяці тому

    👍

  • @brilliant332
    @brilliant332 4 місяці тому

    I've had trouble with date, I'm curious if you have references to using different pydantic field types in tool calling? Any help would be great!
    My use case
    from langchain_core.pydantic_v1 import BaseModel, Field
    from datetime import date
    class CompanySobject(BaseModel):
    incorporation_date: Optional[date] = Field(None, description="Incorporation date (format: YYYY-MM-DD)")
    Exception in parsing company SObject: 1 validation error for CompanySobject
    incorporation_date: invalid datetime format (type=value_error.datetime)

  • @lamkhatinh8344
    @lamkhatinh8344 5 місяців тому

    agentExecutor = AgentExecutor(
    agent=self.chain,
    tools=self.tools,
    verbose=True,
    memory=memory,
    handle_parsing_errors=True,
    )
    I build agent with above command, can you tell me which difference between your method and my code ?

  • @hiranga
    @hiranga 5 місяців тому

    @LangChain is there a way to self-heal the invalid tool args created by an LLM? Groq Mixtral appears to suffer here..

  • @GeoffLadwig
    @GeoffLadwig 5 місяців тому

    very nice, but how do I call and execute the tool from the JSON that was returned?

    • @LangChain
      @LangChain  5 місяців тому

      LangChain's AgentExecutor is built for this: python.langchain.com/docs/modules/agents/agent_types/tool_calling/
      You can always "manually" pass the parameters back into the original tool, as well.
      We also are supporting more advanced agent workflows in Langgraph (github.com/langchain-ai/langgraph), and uploaded a cookbook on using the new tool calls with Langgraph here: github.com/langchain-ai/langchain/blob/master/cookbook/tool_call_messages.ipynb. More to come on this!

  • @abdullahsiddique6393
    @abdullahsiddique6393 5 місяців тому

    First

  • @kaustuvchakraborty7372
    @kaustuvchakraborty7372 5 місяців тому

    Very poor explanation,executing 6 lines of code in jyputer notebook was not expected