import os from langchain import PromptTemplate, OpenAI, LLMChain import chainlit as cl
os.environ["http_proxy"] = "http://localhost:7890" os.environ["https_proxy"] = "http://localhost:7890" os.environ["OPENAI_API_KEY"] = "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"
template = """Question: {question} Answer: Let's think step by step.""" @cl.langchain_factory(use_async=True) def factory(): prompt = PromptTemplate(template=template, input_variables=["question"]) llm_chain = LLMChain(prompt=prompt, llm=OpenAI(temperature=0), verbose=True) return llm_chain