-
Notifications
You must be signed in to change notification settings - Fork 444
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
[OPIK-1377] add guardrails to trace #1736
base: ido/opik-1386-guardrails-ingestion
Are you sure you want to change the base?
[OPIK-1377] add guardrails to trace #1736
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.
We're pending the discussions as well. Some minor guidance on the rest of the implementation.
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public record Item(double score) { |
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.
Minor: let's align the precision with the Guardrails backend, but probably a float
should be enough and more performant (including storage space).
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public record GuardrailTopicDetails(Map<String, Double> scores) { |
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.
Same here.
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public record Item(@NonNull String name, double score) { |
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.
Same about double.
@Schema(accessMode = Schema.AccessMode.READ_ONLY) Instant lastUpdatedAt, | ||
@Schema(accessMode = Schema.AccessMode.READ_ONLY) String createdBy, | ||
@Schema(accessMode = Schema.AccessMode.READ_ONLY) String lastUpdatedBy) { | ||
@NonNull List<Item> items) { |
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.
These items overlap with the model above, but I'd say you need polymorphic types for config
and details
fields here.
@@ -47,6 +47,8 @@ public record Trace( | |||
Trace.View.Public.class}) @Schema(accessMode = Schema.AccessMode.READ_ONLY) List<FeedbackScore> feedbackScores, | |||
@JsonView({ | |||
Trace.View.Public.class}) @Schema(accessMode = Schema.AccessMode.READ_ONLY) List<Comment> comments, | |||
@JsonView({ | |||
Trace.View.Public.class}) @Schema(accessMode = Schema.AccessMode.READ_ONLY) List<GuardrailsCheck> guardrailsChecks, |
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.
Related to the main open discussion: this response model won't be able to return top level fields, only the granular validations. As the Guardrails service is likely the source of truth for that determination, we don't have a way to track it in the opik-backend
.
cb5a88a
to
631b369
Compare
ccec599
to
11378e4
Compare
Details
This PR adds guardrails to the
Trace
object. Served in bothgetTraceById
logic as well asfindTraces
.Issues
OPIK-1377
Testing
Added two E2E tests covering the new logic.