mirror of
https://github.com/hwchase17/langchain
synced 2024-11-10 01:10:59 +00:00
21 lines
591 B
Plaintext
21 lines
591 B
Plaintext
```python
|
|
from langchain.prompts.chat import ChatPromptTemplate
|
|
|
|
template = "You are a helpful assistant that translates {input_language} to {output_language}."
|
|
human_template = "{text}"
|
|
|
|
chat_prompt = ChatPromptTemplate.from_messages([
|
|
("system", template),
|
|
("human", human_template),
|
|
])
|
|
|
|
chat_prompt.format_messages(input_language="English", output_language="French", text="I love programming.")
|
|
```
|
|
|
|
```pycon
|
|
[
|
|
SystemMessage(content="You are a helpful assistant that translates English to French.", additional_kwargs={}),
|
|
HumanMessage(content="I love programming.")
|
|
]
|
|
```
|