ragrank.promptο
base fo the the prompt module |
βThe prompt module for ragrank
- class ragrank.prompt.Prompt(*, name: str, instructions: str, examples: List[Dict[str, Any]] = None, input_keys: List[str], output_key: str)ο
Represents a prompt for the Language Learning Model (LLM).
- nameο
The name of the prompt.
- Type:
str
- instructionsο
The instructions for the prompt.
- Type:
str
- examplesο
List of example inputs and outputs.
- Type:
List[Example]
- input_keysο
List of input keys.
- Type:
List[str]
- output_keyο
Key for the output.
- Type:
str
- get_examples(example_no: int | None = None) str ο
Retrieve examples from the prompt.
- Parameters:
example_no (Optional[int]) β The number of examples to retrieve.
- Returns:
List of example inputs and outputs.
- Return type:
List[Example]
- Raises:
IndexError β If example number is out of range.
- load() None ο
Load the saved object from the system
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}ο
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ConfigDict = {'frozen': True}ο
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'examples': FieldInfo(annotation=List[Dict[str, Any]], required=False, default_factory=list, description='List of example inputs and outputs.', repr=False), 'input_keys': FieldInfo(annotation=List[str], required=True, description='List of input keys.', repr=False), 'instructions': FieldInfo(annotation=str, required=True, description='The instructions for the prompt.', repr=False), 'name': FieldInfo(annotation=str, required=True, description='The name of the prompt.'), 'output_key': FieldInfo(annotation=str, required=True, description='Key for the output.', repr=False)}ο
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- save() None ο
Save the object locally
- to_string() str ο
Convert the prompt to a string representation.
- Returns:
String representation of the prompt.
- Return type:
str