chainlit
chainlit copied to clipboard
Streaming=True not working when i integrate Langchain.
import os from langchain import PromptTemplate, OpenAI, LLMChain import chainlit as cl
#os.environ["OPENAI_API_KEY"] = "YOUR_OPEN_AI_API_KEY"
template = """Question: {question}
Answer: Let's think step by step."""
llm=OpenAI(temperature=0,streaming=True)
@cl.langchain_factory def factory():
prompt = PromptTemplate(template=template, input_variables=["question"])
llm_chain = LLMChain(prompt=prompt, llm=llm , verbose=True)
return llm_chain