test-A / pipline.py
avreymi's picture
add chain
d850c57
raw
history blame
704 Bytes
import langchain as lc
from langchain import PromptTemplate, OpenAI, LLMChain
from langchain.prompts import load_prompt
import wikipedia
import os
llm = OpenAI()
# save templates to a file
template = """Question:
The user wrote me the following text, what is he trying to imply to me?
{user_input}
Answer: Let's think step by step."""
# An example prompt with multiple input variables
input_prompt = PromptTemplate(
input_variables=["user_input"],
template=template,
)
input_prompt.save("awesome_prompt.json") # Save to JSON file
prompt = load_prompt("awesome_prompt.json")
prompt = PromptTemplate(template=template, input_variables=["user_input"])
chain = LLMChain(prompt=prompt, llm=llm)