Get a new ChatPromptTemplate with some input variables already filled in.
partial(
self,
**kwargs: Any = {},
) -> ChatPromptTemplateExample:
from langchain_core.prompts import ChatPromptTemplate
template = ChatPromptTemplate.from_messages(
[
("system", "You are an AI assistant named {name}."),
("human", "Hi I'm {user}"),
("ai", "Hi there, {user}, I'm {name}."),
("human", "{input}"),
]
)
template2 = template.partial(user="Lucy", name="R2D2")
template2.format_messages(input="hello")| Name | Type | Description |
|---|---|---|
**kwargs | Any | Default: {}Keyword arguments to use for filling in template variables. Ought to be a subset of the input variables. |