类 PromptTemplate
java.lang.Object
dev.langchain4j.model.input.PromptTemplate
Represents a template of a prompt that can be reused multiple times.
A template typically contains one or more variables (placeholders) defined as {{variable_name}} that are
replaced with actual values to produce a Prompt.
Special variables {{current_date}}, {{current_time}}, and {{current_date_time}} are automatically
filled with LocalDate.now(), LocalTime.now(), and LocalDateTime.now() respectively.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明Applies a value to a template containing a single variable.Applies multiple values to a template containing multiple variables.static PromptTemplateCreate a new PromptTemplate.template()
-
构造器详细资料
-
PromptTemplate
Create a new PromptTemplate.The
Clockwill be the system clock.- 参数:
template- the template string of the prompt.
-
-
方法详细资料
-
template
- 返回:
- A prompt template string.
-
apply
Applies a value to a template containing a single variable. The single variable should have the name {{it}}.- 参数:
value- The value that will be injected in place of the {{it}} placeholder in the template.- 返回:
- A Prompt object where the {{it}} placeholder in the template has been replaced by the provided value.
-
apply
Applies multiple values to a template containing multiple variables.- 参数:
variables- A map of variable names to values that will be injected in place of the corresponding placeholders in the template.- 返回:
- A Prompt object where the placeholders in the template have been replaced by the provided values.
-
from
Create a new PromptTemplate.- 参数:
template- the template string of the prompt.- 返回:
- the PromptTemplate.
-