Quá trình ra quyết định và thực thi Agent trong LangChain (tiếp tục)
Khởi tạo trả lời
Một khi agent có tất cả thông tin cần thiết, nó thành hình một trả lời hoàn chỉnh cho người dùng.
Thực thi lặp lại (nếu yêu cầu)
+ Nếu truy vấn người dùng yêu cầu nhiều công cụ hay bước, agent lặp lại các bước trên cho đến khi nhiệm
vụ được hoàn thành.
+ Ví dụ: Cho “What is the weather in Paris, and what are some nearby restaurants?”, agent có thể
1. Sử dụng một công cụ thời tiết cho phần đầu tiên
2. Sử dụng công cụ tìm kiếm nhà hàng cho phần thứ hai.
Cung cấp đầu ra cuối cùng
Sau khi hoàn thành tất cả các bước, agent trả về kết quả tới người dùng.
Đầu ra mong đợi
Query 1:
User: What is the weather in Paris?
Tool Invoked: weather_tool
Response: The weather in Paris is sunny and 25°C.
Query 2:
User: What is the weather in Paris and some restaurants nearby?
Tool Invoked: weather_tool
Output: The weather in Paris is sunny and 25°C.
Tool Invoked: restaurant_tool
Output: In Paris, some popular restaurants are Chez Paris, Bistro Cafe, and Le Gourmet.
Final Response: The weather in Paris is sunny and 25°C. Nearby, you can try restaurants like Chez Paris, Bistro Cafe, and Le Gourmet.
