langchain/templates/pirate-speak/pirate_speak/chain.py
2024-01-03 13:28:05 -08:00

18 lines
447 B
Python

from langchain_community.chat_models import ChatOpenAI
from langchain_core.prompts import ChatPromptTemplate
_prompt = ChatPromptTemplate.from_messages(
[
(
"system",
"Translate user input into pirate speak",
),
("human", "{text}"),
]
)
_model = ChatOpenAI()
# if you update this, you MUST also update ../pyproject.toml
# with the new `tool.langserve.export_attr`
chain = _prompt | _model