Skip to content

Allow overriding PydanticPrompt's instruction and examples in the __init__ method by changing them to instance attributes with fallbackΒ #2108

@Glinte

Description

@Glinte

Describe the Feature
I expect to be able to initialize a subclass of PydanticPrompt and overriding the examples/instruction in the __init__ directly.

i.e.

ContextRecallClassificationPrompt(instruction="...", examples=[...])

Why is the feature important for you?
I am doing some evals and using LLMContextRecall / other related MetrciWithLLM classes, they provide a default prompt which is convenient, but overriding the prompt is not so convenient. For example, ContextRecallClassificationPrompt is the prompt class used in LLMContextRecall, and its __init__ method does not allow changing the examples (because they are class attributes), so the only way to go around it is to subclass ContextRecallClassificationPrompt and change the examples, or to initialize an instance of ContextRecallClassificationPrompt and then setting the instruction/examples (prompt.examples = examples). Both are more verbose than I would expect, and feels like ragas is making things harder than necessary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions