CustomAgenticRetrieverPrompt
User-defined prompt template for an agentic retriever.
Parameters
- template : string, default=
- The prompt template with placeholders.
Methods
format(self, input: 'str', chunks: 'str | Sequence[ChunkPayload]', pool_size: 'int | None' = None, top_k: 'int | None' = None, retrievers: 'str | RetrieverCatalog | None' = None, documents: 'Sequence[DocumentSummary] | None' = None, round_number: 'int | None' = None, max_rounds: 'int | None' = None, remaining: 'int | None' = None) -> 'str'
AgenticRetrieverPromptRender the prompt for the retrieval sufficiency stage.
Parameters
- input : str
- The current user message.
- chunks : str | Sequence[Mapping[str, Any]]
- Preformatted chunk text (kept verbatim) or structured chunk payloads with
document_id,positionandtext. - pool_size : int | None
- Optional candidate pool size.
- top_k : int | None
- Optional maximum number of retrievable chunks.
- retrievers : str | Mapping | None
- Optional 1-based retriever catalog, JSON-rendered.
- documents : Sequence[DocumentSummary] | None
- Optional document summaries; names and JSON are derived from them.
- round_number : int | None
- Optional 1-based evaluation round number.
- max_rounds : int | None
- Optional maximum number of evaluation rounds.
- remaining : int | None
- Optional number of free pool slots. When omitted and both
pool_sizeandtop_kare known, it is derived asmax(top_k - pool_size, 0).
Returns
- str
- The fully rendered prompt.
get_credential(self, name: str)
ConfigObjectResolve 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]
BasePromptReturn the prompt-specific metadata declared by the subclass.
Returns
- Dict[str, Any]
- A copy of the class
metadataattribute, or an empty dict when the subclass does not declare one.
get_optional_placeholders(self) -> List[str]
BasePromptGet 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]
BasePromptGet 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
ConfigObjectGenerates the component related Json Schema.
Returns
- dict
- Dictionary representing the Json Schema of the component.
render_optional(cls, template: str, key: str, value: Any) -> str
BasePromptRender an optional placeholder following the line-drop contract.
Parameters
- template : str
- Template that may contain the optional placeholder token.
- key : str
- The optional placeholder token (for example
"{n_max}"). - value : Any
- Replacement value. When
Nonethe token's lines are dropped.
Returns
- str
- The rendered template.
render_placeholders(template: str, values: Dict[str, Any]) -> str
BasePromptSubstitute every placeholder token in a single left-to-right pass.
Parameters
- template : str
- Template containing zero or more placeholder tokens.
- values : Dict[str, Any]
- Mapping of placeholder token (for example
"{input}") to its replacement value. Values are coerced withstr.
Returns
- str
- The rendered template.
validate_and_transform(self, raw_data: dict) -> dict
ConfigObjectIt 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
BasePromptValidate 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.