Skip to content

Conversation

@abhishekg999
Copy link
Collaborator

No description provided.

@gemini-code-assist
Copy link

Summary of Changes

Hello @abhishekg999, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request undertakes a significant refactoring of the Judgeval Java SDK to deprecate and remove the v0 package structure. The primary goal is to simplify the API by promoting the v1 package content to the root com.judgmentlabs.judgeval namespace, removing redundant and deprecated classes, and streamlining configuration for core components like the tracer. This change aims to provide a cleaner, more intuitive, and maintainable SDK for users.

Highlights

  • Package Restructuring: The core Judgeval SDK classes and factories (Evaluation, Scorers, Tracer) have been moved from the com.judgmentlabs.judgeval.v1 package to the root com.judgmentlabs.judgeval package, simplifying import paths and promoting the new structure.
  • Removal of Deprecated Components: Several previously deprecated classes and builders, such as EvaluationRunBuilder, TraceEvaluationRunBuilder, and various APIScorer implementations (e.g., AnswerCorrectnessScorer, FaithfulnessScorer) from the old api_scorers package, have been removed.
  • Consolidation of Tracer Configuration: The TracerConfiguration class has been removed, and its parameters are now directly managed by the Tracer.Builder, streamlining the tracer setup process.
  • Simplified OpenAI Instrumentation: The dedicated judgeval-instrumentation-openai module and its related OpenAITelemetry class have been removed, indicating a change in how OpenAI instrumentation is handled or integrated.
  • Exception Class Removal: Custom exception classes like JudgmentAPIError, JudgmentRuntimeError, and JudgmentTestError have been removed, likely in favor of standard Java exceptions or a consolidated error handling mechanism.
  • Javadoc and API Enhancements: Javadoc comments have been added or updated for various builder methods and interfaces (Example, ScorerData, ScoringResult, APIScorer, BaseScorer, ISerializer) to improve clarity and usability.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a significant refactoring to deprecate the v0 package structure, which simplifies the overall API and project layout. The changes primarily involve moving files out of versioned packages, removing deprecated classes, and cleaning up the API surface. A notable change is the removal of the judgeval-instrumentation-openai module. While the refactoring is largely well-executed, I've identified two critical issues that need to be addressed. One is a package declaration mismatch that will cause compilation to fail, and the other is a bug in trace evaluation logic that will cause failures when using custom scorers. Please see the detailed comments for suggestions on how to fix these issues.

@@ -1,16 +1,115 @@
package com.judgmentlabs.judgeval;
package com.judgmentlabs.judgeval.v1;

Choose a reason for hiding this comment

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

critical

The package declaration com.judgmentlabs.judgeval.v1 does not match the file's directory structure. Since this file is located at judgeval-java/src/main/java/com/judgmentlabs/judgeval/Judgeval.java, the package should be com.judgmentlabs.judgeval. This mismatch will cause compilation errors.

Suggested change
package com.judgmentlabs.judgeval.v1;
package com.judgmentlabs.judgeval;

Comment on lines +538 to 554
private TraceEvaluationRun createTraceEvaluationRun(BaseScorer scorer, String traceId,
String spanId) {
String evalName = generateRunId("async_trace_evaluate_", spanId);
return new TraceEvaluationRunBuilder()
.projectName(configuration.projectName())
.evalName(evalName)
.model(model)
.trace(traceId, spanId)
.addScorer(scorer)
.build();
}

private static List<List<Object>> convertTraceAndSpanIds(List<List<String>> traceAndSpanIds) {
if (traceAndSpanIds == null || traceAndSpanIds.isEmpty())
throw new IllegalArgumentException("Trace and span IDs are required for trace evaluations.");
List<List<Object>> converted = new java.util.ArrayList<>();
for (List<String> pair : traceAndSpanIds) {
if (pair == null || pair.size() != 2)
throw new IllegalArgumentException("Each trace and span ID pair must contain exactly 2 elements.");
converted.add(List.of(pair.get(0), pair.get(1)));
}
return converted;
TraceEvaluationRun evaluationRun = new TraceEvaluationRun();
evaluationRun.setId(UUID.randomUUID().toString());
evaluationRun.setProjectName(projectName);
evaluationRun.setEvalName(evalName);
evaluationRun.setTraceAndSpanIds(List.of(List.of(traceId, spanId)));
evaluationRun.setJudgmentScorers(List.of(scorer.getScorerConfig()));
evaluationRun.setCustomScorers(List.of());
evaluationRun.setIsOffline(false);
evaluationRun.setIsBucketRun(false);
evaluationRun.setCreatedAt(Instant.now().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));

return evaluationRun;
}

Choose a reason for hiding this comment

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

critical

The createTraceEvaluationRun method does not correctly handle CustomScorer. It unconditionally calls scorer.getScorerConfig(), which throws an UnsupportedOperationException for CustomScorer instances. This will cause asyncTraceEvaluate to fail when used with a custom scorer. You should handle CustomScorer separately, similar to how it's done in createEvaluationRun.

    private TraceEvaluationRun createTraceEvaluationRun(BaseScorer scorer, String traceId,
            String spanId) {
        String evalName = generateRunId("async_trace_evaluate_", spanId);

        TraceEvaluationRun evaluationRun = new TraceEvaluationRun();
        evaluationRun.setId(UUID.randomUUID().toString());
        evaluationRun.setProjectName(projectName);
        evaluationRun.setEvalName(evalName);
        evaluationRun.setTraceAndSpanIds(List.of(List.of(traceId, spanId)));
        if (scorer instanceof CustomScorer) {
            evaluationRun.setJudgmentScorers(List.of());
            evaluationRun.setCustomScorers(List.of((com.judgmentlabs.judgeval.internal.api.models.BaseScorer) scorer));
        } else {
            evaluationRun.setJudgmentScorers(List.of(scorer.getScorerConfig()));
            evaluationRun.setCustomScorers(List.of());
        }
        evaluationRun.setIsOffline(false);
        evaluationRun.setIsBucketRun(false);
        evaluationRun.setCreatedAt(Instant.now().atOffset(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));

        return evaluationRun;
    }

@abhishekg999 abhishekg999 merged commit ff6ff7d into main Nov 12, 2025
1 check passed
@abhishekg999 abhishekg999 deleted the ahh/0.4.0 branch November 12, 2025 01:44
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