Agent ကို tool တစ်ခု (e.g., Google Search အတွက် SerpAPI) နှင့် ချိတ်ဆက်ပေးခြင်းဖြင့် LLM သည် ၎င်း၏ internal knowledge တွင်မရှိသော real-time information များကို ရှာဖွေဖြေဆိုနိုင်သည်။
python
# This requires a SerpAPI API key
# pip install langchain-community google-search-results
from langchain_community.tools import SerpAPIWrapper
from langchain.agents import AgentExecutor, create_openai_tools_agent
tools = [SerpAPIWrapper()]
# ... (Agent setup with prompt and LLM)
agent_executor = AgentExecutor(agent=agent, tools=tools)
agent_executor.invoke({"input": "what is the weather in Yangon?"})You should see
(Agent သည် SerpAPI tool ကိုသုံးပြီး ရန်ကုန်မြို့၏ ရာသီဥတုကို ရှာဖွေပြီး အဖြေကို ပြန်ပေးမည်)