-
Notifications
You must be signed in to change notification settings - Fork 241
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into boryst/OPIK-622-dataset-items-include-a-colu…
…mn-named-input-with-non-dictionary-type-values
- Loading branch information
Showing
44 changed files
with
1,272 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
name: "Backend Formatting Check" | ||
run-name: "Backend Formatting Check on ${{ github.ref_name }} by @${{ github.actor }}" | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- "apps/opik-backend/**/*.java" | ||
push: | ||
branches: | ||
- "main" | ||
paths: | ||
- "apps/opik-backend/**/*.java" | ||
|
||
workflow_dispatch: | ||
|
||
jobs: | ||
run-backend-formatting-check: | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
working-directory: apps/opik-backend/ | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: "21" | ||
distribution: "corretto" | ||
cache: maven | ||
|
||
- name: Run Formatting Check for backend | ||
run: mvn clean spotless:check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
apps/opik-backend/src/main/java/com/comet/opik/api/AutomationRuleEvaluatorCriteria.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.comet.opik.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import lombok.Builder; | ||
|
||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record AutomationRuleEvaluatorCriteria( | ||
AutomationRuleEvaluatorType type, | ||
String name, | ||
Set<UUID> ids) { | ||
|
||
public AutomationRule.AutomationRuleAction action() { | ||
return AutomationRule.AutomationRuleAction.EVALUATOR; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
apps/opik-backend/src/main/java/com/comet/opik/api/AutomationRuleEvaluatorLlmAsJudge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package com.comet.opik.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonView; | ||
import dev.langchain4j.data.message.ChatMessageType; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.ToString; | ||
import lombok.experimental.SuperBuilder; | ||
|
||
import java.beans.ConstructorProperties; | ||
import java.time.Instant; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.UUID; | ||
|
||
@EqualsAndHashCode(callSuper = true) | ||
@Data | ||
@SuperBuilder(toBuilder = true) | ||
@ToString(callSuper = true) | ||
public final class AutomationRuleEvaluatorLlmAsJudge | ||
extends | ||
AutomationRuleEvaluator<AutomationRuleEvaluatorLlmAsJudge.LlmAsJudgeCode> { | ||
|
||
@NotNull @JsonView({View.Public.class, View.Write.class}) | ||
@Schema(accessMode = Schema.AccessMode.READ_WRITE) | ||
private LlmAsJudgeCode code; | ||
|
||
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record LlmAsJudgeCode( | ||
@JsonView( { | ||
View.Public.class, View.Write.class}) @NotNull LlmAsJudgeModelParameters model, | ||
@JsonView({View.Public.class, View.Write.class}) @NotNull List<LlmAsJudgeMessage> messages, | ||
@JsonView({View.Public.class, View.Write.class}) @NotNull Map<String, String> variables, | ||
@JsonView({View.Public.class, View.Write.class}) @NotNull List<LlmAsJudgeOutputSchema> schema){ | ||
} | ||
|
||
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record LlmAsJudgeMessage( | ||
@JsonView( { | ||
View.Public.class, View.Write.class}) @NotNull ChatMessageType role, | ||
@JsonView({View.Public.class, View.Write.class}) @NotNull String content){ | ||
} | ||
|
||
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record LlmAsJudgeOutputSchema( | ||
@JsonView( { | ||
View.Public.class, View.Write.class}) @NotNull String name, | ||
@JsonView({View.Public.class, View.Write.class}) @NotNull LlmAsJudgeOutputSchemaType type, | ||
@JsonView({View.Public.class, View.Write.class}) @NotNull String description){ | ||
} | ||
|
||
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
public record LlmAsJudgeModelParameters( | ||
@JsonView( { | ||
View.Public.class, View.Write.class}) @NotNull String name, | ||
@JsonView({View.Public.class, View.Write.class}) @NotNull Double temperature){ | ||
} | ||
|
||
@ConstructorProperties({"id", "projectId", "name", "samplingRate", "code", "createdAt", "createdBy", | ||
"lastUpdatedAt", "lastUpdatedBy"}) | ||
public AutomationRuleEvaluatorLlmAsJudge(UUID id, UUID projectId, @NotBlank String name, Float samplingRate, | ||
@NotNull LlmAsJudgeCode code, | ||
Instant createdAt, String createdBy, Instant lastUpdatedAt, String lastUpdatedBy) { | ||
super(id, projectId, name, samplingRate, createdAt, createdBy, lastUpdatedAt, lastUpdatedBy); | ||
this.code = code; | ||
} | ||
|
||
@Override | ||
public AutomationRuleEvaluatorType type() { | ||
return AutomationRuleEvaluatorType.LLM_AS_JUDGE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
apps/opik-backend/src/main/java/com/comet/opik/api/LlmAsJudgeOutputSchemaType.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.comet.opik.api; | ||
|
||
public enum LlmAsJudgeOutputSchemaType { | ||
BOOLEAN, | ||
INTEGER, | ||
DOUBLE | ||
} |
15 changes: 12 additions & 3 deletions
15
apps/opik-backend/src/main/java/com/comet/opik/api/events/TracesCreated.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
package com.comet.opik.api.events; | ||
|
||
import com.comet.opik.api.Trace; | ||
import com.comet.opik.infrastructure.events.BaseEvent; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import lombok.experimental.Accessors; | ||
|
||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
import java.util.stream.Collectors; | ||
|
||
@Getter | ||
@Accessors(fluent = true) | ||
public class TracesCreated extends BaseEvent { | ||
private final @NonNull Set<UUID> projectIds; | ||
private final @NonNull List<Trace> traces; | ||
|
||
public TracesCreated(@NonNull Set<UUID> projectIds, @NonNull String workspaceId, @NonNull String userName) { | ||
public TracesCreated(@NonNull List<Trace> traces, @NonNull String workspaceId, @NonNull String userName) { | ||
super(workspaceId, userName); | ||
this.projectIds = projectIds; | ||
this.traces = traces; | ||
} | ||
|
||
public Set<UUID> projectIds() { | ||
return traces.stream() | ||
.map(Trace::projectId) | ||
.collect(Collectors.toSet()); | ||
} | ||
} |
Oops, something went wrong.