Spaces:
Sleeping
Sleeping
File size: 704 Bytes
1c041ec d850c57 1c041ec d850c57 1c041ec d850c57 1c041ec d850c57 1c041ec d850c57 1c041ec d850c57 1c041ec d850c57 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
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) |