Spaces:
Runtime error
Runtime error
Create lesson1_prompt.py
Browse files- lesson1_prompt.py +12 -0
lesson1_prompt.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain.prompts import ChatPromptTemplate
|
| 2 |
+
|
| 3 |
+
# 定义模板字符串
|
| 4 |
+
template_string = """Translate the text \
|
| 5 |
+
that is delimited by triple backticks \
|
| 6 |
+
into a style that is {style}. \
|
| 7 |
+
text: ```{text}```
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
# 提供模板创建功能
|
| 11 |
+
def get_prompt_template():
|
| 12 |
+
return ChatPromptTemplate.from_template(template_string)
|