From 2ea0ea930ec17c7b063f9c4fa8b2c1345c885d34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A0=D0=B8=D0=BD=D0=B0=D1=80=20=D0=9C=D0=B8=D1=80=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D0=B8=D1=82=D0=BE=D0=B2?= Date: Wed, 27 May 2026 08:52:57 +0000 Subject: [PATCH] Add main.py --- main.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 main.py 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()