LangChainGo / openai_prompt_template.py
lizhen
LangChain openAI快速接入。
5bd6c7f
raw
history blame
353 Bytes
from langchain.prompts import PromptTemplate
from langchain.llms import OpenAI
from langchain.chains import LLMChain
llm = OpenAI(temperature=0.9)
prompt = PromptTemplate(
input_variables=["product"],
template="What is a good name for a company that makes {product}?"
)
chain = LLMChain(llm=llm,prompt=prompt)
print(chain.run("colorful socks"))