Freigeben über


PromptTemplateBase Class

Base class for prompt templates.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Inheritance
PromptTemplateBase
PromptTemplateBase

Constructor

PromptTemplateBase(*, prompt_template_config: PromptTemplateConfig, allow_dangerously_set_content: bool = False)

Keyword-Only Parameters

Name Description
prompt_template_config
Required
allow_dangerously_set_content
Required

Methods

render

Render the prompt template.

render

Render the prompt template.

abstract async render(kernel: Kernel, arguments: KernelArguments) -> str

Parameters

Name Description
kernel
Required
arguments
Required

Attributes

model_computed_fields

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

model_config

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True, 'validate_assignment': True}

model_fields

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.fields from Pydantic V1.

model_fields: ClassVar[Dict[str, FieldInfo]] = {'allow_dangerously_set_content': FieldInfo(annotation=bool, required=False, default=False), 'prompt_template_config': FieldInfo(annotation=PromptTemplateConfig, required=True)}

allow_dangerously_set_content

allow_dangerously_set_content: bool

prompt_template_config

prompt_template_config: PromptTemplateConfig