Skip to content

Commit fe59136

Browse files
Willy DouhardWilly Douhard
Willy Douhard
authored and
Willy Douhard
committed
enhance langchain example
1 parent 5458d7e commit fe59136

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

langchain.mdx

+3-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def factory():
4949

5050
```python Sync
5151
import os
52-
from langchain import PromptTemplate, OpenAI, LLMChain
52+
from langchain import PromptTemplate, LLMChain
53+
from langchain.chat_models import ChatOpenAI
5354
import chainlit as cl
5455

5556
os.environ["OPENAI_API_KEY"] = "YOUR_OPEN_AI_API_KEY"
@@ -61,7 +62,7 @@ Answer: Let's think step by step."""
6162
@cl.langchain_factory(use_async=False)
6263
def factory():
6364
prompt = PromptTemplate(template=template, input_variables=["question"])
64-
llm_chain = LLMChain(prompt=prompt, llm=OpenAI(temperature=0), verbose=True)
65+
llm_chain = LLMChain(prompt=prompt, llm=ChatOpenAI(temperature=0, streaming=True))
6566

6667
return llm_chain
6768
```

0 commit comments

Comments
 (0)