Mixin
PromptMixin
Mixin class for classes that have prompts. eg: BaseSynthesizer, MetricWithLLM
get_prompts
get_prompts() -> Dict[str, PydanticPrompt]
Returns a dictionary of prompts for the class.
Source code in src/ragas/prompt/mixin.py
set_prompts
Sets the prompts for the class.
Raises:
Type | Description |
---|---|
ValueError
|
If the prompt is not an instance of |
Source code in src/ragas/prompt/mixin.py
adapt_prompts
async
adapt_prompts(
language: str, llm: BaseRagasLLM
) -> Dict[str, PydanticPrompt]
Adapts the prompts in the class to the given language and using the given LLM.
Notes
Make sure you use the best available LLM for adapting the prompts and then save and load the prompts using save_prompts and load_prompts methods.
Source code in src/ragas/prompt/mixin.py
save_prompts
Saves the prompts to a directory in the format of {name}_{language}.json
Source code in src/ragas/prompt/mixin.py
load_prompts
Loads the prompts from a path. File should be in the format of {name}_{language}.json