-
Notifications
You must be signed in to change notification settings - Fork 288
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3df4eb4
commit 18cc509
Showing
5 changed files
with
360 additions
and
12 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
apps/opik-backend/src/main/java/com/comet/opik/api/CreatePromptVersion.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,17 @@ | ||
package com.comet.opik.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonView; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import jakarta.validation.constraints.NotBlank; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
|
||
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public record CreatePromptVersion(@JsonView( { | ||
PromptVersion.View.Detail.class}) @NotBlank String name, | ||
@JsonView({PromptVersion.View.Detail.class}) @NotNull PromptVersion version){ | ||
} |
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
55 changes: 55 additions & 0 deletions
55
apps/opik-backend/src/main/java/com/comet/opik/api/PromptVersion.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,55 @@ | ||
package com.comet.opik.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.annotation.JsonView; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import jakarta.validation.constraints.NotNull; | ||
import lombok.Builder; | ||
|
||
import java.time.Instant; | ||
import java.util.List; | ||
import java.util.Set; | ||
import java.util.UUID; | ||
|
||
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public record PromptVersion( | ||
@JsonView( { | ||
PromptVersion.View.Public.class, | ||
PromptVersion.View.Detail.class}) @Schema(description = "version unique identifier, generated if absent") UUID id, | ||
@JsonView({PromptVersion.View.Public.class, | ||
PromptVersion.View.Detail.class}) @Schema(description = "version short unique identifier, generated if absent") String commit, | ||
@JsonView({PromptVersion.View.Detail.class}) @NotNull String template, | ||
@JsonView({ | ||
PromptVersion.View.Detail.class}) @Schema(accessMode = Schema.AccessMode.READ_ONLY) Set<String> variables, | ||
@JsonView({PromptVersion.View.Public.class, | ||
PromptVersion.View.Detail.class}) @Schema(accessMode = Schema.AccessMode.READ_ONLY) Instant createdAt, | ||
@JsonView({PromptVersion.View.Public.class, | ||
PromptVersion.View.Detail.class}) @Schema(accessMode = Schema.AccessMode.READ_ONLY) String createdBy){ | ||
|
||
public static class View { | ||
public static class Public { | ||
} | ||
|
||
public static class Detail { | ||
} | ||
} | ||
|
||
@Builder | ||
public record PromptVersionPage( | ||
@JsonView( { | ||
PromptVersion.View.Public.class}) int page, | ||
@JsonView({PromptVersion.View.Public.class}) int size, | ||
@JsonView({PromptVersion.View.Public.class}) long total, | ||
@JsonView({PromptVersion.View.Public.class}) List<PromptVersion> content) | ||
implements | ||
Page<PromptVersion>{ | ||
|
||
public static PromptVersion.PromptVersionPage empty(int page) { | ||
return new PromptVersion.PromptVersionPage(page, 0, 0, List.of()); | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
apps/opik-backend/src/main/java/com/comet/opik/api/PromptVersionRetrieve.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,13 @@ | ||
package com.comet.opik.api; | ||
|
||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; | ||
import com.fasterxml.jackson.databind.PropertyNamingStrategies; | ||
import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||
import jakarta.validation.constraints.NotBlank; | ||
import lombok.Builder; | ||
|
||
@Builder(toBuilder = true) | ||
@JsonIgnoreProperties(ignoreUnknown = true) | ||
@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) | ||
public record PromptVersionRetrieve(@NotBlank String name, String commit) { | ||
} |
Oops, something went wrong.