-
Notifications
You must be signed in to change notification settings - Fork 100
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
Add JUnit 5 ScorerExtension
for AI model evaluation and associated library
#1173
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I read the doc to better understand this thing and I noticed a few tiny things (but feel free to ignore, they are tiny tiny).
fc4b3af
to
be27c81
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very neat, this was sorely needed!
I added a few small comments
.../scorer-core/src/main/java/io/quarkiverse/langchain4j/testing/scorer/EvaluationStrategy.java
Show resolved
Hide resolved
testing/scorer/scorer-core/src/main/java/io/quarkiverse/langchain4j/testing/scorer/Input.java
Outdated
Show resolved
Hide resolved
@Override | ||
public boolean evaluate(EvaluationSample<String> sample, String output) { | ||
String expectedOutput = sample.expectedOutput(); | ||
String prompt = this.prompt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I could see this being an actual template in the future, but no reason to overcomplicate for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. This strategy needs a bit of tuning.
...ng/scorer/scorer-junit5/src/main/java/io/quarkiverse/langchain4j/scorer/junit5/AiScorer.java
Show resolved
Hide resolved
...rer/scorer-junit5/src/main/java/io/quarkiverse/langchain4j/scorer/junit5/SampleLocation.java
Show resolved
Hide resolved
...corer-junit5/src/main/java/io/quarkiverse/langchain4j/scorer/junit5/ScorerConfiguration.java
Show resolved
Hide resolved
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…library - Implement `ScorerExtension` to inject and manage Scorer instances in tests. - Support field and parameter injection for Scorer using `@ScorerConfiguration`. - Add support for parameter injection of samples via `@SampleLocation` annotation. - Provide built-in evaluation strategies: - `SemanticSimilarityStrategy` (cosine similarity-based evaluation). - `AiJudgeStrategy` (AI-powered evaluation with customizable prompts). - Add tests for ScorerExtension: - Validate field and parameter injection of Scorer. - Test sample injection from YAML files. - Verify evaluation strategies and reporting. - Document ScorerExtension: - Explain concepts: Scorer, Samples, Evaluation Strategies, Reports. - Usage examples for field/parameter injection and evaluation. - Guide for using built-in strategies and creating custom strategies.
be27c81
to
7591433
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
Status for workflow
|
ScorerExtension
to inject and manage Scorer instances in tests.@ScorerConfiguration
.@SampleLocation
annotation.SemanticSimilarityStrategy
(cosine similarity-based evaluation).AiJudgeStrategy
(AI-powered evaluation with customizable prompts).