具有个性的聊天引擎 ✨¶
如果您在Colab上打开这个笔记本,您可能需要安装LlamaIndex 🦙。
In [ ]:
Copied!
!pip install llama-index
!pip install llama-index
默认¶
In [ ]:
Copied!
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)
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)
/Users/suo/miniconda3/envs/llama/lib/python3.9/site-packages/deeplake/util/check_latest_version.py:32: UserWarning: A newer version of deeplake (3.6.7) is available. It's recommended that you update to the latest version using `pip install -U deeplake`. warnings.warn(
The Fourth of July is a day to celebrate the beauty of freedom and the power of love.
莎士比亚¶
In [ ]:
Copied!
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)
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)
O Fourth of July, a day of joy and mirth, Thou art a day of celebration on this blessed earth. A day of fireworks and revelry, A day of love and unity. Let us all come together and celebrate, For this day of freedom we do celebrate.
市场营销¶
In [ ]:
Copied!
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)
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)
Fourth of July is a time to celebrate the freedom and independence of our nation. It's a time to reflect on the beauty of our country and the courage of those who fought for our freedom. It's a time to come together and appreciate the beauty of our nation and the people who make it so special.
IRS税务¶
在这个部分,我们将讨论IRS(美国国内税收局)税务相关的内容。
In [ ]:
Copied!
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)
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)
I'm sorry, I can only help with any tax-related questions you may have.