chainlit icon indicating copy to clipboard operation
chainlit copied to clipboard

Streaming=True not working when i integrate Langchain.

Open altafr opened this issue 1 year ago • 2 comments

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

altafr avatar Jun 04 '23 08:06 altafr