base_chain_builder
Base chain builder module
Attributes
Classes
BaseChainBuilder
Bases: ChainBuilder
, ABC
Functions
build_prompt_from_template
staticmethod
build_prompt_from_template(
template: str,
llm_settings: LLMSettings,
mapper_to_str_kwargs: Dict[str, Any] | None = None,
output_parser: BaseOutputParser | None = None,
template_format: str = "f-string",
) -> Tuple[PromptTemplate, RunnableSerializable | None]
Builds a prompt template and a corresponding output parser based on the given template string and settings.
Parameters:
-
template
(str
) –The template string for the prompt.
-
llm_settings
(LLMSettings
) –The settings for the language model.
-
mapper_to_str_kwargs
(Dict[str, Any] | None
, default:None
) –Additional keyword arguments for the mapper’s
to_str
method. Defaults to None. -
output_parser
(BaseOutputParser | None
, default:None
) –The output parser to be used. Defaults to None.
Returns:
-
Tuple[PromptTemplate, RunnableSerializable | None]
–Tuple[PromptTemplate, RunnableSerializable]: A tuple containing the prompt template and the derived output parser.