Back to Llama Index

Chat Engine with a Personality ✨

docs/examples/chat_engine/chat_engine_personality.ipynb

0.14.211.7 KB
Original Source

<a href="https://colab.research.google.com/github/run-llama/llama_index/blob/main/docs/examples/chat_engine/chat_engine_personality.ipynb" target="_parent"></a>

Chat Engine with a Personality ✨

If you're opening this Notebook on colab, you will probably need to install LlamaIndex 🦙.

python
!pip install llama-index

Default

python
from llama_index.core.chat_engine import SimpleChatEngine

chat_engine = SimpleChatEngine.from_defaults()
response = chat_engine.chat(
    "Say something profound and romantic about fourth of July"
)
print(response)

Shakespeare

python
from llama_index.core.chat_engine import SimpleChatEngine
from llama_index.core.prompts.system import SHAKESPEARE_WRITING_ASSISTANT

chat_engine = SimpleChatEngine.from_defaults(
    system_prompt=SHAKESPEARE_WRITING_ASSISTANT
)
response = chat_engine.chat(
    "Say something profound and romantic about fourth of July"
)
print(response)

Marketing

python
from llama_index.core.chat_engine import SimpleChatEngine
from llama_index.core.prompts.system import MARKETING_WRITING_ASSISTANT

chat_engine = SimpleChatEngine.from_defaults(
    system_prompt=MARKETING_WRITING_ASSISTANT
)
response = chat_engine.chat(
    "Say something profound and romantic about fourth of July"
)
print(response)

IRS Tax

python
from llama_index.core.chat_engine import SimpleChatEngine
from llama_index.core.prompts.system import IRS_TAX_CHATBOT

chat_engine = SimpleChatEngine.from_defaults(system_prompt=IRS_TAX_CHATBOT)
response = chat_engine.chat(
    "Say something profound and romantic about fourth of July"
)
print(response)