docs/examples/chat_engine/chat_engine_repl.ipynb
<a href="https://colab.research.google.com/github/run-llama/llama_index/blob/main/docs/examples/chat_engine/chat_engine_repl.ipynb" target="_parent"></a>
If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.
%pip install llama-index-llms-openai
!pip install llama-index
Using GPT3 ("text-davinci-003")
from llama_index.core.chat_engine import SimpleChatEngine
chat_engine = SimpleChatEngine.from_defaults()
chat_engine.chat_repl()
Use ChatGPT ("gpt-3.5-turbo")
from llama_index.llms.openai import OpenAI
llm = OpenAI(temperature=0.0, model="gpt-3.5-turbo")
from llama_index.core.chat_engine import SimpleChatEngine
chat_engine = SimpleChatEngine.from_defaults(llm=llm)
chat_engine.chat_repl()
from llama_index.llms.openai import OpenAI
llm = OpenAI(temperature=0.0, model="gpt-3.5-turbo-0613")
from llama_index.core.chat_engine import SimpleChatEngine
chat_engine = SimpleChatEngine.from_defaults(llm=llm)
response = chat_engine.stream_chat(
"Write me a poem about raining cats and dogs."
)
for token in response.response_gen:
print(token, end="")