Skip to content

Refactor/faithfulness template protocol #1462

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

realei
Copy link
Contributor

@realei realei commented Mar 22, 2025

Title:

Refactor prompt template into protocol for customizable faithfulness evaluation

Description:

This PR extracts the faithfulness prompt logic into a protocol interface (FaithfulnessTemplateProtocol) to allow easy injection of custom prompt templates. This improves flexibility, code clarity, and enables user-defined behavior.

Copy link

vercel bot commented Mar 22, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
deepeval-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 26, 2025 6:39pm

return f"""Based on the given text, please extract a comprehensive list of FACTUAL, undisputed truths, that can inferred from the provided text.
These truths, MUST BE COHERENT, and CANNOT be taken out of context.

Example:
Example Text:
Example Text: q
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it's a typo thank you for pointing it out!

...

@staticmethod
def generate_reason(score: float, contradictions: List[str]) -> str:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I just updated it

@realei
Copy link
Contributor Author

realei commented Mar 26, 2025

I just opened a PR with an example using Protocol. I believe this approach is more flexible than ABC and makes it much easier for users to define domain-specific evaluation prompt templates.

The example has been tested locally with GPT-3.5, and I’ve also fixed the bugs from my previous PR (#1462) everything is working now.

Would love your feedback on whether this direction makes sense for DeepEval.

#1470

@realei
Copy link
Contributor Author

realei commented Mar 26, 2025

fixed typo, and added "..."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants