diff --git a/main.py b/main.py new file mode 100644 index 0000000..8ae27ad --- /dev/null +++ b/main.py @@ -0,0 +1,19 @@ +from langchain import LLMChain, PromptTemplate +from langchain_openai import OpenAI + +def main(): + template = """ +You are a helpful assistant. +Question: {question} +Answer:""" + prompt = PromptTemplate(template=template, input_variables=["question"]) + llm = OpenAI(api_key="YOUR_API_KEY", temperature=0.7) + chain = LLMChain(llm=llm, prompt=prompt) + while True: + q = input("Ask a question (or 'exit'): ") + if q.lower() in {"exit", "quit"}: + break + print(chain.run({"question": q})) + +if __name__ == "__main__": + main()