Thuta Learning
LangChain
AdvancedAIအဆင့်မြင့်

Agents with Tools

LangChainသင်ခန်းစာ 14

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 ကိုသုံးပြီး ရန်ကုန်မြို့၏ ရာသီဥတုကို ရှာဖွေပြီး အဖြေကို ပြန်ပေးမည်)

နောက်ဆုံးပြင်ဆင်ရက်

Progress ကို ဤ browser (ဤစက်) တွင်သာ သိမ်းထားပါသည်။ အခြားစက်များနှင့် sync မလုပ်ပါ။

ဤသင်ခန်းစာတွင် အမှားတွေ့ပါက အကြောင်းကြားရန်သင့် email app ကို ဤသင်ခန်းစာလိပ်စာ ဖြည့်ပြီးသားဖြင့် ဖွင့်ပေးပါမည် — သင်ကိုယ်တိုင် ပို့မှသာ ပို့မည်ဖြစ်သည်။

Agents with Tools | Thuta Learning