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

Chains (LLMChain)

LangChainသင်ခန်းစာ 6

Chains များသည် LangChain ၏ core concept ဖြစ်သည်။ ၎င်းသည် components များ (e.g., prompt template, model, output parser) ကို အဆင့်ဆင့် (chain) ချိတ်ဆက်ပေးသည်။ LLMChain သည် အခြေခံအကျဆုံး chain ဖြစ်သည်။

python
from langchain_openai import ChatOpenAI
from langchain.prompts import PromptTemplate
from langchain.chains import LLMChain

llm = ChatOpenAI(model="gpt-3.5-turbo", temperature=0)
prompt = PromptTemplate.from_template(
    "What is the best name for a company that makes {product}?"
)

# Create an LLMChain
chain = LLMChain(llm=llm, prompt=prompt)

# Run the chain
response = chain.invoke({"product": "colorful socks"})
print(response)
You should see
{'product': 'colorful socks', 'text': 'SoleMates'}

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

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

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

Chains (LLMChain) | Thuta Learning