Skip to content

Commit

Permalink
enhance langchain example
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy Douhard authored and Willy Douhard committed Jun 15, 2023
1 parent 5458d7e commit fe59136
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions langchain.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ def factory():

```python Sync
import os
from langchain import PromptTemplate, OpenAI, LLMChain
from langchain import PromptTemplate, LLMChain
from langchain.chat_models import ChatOpenAI
import chainlit as cl

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

return llm_chain
```
Expand Down

0 comments on commit fe59136

Please sign in to comment.