langchain/templates/pirate-speak/pirate_speak/chain.py
Harrison Chase 221134d239
Harrison/quick start (#12491)
Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
2023-10-28 16:26:52 -07:00

18 lines
432 B
Python

from langchain.chat_models import ChatOpenAI
from langchain.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