BaşlayınÜcretsiz Başlayın

Conversation setup

Now that you have a custom tool to help you calculate the length of a roof, you can set your agent's outputs to respond to your entered query. By slightly modifying your print statements, you can directly compare your query and your agent's response to ensure accuracy. Your tools and query have already been set up and your model is ready to use.

Bu egzersiz

Designing Agentic Systems with LangChain

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Initialize the create_react_agent function creating an object called app, passing in the required arguments.
  • Invoke the agent app, passing in your query, before storing and printing the agent's response.
  • Define the "user_input" as query and the "agent_output" as the last item extracted from "messages" in response before both are printed.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

tools = [hypotenuse_length]
query = "What is the value of the hypotenuse for a triangle with sides 3 and 5?"

# Create the ReAct agent
app = ____(____, ____)

# Invoke the agent with a query and store the messages
response = ____.____({"messages": [("human", ____)]})

# Define and print the input and output messages
print({
    "____": ____,
    "____": ____["____"][____].____
})
Kodu Düzenle ve Çalıştır