Saltar al contenido principal

DefaultQARAGGenerationPrompt

Prompt
DashAI.back.models.RAG.prompts.generation.DefaultQARAGGenerationPrompt

Default generation prompt for Question Answering tasks. This prompt is designed to guide the language model in generating answers based on provided context chunks.

Parameters​

language : string, default=en
Language for the generated response.
template : string, default=
The prompt template with placeholders.

Methods​

format(self, input: str, chunks: str, **kwargs: Any) -> str

Defined on DefaultQARAGGenerationPrompt

Render the QA prompt by replacing placeholders with actual values.

get_credential(self, name: str)

Defined on ConfigObject

Resolve a registered credential component by name.

Parameters

name : str
Credential component class name (e.g. "HuggingFaceCredential").

Returns

BaseCredential
An instance of the requested credential component.

get_metadata(cls) -> Dict[str, Any]

Defined on BasePrompt

Return the prompt-specific metadata declared by the subclass.

Returns

Dict[str, Any]
A copy of the class metadata attribute, or an empty dict when the subclass does not declare one.

get_optional_placeholders(self) -> List[str]

Defined on BasePrompt

Get the list of optional placeholders for the prompt template. Returns: List[str]: List of optional placeholders. Raises: AttributeError: If the subclass does not define 'optional_placeholders'.

get_required_placeholders(cls) -> List[str]

Defined on BasePrompt

Get the list of required placeholders for the prompt template. Returns: List[str]: List of required placeholders. Raises: AttributeError: If the subclass does not define 'required_placeholders'.

get_schema(cls) -> dict

Defined on ConfigObject

Generates the component related Json Schema.

Returns

dict
Dictionary representing the Json Schema of the component.

validate_and_transform(self, raw_data: dict) -> dict

Defined on ConfigObject

It takes the data given by the user to initialize the model and returns it with all the objects that the model needs to work.

Parameters

raw_data : dict
A dictionary with the data provided by the user to initialize the model.

Returns

dict
A validated dictionary with the necessary objects.

validate_template(cls, template: str) -> bool

Defined on BasePrompt

Validate that the template contains all required placeholders. Args: template (str): The prompt template to be validated. Returns: bool: True if the template is valid, False otherwise.