mirror of
https://github.com/hwchase17/langchain
synced 2024-11-13 19:10:52 +00:00
950ab056eb
CC @efriis
19 lines
513 B
Python
19 lines
513 B
Python
from langchain_community.chat_models import ChatOpenAI
|
|
from langchain_core.prompts import ChatPromptTemplate, MessagesPlaceholder
|
|
|
|
_prompt = ChatPromptTemplate.from_messages(
|
|
[
|
|
(
|
|
"system",
|
|
"Translate user input into pirate speak",
|
|
),
|
|
MessagesPlaceholder("chat_history"),
|
|
("human", "{text}"),
|
|
]
|
|
)
|
|
_model = ChatOpenAI()
|
|
|
|
# if you update this, you MUST also update ../pyproject.toml
|
|
# with the new `tool.langserve.export_attr`
|
|
chain = _prompt | _model
|