From b0170a1ddbd142f144545c132415e7cc641ecdf1 Mon Sep 17 00:00:00 2001 From: steffen911 Date: Mon, 24 Aug 2026 17:36:01 +0200 Subject: [PATCH] feat!: remove endpoints deprecated in Langfuse v4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Langfuse v4 moves to an observations-first data model, and the endpoints built on the v3 model are deprecated: Langfuse Cloud serves them until November 16, 2026, and self-hosted deployments lose them on upgrade to v4. This prunes them from the generated client so it only exposes the API surface that survives the cutover. Removed entirely (every endpoint deprecated): ingestion POST /ingestion observations GET /observations, /observations/{id} metrics GET /metrics (v1) sessions GET /sessions, /sessions/{id} scorev2 GET /v2/scores, /v2/scores/{id} datasetrunitems POST/GET /dataset-run-items Pruned to the non-deprecated operations: trace dropped get()/list(), kept delete()/deleteMultiple() — trace deletion is not deprecated and is now the documented way to delete experiment data datasets dropped getRun()/deleteRun()/getRuns(), kept the /v2/datasets operations Also drops the 34 types under resources/commons/types that the removal orphaned (the v3-model read models: Trace*, Session*, Observation, ObservationsView, the Score/ScoreV1 unions, DatasetRun*, Usage) and unwires the six clients from LangfuseClient/AsyncLangfuseClient. Orphan status was verified with an import-graph reachability pass and diffed against HEAD so pre-existing orphans stayed out of scope. Score writes are unaffected: POST /scores and DELETE /scores/{scoreId} stay supported after the cutover. Only score reads move to /v3/scores. The README now leads with OpenTelemetry as the recommended and going-forward only supported path for tracing, and documents the per-endpoint migration mapping. It also records that the prune has to be re-applied after each regeneration, since the generator reproduces deprecated endpoints. Co-Authored-By: Claude Opus 5 --- README.md | 47 +- .../langfuse/client/AsyncLangfuseClient.java | 48 - .../com/langfuse/client/LangfuseClient.java | 48 - .../resources/commons/types/BaseScore.java | 937 -------- .../resources/commons/types/BaseScoreV1.java | 728 ------ .../resources/commons/types/BooleanScore.java | 1005 -------- .../commons/types/BooleanScoreV1.java | 794 ------- .../commons/types/CategoricalScore.java | 1005 -------- .../commons/types/CategoricalScoreV1.java | 794 ------- .../commons/types/CorrectionScore.java | 1005 -------- .../resources/commons/types/DatasetRun.java | 427 ---- .../commons/types/DatasetRunItem.java | 343 --- .../commons/types/DatasetRunWithItems.java | 473 ---- .../resources/commons/types/IBaseScore.java | 44 - .../resources/commons/types/IBaseScoreV1.java | 40 - .../commons/types/IBooleanScore.java | 13 - .../commons/types/ICategoricalScore.java | 13 - .../commons/types/ICorrectionScore.java | 13 - .../resources/commons/types/IDatasetRun.java | 28 - .../commons/types/INumericScore.java | 9 - .../resources/commons/types/IObservation.java | 57 - .../resources/commons/types/ISession.java | 18 - .../resources/commons/types/ITrace.java | 39 - .../resources/commons/types/MapValue.java | 145 -- .../resources/commons/types/NumericScore.java | 971 -------- .../commons/types/NumericScoreV1.java | 761 ------ .../resources/commons/types/Observation.java | 1276 ---------- .../commons/types/ObservationsView.java | 2117 ----------------- .../client/resources/commons/types/Score.java | 347 --- .../resources/commons/types/ScoreSource.java | 98 - .../resources/commons/types/ScoreV1.java | 287 --- .../resources/commons/types/Session.java | 209 -- .../commons/types/SessionWithTraces.java | 256 -- .../client/resources/commons/types/Trace.java | 834 ------- .../commons/types/TraceWithDetails.java | 1174 --------- .../commons/types/TraceWithFullDetails.java | 1144 --------- .../client/resources/commons/types/Usage.java | 418 ---- .../AsyncDatasetRunItemsClient.java | 61 - .../AsyncRawDatasetRunItemsClient.java | 211 -- .../DatasetRunItemsClient.java | 59 - .../RawDatasetRunItemsClient.java | 169 -- .../requests/ListDatasetRunItemsRequest.java | 240 -- .../types/CreateDatasetRunItemRequest.java | 373 --- .../types/PaginatedDatasetRunItems.java | 176 -- .../datasets/AsyncDatasetsClient.java | 65 - .../datasets/AsyncRawDatasetsClient.java | 256 -- .../resources/datasets/DatasetsClient.java | 63 - .../resources/datasets/RawDatasetsClient.java | 201 -- .../requests/GetDatasetRunsRequest.java | 155 -- .../types/DeleteDatasetRunResponse.java | 126 - .../datasets/types/PaginatedDatasetRuns.java | 176 -- .../ingestion/AsyncIngestionClient.java | 70 - .../ingestion/AsyncRawIngestionClient.java | 152 -- .../resources/ingestion/IngestionClient.java | 68 - .../ingestion/RawIngestionClient.java | 128 - .../ingestion/requests/IngestionRequest.java | 167 -- .../resources/ingestion/types/BaseEvent.java | 220 -- .../ingestion/types/CreateEventBody.java | 409 ---- .../ingestion/types/CreateEventEvent.java | 242 -- .../ingestion/types/CreateGenerationBody.java | 643 ----- .../types/CreateGenerationEvent.java | 242 -- .../types/CreateObservationEvent.java | 242 -- .../ingestion/types/CreateSpanBody.java | 436 ---- .../ingestion/types/CreateSpanEvent.java | 242 -- .../resources/ingestion/types/IBaseEvent.java | 17 - .../ingestion/types/ICreateEventBody.java | 12 - .../ingestion/types/ICreateSpanBody.java | 12 - .../types/IOptionalObservationBody.java | 35 - .../ingestion/types/IUpdateEventBody.java | 11 - .../ingestion/types/IUpdateSpanBody.java | 12 - .../ingestion/types/IngestionError.java | 213 -- .../ingestion/types/IngestionEvent.java | 707 ------ .../ingestion/types/IngestionResponse.java | 163 -- .../ingestion/types/IngestionSuccess.java | 148 -- .../ingestion/types/IngestionUsage.java | 105 - .../ingestion/types/ObservationBody.java | 666 ------ .../ingestion/types/ObservationType.java | 168 -- .../types/OpenAiCompletionUsageSchema.java | 241 -- .../types/OpenAiResponseUsageSchema.java | 239 -- .../ingestion/types/OpenAiUsage.java | 168 -- .../types/OptionalObservationBody.java | 383 --- .../resources/ingestion/types/ScoreBody.java | 558 ----- .../resources/ingestion/types/ScoreEvent.java | 242 -- .../resources/ingestion/types/SdkLogBody.java | 125 - .../ingestion/types/SdkLogEvent.java | 242 -- .../resources/ingestion/types/TraceBody.java | 429 ---- .../resources/ingestion/types/TraceEvent.java | 242 -- .../ingestion/types/UpdateEventBody.java | 487 ---- .../ingestion/types/UpdateGenerationBody.java | 775 ------ .../types/UpdateGenerationEvent.java | 242 -- .../types/UpdateObservationEvent.java | 242 -- .../ingestion/types/UpdateSpanBody.java | 520 ---- .../ingestion/types/UpdateSpanEvent.java | 242 -- .../ingestion/types/UsageDetails.java | 119 - .../resources/metrics/AsyncMetricsClient.java | 48 - .../metrics/AsyncRawMetricsClient.java | 122 - .../resources/metrics/MetricsClient.java | 46 - .../resources/metrics/RawMetricsClient.java | 98 - .../metrics/requests/GetMetricsRequest.java | 293 --- .../metrics/types/MetricsResponse.java | 138 -- .../observations/AsyncObservationsClient.java | 79 - .../AsyncRawObservationsClient.java | 250 -- .../observations/ObservationsClient.java | 76 - .../observations/RawObservationsClient.java | 207 -- .../requests/GetObservationsRequest.java | 476 ---- .../observations/types/Observations.java | 176 -- .../observations/types/ObservationsViews.java | 176 -- .../scorev2/AsyncRawScoreV2Client.java | 270 --- .../resources/scorev2/AsyncScoreV2Client.java | 74 - .../resources/scorev2/RawScoreV2Client.java | 227 -- .../resources/scorev2/ScoreV2Client.java | 72 - .../scorev2/requests/GetScoresRequest.java | 766 ------ .../scorev2/types/GetScoresResponse.java | 175 -- .../scorev2/types/GetScoresResponseData.java | 347 --- .../types/GetScoresResponseDataBoolean.java | 1040 -------- .../GetScoresResponseDataCategorical.java | 1040 -------- .../GetScoresResponseDataCorrection.java | 1040 -------- .../types/GetScoresResponseDataNumeric.java | 1005 -------- .../types/GetScoresResponseTraceData.java | 186 -- .../sessions/AsyncRawSessionsClient.java | 222 -- .../sessions/AsyncSessionsClient.java | 74 - .../resources/sessions/RawSessionsClient.java | 179 -- .../resources/sessions/SessionsClient.java | 72 - .../sessions/requests/GetSessionsRequest.java | 257 -- .../sessions/types/PaginatedSessions.java | 176 -- .../resources/trace/AsyncRawTraceClient.java | 208 -- .../resources/trace/AsyncTraceClient.java | 46 - .../resources/trace/RawTraceClient.java | 221 +- .../client/resources/trace/TraceClient.java | 45 - .../trace/requests/GetTracesRequest.java | 526 ---- .../client/resources/trace/types/Sort.java | 126 - .../client/resources/trace/types/Traces.java | 176 -- 132 files changed, 68 insertions(+), 42009 deletions(-) delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/BaseScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/BaseScoreV1.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/BooleanScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/BooleanScoreV1.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/CategoricalScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/CategoricalScoreV1.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/CorrectionScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/DatasetRun.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/DatasetRunItem.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/DatasetRunWithItems.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/IBaseScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/IBaseScoreV1.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/IBooleanScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/ICategoricalScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/ICorrectionScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/IDatasetRun.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/INumericScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/IObservation.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/ISession.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/ITrace.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/MapValue.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/NumericScore.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/NumericScoreV1.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/Observation.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/ObservationsView.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/Score.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/ScoreSource.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/ScoreV1.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/Session.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/SessionWithTraces.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/Trace.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/TraceWithDetails.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/TraceWithFullDetails.java delete mode 100644 src/main/java/com/langfuse/client/resources/commons/types/Usage.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasetrunitems/AsyncDatasetRunItemsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasetrunitems/AsyncRawDatasetRunItemsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasetrunitems/DatasetRunItemsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasetrunitems/RawDatasetRunItemsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasetrunitems/requests/ListDatasetRunItemsRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasetrunitems/types/CreateDatasetRunItemRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasetrunitems/types/PaginatedDatasetRunItems.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasets/requests/GetDatasetRunsRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasets/types/DeleteDatasetRunResponse.java delete mode 100644 src/main/java/com/langfuse/client/resources/datasets/types/PaginatedDatasetRuns.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/AsyncIngestionClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/AsyncRawIngestionClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/IngestionClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/RawIngestionClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/requests/IngestionRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/BaseEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/CreateEventBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/CreateEventEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/CreateGenerationBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/CreateGenerationEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/CreateObservationEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/CreateSpanBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/CreateSpanEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IBaseEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/ICreateEventBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/ICreateSpanBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IOptionalObservationBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IUpdateEventBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IUpdateSpanBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IngestionError.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IngestionEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IngestionResponse.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IngestionSuccess.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/IngestionUsage.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/ObservationBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/ObservationType.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiCompletionUsageSchema.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiResponseUsageSchema.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiUsage.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/OptionalObservationBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/ScoreBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/ScoreEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/SdkLogBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/SdkLogEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/TraceBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/TraceEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/UpdateEventBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/UpdateGenerationBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/UpdateGenerationEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/UpdateObservationEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/UpdateSpanBody.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/UpdateSpanEvent.java delete mode 100644 src/main/java/com/langfuse/client/resources/ingestion/types/UsageDetails.java delete mode 100644 src/main/java/com/langfuse/client/resources/metrics/AsyncMetricsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/metrics/AsyncRawMetricsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/metrics/MetricsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/metrics/RawMetricsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/metrics/requests/GetMetricsRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/metrics/types/MetricsResponse.java delete mode 100644 src/main/java/com/langfuse/client/resources/observations/AsyncObservationsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/observations/AsyncRawObservationsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/observations/ObservationsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/observations/RawObservationsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/observations/requests/GetObservationsRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/observations/types/Observations.java delete mode 100644 src/main/java/com/langfuse/client/resources/observations/types/ObservationsViews.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/AsyncRawScoreV2Client.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/AsyncScoreV2Client.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/RawScoreV2Client.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/ScoreV2Client.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/requests/GetScoresRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponse.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseData.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataBoolean.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataCategorical.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataCorrection.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataNumeric.java delete mode 100644 src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseTraceData.java delete mode 100644 src/main/java/com/langfuse/client/resources/sessions/AsyncRawSessionsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/sessions/AsyncSessionsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/sessions/RawSessionsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/sessions/SessionsClient.java delete mode 100644 src/main/java/com/langfuse/client/resources/sessions/requests/GetSessionsRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/sessions/types/PaginatedSessions.java delete mode 100644 src/main/java/com/langfuse/client/resources/trace/requests/GetTracesRequest.java delete mode 100644 src/main/java/com/langfuse/client/resources/trace/types/Sort.java delete mode 100644 src/main/java/com/langfuse/client/resources/trace/types/Traces.java diff --git a/README.md b/README.md index 8e8123a..62c9024 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,23 @@ This repository contains an auto-generated Langfuse API client for Java based on our [API specification](https://github.com/langfuse/langfuse/tree/main/fern/apis/server). See the [Langfuse API reference](https://api.reference.langfuse.com) for more details on the available endpoints. -**Note:** We recommend to solve tracing via the [OpenTelemetry Instrumentation](https://langfuse.com/docs/opentelemetry/get-started) instead of using the Ingestion API directly. You can use the [OpenTelemetry Java SDK](https://github.com/open-telemetry/opentelemetry-java) and export spans to the [Langfuse OTel endpoint](https://langfuse.com/integrations/native/opentelemetry). -This allows for a more detailed and standardized tracing experience without the need to handle batching and updates internally. -Check out our [Spring AI Example](https://langfuse.com/docs/integrations/spring-ai) for more details. +## Use OpenTelemetry for tracing + +**OpenTelemetry is the recommended — and, going forward, the only supported — way to send tracing data to Langfuse from Java.** +This client no longer exposes the legacy ingestion API; it is deprecated and is removed in [Langfuse v4](https://langfuse.com/docs/v4). + +Instrument your application with the [OpenTelemetry Java SDK](https://github.com/open-telemetry/opentelemetry-java) and export spans over OTLP/HTTP to the [Langfuse OTel endpoint](https://langfuse.com/integrations/native/opentelemetry): + +```bash +OTEL_EXPORTER_OTLP_ENDPOINT="https://cloud.langfuse.com/api/public/otel" +OTEL_EXPORTER_OTLP_HEADERS="Authorization=Basic ${AUTH_STRING},x-langfuse-ingestion-version=4" +``` + +The `x-langfuse-ingestion-version: 4` header selects the v4 ingestion path. It is not sufficient on its own — spans also have to follow the v4 span format. Read [Migrate custom ingestion to Langfuse v4](https://langfuse.com/integrations/native/opentelemetry/migration-to-v4) before switching production traffic; it covers the [v4-ready checklist](https://langfuse.com/integrations/native/opentelemetry/migration-to-v4#v4-ready-ingestion-checklist), the [legacy event → OTel span mapping](https://langfuse.com/integrations/native/opentelemetry/migration-to-v4#migrate-from-the-legacy-ingestion-api), and [propagating trace context to every observation](https://langfuse.com/integrations/native/opentelemetry/migration-to-v4#propagate-trace-context-to-observations). + +Going through OpenTelemetry also means you do not have to handle batching, retries, or observation updates yourself. Check out our [Spring AI example](https://langfuse.com/integrations/frameworks/spring-ai) for a full setup. + +Use this client for everything that is *not* tracing ingestion: prompts, datasets, scores, models, comments, annotation queues, and the reading APIs. ## Installation @@ -50,6 +64,30 @@ try { } ``` +## Langfuse v4: removed endpoints + +Langfuse v4 uses an [observations-first data model](https://langfuse.com/docs/v4). The endpoints built on the v3 model are deprecated: Langfuse Cloud serves them until **November 16, 2026**, and they become unavailable in self-hosted deployments as soon as those upgrade to v4. + +Those endpoints have been **removed from this client** so that it only exposes the API surface that survives the v4 cutover. The canonical, per-endpoint migration reference is [Migration of deprecated APIs](https://langfuse.com/faq/all/deprecated-api-migration); the [Versions & Compatibility matrix](https://langfuse.com/docs/compatibility) lists which endpoints work against which server version, and [Make your project ready for the upgrade to Langfuse v4](https://langfuse.com/faq/all/upgrade-to-langfuse-v4) is the step-by-step upgrade guide. + +| Removed from this client | Deprecated endpoint | Replacement | +| --------------------------------------------------------------------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `client.ingestion().batch(...)` | `POST /api/public/ingestion` | [OpenTelemetry ingestion](https://langfuse.com/faq/all/deprecated-api-migration#ingestion) — see above | +| `client.observations().get(...)` / `.getMany(...)` | `GET /api/public/observations`, `/observations/{id}` | `client.observationsV2().getMany(...)` ([Observations API v2](https://langfuse.com/faq/all/deprecated-api-migration#observations)) | +| `client.trace().get(...)` / `.list(...)` | `GET /api/public/traces`, `/traces/{id}` | `client.observationsV2().getMany(...)` filtered by `traceId` ([Traces](https://langfuse.com/faq/all/deprecated-api-migration#traces)) | +| `client.sessions().get(...)` / `.list(...)` | `GET /api/public/sessions`, `/sessions/{id}` | `client.observationsV2().getMany(...)` filtered by `sessionId` ([Sessions](https://langfuse.com/faq/all/deprecated-api-migration#sessions)) | +| `client.metrics().metrics(...)` | `GET /api/public/metrics` | `client.metricsV2().metrics(...)` ([Metrics API v2](https://langfuse.com/faq/all/deprecated-api-migration#metrics)) | +| `client.scoreV2().get(...)` / `.getById(...)` | `GET /api/public/v2/scores`, `/v2/scores/{id}` | [Scores API v3](https://langfuse.com/faq/all/deprecated-api-migration#scores) — **not generated yet**, call `GET /api/public/v3/scores` directly for now | +| `client.datasets().getRuns(...)` / `.getRun(...)` / `.deleteRun(...)` | `GET`/`DELETE /api/public/datasets/{name}/runs[/{runName}]` | [Experiments API](https://langfuse.com/faq/all/deprecated-api-migration#dataset-runs) — **not generated yet**, call `GET /api/public/experiments` directly for now | +| `client.datasetRunItems().create(...)` / `.list(...)` | `POST`/`GET /api/public/dataset-run-items` | [Experiment Items API](https://langfuse.com/faq/all/deprecated-api-migration#dataset-runs) / OTel experiment attributes — **not generated yet** | + +Notes: + +- **Score writes are unaffected.** `client.score().create(...)` (`POST /api/public/scores`) and `client.score().delete(...)` stay supported after the v4 cutover. Only score *reads* move to v3. +- **Trace deletion is not deprecated.** `client.trace().delete(...)` and `client.trace().deleteMultiple(...)` are kept; they are also how you delete experiment data now that `DELETE /datasets/{name}/runs/{runName}` is gone. +- **Datasets themselves are not deprecated.** `client.datasets()` still exposes the `/api/public/v2/datasets` endpoints; only the dataset *run* endpoints were removed. +- The `/api/public/v3/scores`, `/api/public/experiments`, and `/api/public/experiment-items` endpoints exist in the Langfuse API but are not part of this client yet. They will be picked up by the next regeneration; until then, call them directly. + ## Testing ### Unit tests @@ -117,4 +155,5 @@ To publish to Maven Central, you need to configure the following secrets in your 4. Manually set the `package` across all files to `com.langfuse.client`. 5. Verify that `LangfuseClientBuilder.setAuthentication()` uses `Basic` auth (not `Bearer`). 6. Adjust Javadoc strings with HTML properties as the apidocs package does not support them. -7. Commit the changes in langfuse-java and push them to the repository. +7. Re-apply the deprecated-endpoint prune. Regeneration reintroduces every endpoint marked `availability: status: deprecated` in the API definition — the ones listed under [Langfuse v4: removed endpoints](#langfuse-v4-removed-endpoints). Drop those resource packages and methods again, remove the now-orphaned types under `resources/commons/types`, and unwire them from `LangfuseClient`/`AsyncLangfuseClient`. +8. Commit the changes in langfuse-java and push them to the repository. diff --git a/src/main/java/com/langfuse/client/AsyncLangfuseClient.java b/src/main/java/com/langfuse/client/AsyncLangfuseClient.java index bde0858..f95265c 100644 --- a/src/main/java/com/langfuse/client/AsyncLangfuseClient.java +++ b/src/main/java/com/langfuse/client/AsyncLangfuseClient.java @@ -9,16 +9,12 @@ import com.langfuse.client.resources.blobstorageintegrations.AsyncBlobStorageIntegrationsClient; import com.langfuse.client.resources.comments.AsyncCommentsClient; import com.langfuse.client.resources.datasetitems.AsyncDatasetItemsClient; -import com.langfuse.client.resources.datasetrunitems.AsyncDatasetRunItemsClient; import com.langfuse.client.resources.datasets.AsyncDatasetsClient; import com.langfuse.client.resources.health.AsyncHealthClient; -import com.langfuse.client.resources.ingestion.AsyncIngestionClient; import com.langfuse.client.resources.llmconnections.AsyncLlmConnectionsClient; import com.langfuse.client.resources.media.AsyncMediaClient; -import com.langfuse.client.resources.metrics.AsyncMetricsClient; import com.langfuse.client.resources.metricsv2.AsyncMetricsV2Client; import com.langfuse.client.resources.models.AsyncModelsClient; -import com.langfuse.client.resources.observations.AsyncObservationsClient; import com.langfuse.client.resources.observationsv2.AsyncObservationsV2Client; import com.langfuse.client.resources.opentelemetry.AsyncOpentelemetryClient; import com.langfuse.client.resources.organizations.AsyncOrganizationsClient; @@ -28,8 +24,6 @@ import com.langfuse.client.resources.scim.AsyncScimClient; import com.langfuse.client.resources.score.AsyncScoreClient; import com.langfuse.client.resources.scoreconfigs.AsyncScoreConfigsClient; -import com.langfuse.client.resources.scorev2.AsyncScoreV2Client; -import com.langfuse.client.resources.sessions.AsyncSessionsClient; import com.langfuse.client.resources.trace.AsyncTraceClient; public class AsyncLangfuseClient { @@ -43,28 +37,20 @@ public class AsyncLangfuseClient { protected final Supplier datasetItemsClient; - protected final Supplier datasetRunItemsClient; - protected final Supplier datasetsClient; protected final Supplier healthClient; - protected final Supplier ingestionClient; - protected final Supplier llmConnectionsClient; protected final Supplier mediaClient; protected final Supplier metricsV2Client; - protected final Supplier metricsClient; - protected final Supplier modelsClient; protected final Supplier observationsV2Client; - protected final Supplier observationsClient; - protected final Supplier opentelemetryClient; protected final Supplier organizationsClient; @@ -79,12 +65,8 @@ public class AsyncLangfuseClient { protected final Supplier scoreConfigsClient; - protected final Supplier scoreV2Client; - protected final Supplier scoreClient; - protected final Supplier sessionsClient; - protected final Supplier traceClient; public AsyncLangfuseClient(ClientOptions clientOptions) { @@ -93,17 +75,13 @@ public AsyncLangfuseClient(ClientOptions clientOptions) { this.blobStorageIntegrationsClient = Suppliers.memoize(() -> new AsyncBlobStorageIntegrationsClient(clientOptions)); this.commentsClient = Suppliers.memoize(() -> new AsyncCommentsClient(clientOptions)); this.datasetItemsClient = Suppliers.memoize(() -> new AsyncDatasetItemsClient(clientOptions)); - this.datasetRunItemsClient = Suppliers.memoize(() -> new AsyncDatasetRunItemsClient(clientOptions)); this.datasetsClient = Suppliers.memoize(() -> new AsyncDatasetsClient(clientOptions)); this.healthClient = Suppliers.memoize(() -> new AsyncHealthClient(clientOptions)); - this.ingestionClient = Suppliers.memoize(() -> new AsyncIngestionClient(clientOptions)); this.llmConnectionsClient = Suppliers.memoize(() -> new AsyncLlmConnectionsClient(clientOptions)); this.mediaClient = Suppliers.memoize(() -> new AsyncMediaClient(clientOptions)); this.metricsV2Client = Suppliers.memoize(() -> new AsyncMetricsV2Client(clientOptions)); - this.metricsClient = Suppliers.memoize(() -> new AsyncMetricsClient(clientOptions)); this.modelsClient = Suppliers.memoize(() -> new AsyncModelsClient(clientOptions)); this.observationsV2Client = Suppliers.memoize(() -> new AsyncObservationsV2Client(clientOptions)); - this.observationsClient = Suppliers.memoize(() -> new AsyncObservationsClient(clientOptions)); this.opentelemetryClient = Suppliers.memoize(() -> new AsyncOpentelemetryClient(clientOptions)); this.organizationsClient = Suppliers.memoize(() -> new AsyncOrganizationsClient(clientOptions)); this.projectsClient = Suppliers.memoize(() -> new AsyncProjectsClient(clientOptions)); @@ -111,9 +89,7 @@ public AsyncLangfuseClient(ClientOptions clientOptions) { this.promptsClient = Suppliers.memoize(() -> new AsyncPromptsClient(clientOptions)); this.scimClient = Suppliers.memoize(() -> new AsyncScimClient(clientOptions)); this.scoreConfigsClient = Suppliers.memoize(() -> new AsyncScoreConfigsClient(clientOptions)); - this.scoreV2Client = Suppliers.memoize(() -> new AsyncScoreV2Client(clientOptions)); this.scoreClient = Suppliers.memoize(() -> new AsyncScoreClient(clientOptions)); - this.sessionsClient = Suppliers.memoize(() -> new AsyncSessionsClient(clientOptions)); this.traceClient = Suppliers.memoize(() -> new AsyncTraceClient(clientOptions)); } @@ -133,10 +109,6 @@ public AsyncDatasetItemsClient datasetItems() { return this.datasetItemsClient.get(); } - public AsyncDatasetRunItemsClient datasetRunItems() { - return this.datasetRunItemsClient.get(); - } - public AsyncDatasetsClient datasets() { return this.datasetsClient.get(); } @@ -145,10 +117,6 @@ public AsyncHealthClient health() { return this.healthClient.get(); } - public AsyncIngestionClient ingestion() { - return this.ingestionClient.get(); - } - public AsyncLlmConnectionsClient llmConnections() { return this.llmConnectionsClient.get(); } @@ -161,10 +129,6 @@ public AsyncMetricsV2Client metricsV2() { return this.metricsV2Client.get(); } - public AsyncMetricsClient metrics() { - return this.metricsClient.get(); - } - public AsyncModelsClient models() { return this.modelsClient.get(); } @@ -173,10 +137,6 @@ public AsyncObservationsV2Client observationsV2() { return this.observationsV2Client.get(); } - public AsyncObservationsClient observations() { - return this.observationsClient.get(); - } - public AsyncOpentelemetryClient opentelemetry() { return this.opentelemetryClient.get(); } @@ -205,18 +165,10 @@ public AsyncScoreConfigsClient scoreConfigs() { return this.scoreConfigsClient.get(); } - public AsyncScoreV2Client scoreV2() { - return this.scoreV2Client.get(); - } - public AsyncScoreClient score() { return this.scoreClient.get(); } - public AsyncSessionsClient sessions() { - return this.sessionsClient.get(); - } - public AsyncTraceClient trace() { return this.traceClient.get(); } diff --git a/src/main/java/com/langfuse/client/LangfuseClient.java b/src/main/java/com/langfuse/client/LangfuseClient.java index 111d370..f378e7c 100644 --- a/src/main/java/com/langfuse/client/LangfuseClient.java +++ b/src/main/java/com/langfuse/client/LangfuseClient.java @@ -11,16 +11,12 @@ import com.langfuse.client.resources.blobstorageintegrations.BlobStorageIntegrationsClient; import com.langfuse.client.resources.comments.CommentsClient; import com.langfuse.client.resources.datasetitems.DatasetItemsClient; -import com.langfuse.client.resources.datasetrunitems.DatasetRunItemsClient; import com.langfuse.client.resources.datasets.DatasetsClient; import com.langfuse.client.resources.health.HealthClient; -import com.langfuse.client.resources.ingestion.IngestionClient; import com.langfuse.client.resources.llmconnections.LlmConnectionsClient; import com.langfuse.client.resources.media.MediaClient; -import com.langfuse.client.resources.metrics.MetricsClient; import com.langfuse.client.resources.metricsv2.MetricsV2Client; import com.langfuse.client.resources.models.ModelsClient; -import com.langfuse.client.resources.observations.ObservationsClient; import com.langfuse.client.resources.observationsv2.ObservationsV2Client; import com.langfuse.client.resources.opentelemetry.OpentelemetryClient; import com.langfuse.client.resources.organizations.OrganizationsClient; @@ -30,8 +26,6 @@ import com.langfuse.client.resources.scim.ScimClient; import com.langfuse.client.resources.score.ScoreClient; import com.langfuse.client.resources.scoreconfigs.ScoreConfigsClient; -import com.langfuse.client.resources.scorev2.ScoreV2Client; -import com.langfuse.client.resources.sessions.SessionsClient; import com.langfuse.client.resources.trace.TraceClient; public class LangfuseClient { @@ -45,28 +39,20 @@ public class LangfuseClient { protected final Supplier datasetItemsClient; - protected final Supplier datasetRunItemsClient; - protected final Supplier datasetsClient; protected final Supplier healthClient; - protected final Supplier ingestionClient; - protected final Supplier llmConnectionsClient; protected final Supplier mediaClient; protected final Supplier metricsV2Client; - protected final Supplier metricsClient; - protected final Supplier modelsClient; protected final Supplier observationsV2Client; - protected final Supplier observationsClient; - protected final Supplier opentelemetryClient; protected final Supplier organizationsClient; @@ -81,12 +67,8 @@ public class LangfuseClient { protected final Supplier scoreConfigsClient; - protected final Supplier scoreV2Client; - protected final Supplier scoreClient; - protected final Supplier sessionsClient; - protected final Supplier traceClient; public LangfuseClient(ClientOptions clientOptions) { @@ -95,17 +77,13 @@ public LangfuseClient(ClientOptions clientOptions) { this.blobStorageIntegrationsClient = Suppliers.memoize(() -> new BlobStorageIntegrationsClient(clientOptions)); this.commentsClient = Suppliers.memoize(() -> new CommentsClient(clientOptions)); this.datasetItemsClient = Suppliers.memoize(() -> new DatasetItemsClient(clientOptions)); - this.datasetRunItemsClient = Suppliers.memoize(() -> new DatasetRunItemsClient(clientOptions)); this.datasetsClient = Suppliers.memoize(() -> new DatasetsClient(clientOptions)); this.healthClient = Suppliers.memoize(() -> new HealthClient(clientOptions)); - this.ingestionClient = Suppliers.memoize(() -> new IngestionClient(clientOptions)); this.llmConnectionsClient = Suppliers.memoize(() -> new LlmConnectionsClient(clientOptions)); this.mediaClient = Suppliers.memoize(() -> new MediaClient(clientOptions)); this.metricsV2Client = Suppliers.memoize(() -> new MetricsV2Client(clientOptions)); - this.metricsClient = Suppliers.memoize(() -> new MetricsClient(clientOptions)); this.modelsClient = Suppliers.memoize(() -> new ModelsClient(clientOptions)); this.observationsV2Client = Suppliers.memoize(() -> new ObservationsV2Client(clientOptions)); - this.observationsClient = Suppliers.memoize(() -> new ObservationsClient(clientOptions)); this.opentelemetryClient = Suppliers.memoize(() -> new OpentelemetryClient(clientOptions)); this.organizationsClient = Suppliers.memoize(() -> new OrganizationsClient(clientOptions)); this.projectsClient = Suppliers.memoize(() -> new ProjectsClient(clientOptions)); @@ -113,9 +91,7 @@ public LangfuseClient(ClientOptions clientOptions) { this.promptsClient = Suppliers.memoize(() -> new PromptsClient(clientOptions)); this.scimClient = Suppliers.memoize(() -> new ScimClient(clientOptions)); this.scoreConfigsClient = Suppliers.memoize(() -> new ScoreConfigsClient(clientOptions)); - this.scoreV2Client = Suppliers.memoize(() -> new ScoreV2Client(clientOptions)); this.scoreClient = Suppliers.memoize(() -> new ScoreClient(clientOptions)); - this.sessionsClient = Suppliers.memoize(() -> new SessionsClient(clientOptions)); this.traceClient = Suppliers.memoize(() -> new TraceClient(clientOptions)); } @@ -135,10 +111,6 @@ public DatasetItemsClient datasetItems() { return this.datasetItemsClient.get(); } - public DatasetRunItemsClient datasetRunItems() { - return this.datasetRunItemsClient.get(); - } - public DatasetsClient datasets() { return this.datasetsClient.get(); } @@ -147,10 +119,6 @@ public HealthClient health() { return this.healthClient.get(); } - public IngestionClient ingestion() { - return this.ingestionClient.get(); - } - public LlmConnectionsClient llmConnections() { return this.llmConnectionsClient.get(); } @@ -163,10 +131,6 @@ public MetricsV2Client metricsV2() { return this.metricsV2Client.get(); } - public MetricsClient metrics() { - return this.metricsClient.get(); - } - public ModelsClient models() { return this.modelsClient.get(); } @@ -175,10 +139,6 @@ public ObservationsV2Client observationsV2() { return this.observationsV2Client.get(); } - public ObservationsClient observations() { - return this.observationsClient.get(); - } - public OpentelemetryClient opentelemetry() { return this.opentelemetryClient.get(); } @@ -207,18 +167,10 @@ public ScoreConfigsClient scoreConfigs() { return this.scoreConfigsClient.get(); } - public ScoreV2Client scoreV2() { - return this.scoreV2Client.get(); - } - public ScoreClient score() { return this.scoreClient.get(); } - public SessionsClient sessions() { - return this.sessionsClient.get(); - } - public TraceClient trace() { return this.traceClient.get(); } diff --git a/src/main/java/com/langfuse/client/resources/commons/types/BaseScore.java b/src/main/java/com/langfuse/client/resources/commons/types/BaseScore.java deleted file mode 100644 index 6f131c4..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/BaseScore.java +++ /dev/null @@ -1,937 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = BaseScore.Builder.class -) -public final class BaseScore implements IBaseScore { - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Map additionalProperties; - - private BaseScore(String id, Optional traceId, Optional sessionId, - Optional observationId, Optional datasetRunId, String name, - ScoreSource source, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BaseScore && equalTo((BaseScore) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BaseScore other) { - return id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - NameStage id(@NotNull String id); - - Builder from(BaseScore other); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - BaseScore build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(BaseScore other) { - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public BaseScore build() { - return new BaseScore(id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/BaseScoreV1.java b/src/main/java/com/langfuse/client/resources/commons/types/BaseScoreV1.java deleted file mode 100644 index 84d6f0a..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/BaseScoreV1.java +++ /dev/null @@ -1,728 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = BaseScoreV1.Builder.class -) -public final class BaseScoreV1 implements IBaseScoreV1 { - private final String id; - - private final String traceId; - - private final String name; - - private final ScoreSource source; - - private final Optional observationId; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Map additionalProperties; - - private BaseScoreV1(String id, String traceId, String name, ScoreSource source, - Optional observationId, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.name = name; - this.source = source; - this.observationId = observationId; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public String getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BaseScoreV1 && equalTo((BaseScoreV1) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BaseScoreV1 other) { - return id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && source.equals(other.source) && observationId.equals(other.observationId) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.name, this.source, this.observationId, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - TraceIdStage id(@NotNull String id); - - Builder from(BaseScoreV1 other); - } - - public interface TraceIdStage { - NameStage traceId(@NotNull String traceId); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - BaseScoreV1 build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TraceIdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private String id; - - private String traceId; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(BaseScoreV1 other) { - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - source(other.getSource()); - observationId(other.getObservationId()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public TraceIdStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("traceId") - public NameStage traceId(@NotNull String traceId) { - this.traceId = Objects.requireNonNull(traceId, "traceId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - @java.lang.Override - public BaseScoreV1 build() { - return new BaseScoreV1(id, traceId, name, source, observationId, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/BooleanScore.java b/src/main/java/com/langfuse/client/resources/commons/types/BooleanScore.java deleted file mode 100644 index 3d5a9f3..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/BooleanScore.java +++ /dev/null @@ -1,1005 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = BooleanScore.Builder.class -) -public final class BooleanScore implements IBooleanScore, IBaseScore { - private final double value; - - private final String stringValue; - - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Map additionalProperties; - - private BooleanScore(double value, String stringValue, String id, Optional traceId, - Optional sessionId, Optional observationId, Optional datasetRunId, - String name, ScoreSource source, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - Map additionalProperties) { - this.value = value; - this.stringValue = stringValue; - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - /** - * @return The numeric value of the score. Equals 1 for "True" and 0 for "False" - */ - @JsonProperty("value") - @java.lang.Override - public double getValue() { - return value; - } - - /** - * @return The string representation of the score value. Is inferred from the numeric value and equals "True" or "False" - */ - @JsonProperty("stringValue") - @java.lang.Override - public String getStringValue() { - return stringValue; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanScore && equalTo((BooleanScore) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BooleanScore other) { - return value == other.value && stringValue.equals(other.stringValue) && id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value, this.stringValue, this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - /** - *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- */ - StringValueStage value(double value); - - Builder from(BooleanScore other); - } - - public interface StringValueStage { - /** - *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- */ - IdStage stringValue(@NotNull String stringValue); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - BooleanScore build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements ValueStage, StringValueStage, IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private double value; - - private String stringValue; - - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(BooleanScore other) { - value(other.getValue()); - stringValue(other.getStringValue()); - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - return this; - } - - /** - *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public StringValueStage value(double value) { - this.value = value; - return this; - } - - /** - *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("stringValue") - public IdStage stringValue(@NotNull String stringValue) { - this.stringValue = Objects.requireNonNull(stringValue, "stringValue must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public BooleanScore build() { - return new BooleanScore(value, stringValue, id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/BooleanScoreV1.java b/src/main/java/com/langfuse/client/resources/commons/types/BooleanScoreV1.java deleted file mode 100644 index 58a9625..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/BooleanScoreV1.java +++ /dev/null @@ -1,794 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = BooleanScoreV1.Builder.class -) -public final class BooleanScoreV1 implements IBaseScoreV1 { - private final String id; - - private final String traceId; - - private final String name; - - private final ScoreSource source; - - private final Optional observationId; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final double value; - - private final String stringValue; - - private final Map additionalProperties; - - private BooleanScoreV1(String id, String traceId, String name, ScoreSource source, - Optional observationId, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - double value, String stringValue, Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.name = name; - this.source = source; - this.observationId = observationId; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.value = value; - this.stringValue = stringValue; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public String getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - /** - * @return The numeric value of the score. Equals 1 for "True" and 0 for "False" - */ - @JsonProperty("value") - public double getValue() { - return value; - } - - /** - * @return The string representation of the score value. Is inferred from the numeric value and equals "True" or "False" - */ - @JsonProperty("stringValue") - public String getStringValue() { - return stringValue; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanScoreV1 && equalTo((BooleanScoreV1) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BooleanScoreV1 other) { - return id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && source.equals(other.source) && observationId.equals(other.observationId) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment) && value == other.value && stringValue.equals(other.stringValue); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.name, this.source, this.observationId, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment, this.value, this.stringValue); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - TraceIdStage id(@NotNull String id); - - Builder from(BooleanScoreV1 other); - } - - public interface TraceIdStage { - NameStage traceId(@NotNull String traceId); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - ValueStage environment(@NotNull String environment); - } - - public interface ValueStage { - /** - *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- */ - StringValueStage value(double value); - } - - public interface StringValueStage { - /** - *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- */ - _FinalStage stringValue(@NotNull String stringValue); - } - - public interface _FinalStage { - BooleanScoreV1 build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TraceIdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, ValueStage, StringValueStage, _FinalStage { - private String id; - - private String traceId; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private double value; - - private String stringValue; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(BooleanScoreV1 other) { - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - source(other.getSource()); - observationId(other.getObservationId()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - value(other.getValue()); - stringValue(other.getStringValue()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public TraceIdStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("traceId") - public NameStage traceId(@NotNull String traceId) { - this.traceId = Objects.requireNonNull(traceId, "traceId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public ValueStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public StringValueStage value(double value) { - this.value = value; - return this; - } - - /** - *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("stringValue") - public _FinalStage stringValue(@NotNull String stringValue) { - this.stringValue = Objects.requireNonNull(stringValue, "stringValue must not be null"); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - @java.lang.Override - public BooleanScoreV1 build() { - return new BooleanScoreV1(id, traceId, name, source, observationId, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, value, stringValue, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/CategoricalScore.java b/src/main/java/com/langfuse/client/resources/commons/types/CategoricalScore.java deleted file mode 100644 index acb89cc..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/CategoricalScore.java +++ /dev/null @@ -1,1005 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CategoricalScore.Builder.class -) -public final class CategoricalScore implements ICategoricalScore, IBaseScore { - private final double value; - - private final String stringValue; - - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Map additionalProperties; - - private CategoricalScore(double value, String stringValue, String id, Optional traceId, - Optional sessionId, Optional observationId, Optional datasetRunId, - String name, ScoreSource source, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - Map additionalProperties) { - this.value = value; - this.stringValue = stringValue; - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - /** - * @return Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0. - */ - @JsonProperty("value") - @java.lang.Override - public double getValue() { - return value; - } - - /** - * @return The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category - */ - @JsonProperty("stringValue") - @java.lang.Override - public String getStringValue() { - return stringValue; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CategoricalScore && equalTo((CategoricalScore) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CategoricalScore other) { - return value == other.value && stringValue.equals(other.stringValue) && id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value, this.stringValue, this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - /** - *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- */ - StringValueStage value(double value); - - Builder from(CategoricalScore other); - } - - public interface StringValueStage { - /** - *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- */ - IdStage stringValue(@NotNull String stringValue); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - CategoricalScore build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements ValueStage, StringValueStage, IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private double value; - - private String stringValue; - - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(CategoricalScore other) { - value(other.getValue()); - stringValue(other.getStringValue()); - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - return this; - } - - /** - *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public StringValueStage value(double value) { - this.value = value; - return this; - } - - /** - *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("stringValue") - public IdStage stringValue(@NotNull String stringValue) { - this.stringValue = Objects.requireNonNull(stringValue, "stringValue must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public CategoricalScore build() { - return new CategoricalScore(value, stringValue, id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/CategoricalScoreV1.java b/src/main/java/com/langfuse/client/resources/commons/types/CategoricalScoreV1.java deleted file mode 100644 index 4501905..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/CategoricalScoreV1.java +++ /dev/null @@ -1,794 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CategoricalScoreV1.Builder.class -) -public final class CategoricalScoreV1 implements IBaseScoreV1 { - private final String id; - - private final String traceId; - - private final String name; - - private final ScoreSource source; - - private final Optional observationId; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final double value; - - private final String stringValue; - - private final Map additionalProperties; - - private CategoricalScoreV1(String id, String traceId, String name, ScoreSource source, - Optional observationId, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - double value, String stringValue, Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.name = name; - this.source = source; - this.observationId = observationId; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.value = value; - this.stringValue = stringValue; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public String getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - /** - * @return Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0. - */ - @JsonProperty("value") - public double getValue() { - return value; - } - - /** - * @return The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category - */ - @JsonProperty("stringValue") - public String getStringValue() { - return stringValue; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CategoricalScoreV1 && equalTo((CategoricalScoreV1) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CategoricalScoreV1 other) { - return id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && source.equals(other.source) && observationId.equals(other.observationId) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment) && value == other.value && stringValue.equals(other.stringValue); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.name, this.source, this.observationId, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment, this.value, this.stringValue); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - TraceIdStage id(@NotNull String id); - - Builder from(CategoricalScoreV1 other); - } - - public interface TraceIdStage { - NameStage traceId(@NotNull String traceId); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - ValueStage environment(@NotNull String environment); - } - - public interface ValueStage { - /** - *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- */ - StringValueStage value(double value); - } - - public interface StringValueStage { - /** - *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- */ - _FinalStage stringValue(@NotNull String stringValue); - } - - public interface _FinalStage { - CategoricalScoreV1 build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TraceIdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, ValueStage, StringValueStage, _FinalStage { - private String id; - - private String traceId; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private double value; - - private String stringValue; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(CategoricalScoreV1 other) { - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - source(other.getSource()); - observationId(other.getObservationId()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - value(other.getValue()); - stringValue(other.getStringValue()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public TraceIdStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("traceId") - public NameStage traceId(@NotNull String traceId) { - this.traceId = Objects.requireNonNull(traceId, "traceId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public ValueStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public StringValueStage value(double value) { - this.value = value; - return this; - } - - /** - *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("stringValue") - public _FinalStage stringValue(@NotNull String stringValue) { - this.stringValue = Objects.requireNonNull(stringValue, "stringValue must not be null"); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - @java.lang.Override - public CategoricalScoreV1 build() { - return new CategoricalScoreV1(id, traceId, name, source, observationId, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, value, stringValue, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/CorrectionScore.java b/src/main/java/com/langfuse/client/resources/commons/types/CorrectionScore.java deleted file mode 100644 index 3c33e2f..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/CorrectionScore.java +++ /dev/null @@ -1,1005 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CorrectionScore.Builder.class -) -public final class CorrectionScore implements ICorrectionScore, IBaseScore { - private final double value; - - private final String stringValue; - - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Map additionalProperties; - - private CorrectionScore(double value, String stringValue, String id, Optional traceId, - Optional sessionId, Optional observationId, Optional datasetRunId, - String name, ScoreSource source, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - Map additionalProperties) { - this.value = value; - this.stringValue = stringValue; - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - /** - * @return The numeric value of the score. Always 0 for correction scores. - */ - @JsonProperty("value") - @java.lang.Override - public double getValue() { - return value; - } - - /** - * @return The string representation of the correction content - */ - @JsonProperty("stringValue") - @java.lang.Override - public String getStringValue() { - return stringValue; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CorrectionScore && equalTo((CorrectionScore) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CorrectionScore other) { - return value == other.value && stringValue.equals(other.stringValue) && id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value, this.stringValue, this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - /** - *

The numeric value of the score. Always 0 for correction scores.

- */ - StringValueStage value(double value); - - Builder from(CorrectionScore other); - } - - public interface StringValueStage { - /** - *

The string representation of the correction content

- */ - IdStage stringValue(@NotNull String stringValue); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - CorrectionScore build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements ValueStage, StringValueStage, IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private double value; - - private String stringValue; - - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(CorrectionScore other) { - value(other.getValue()); - stringValue(other.getStringValue()); - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - return this; - } - - /** - *

The numeric value of the score. Always 0 for correction scores.

- *

The numeric value of the score. Always 0 for correction scores.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public StringValueStage value(double value) { - this.value = value; - return this; - } - - /** - *

The string representation of the correction content

- *

The string representation of the correction content

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("stringValue") - public IdStage stringValue(@NotNull String stringValue) { - this.stringValue = Objects.requireNonNull(stringValue, "stringValue must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public CorrectionScore build() { - return new CorrectionScore(value, stringValue, id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/DatasetRun.java b/src/main/java/com/langfuse/client/resources/commons/types/DatasetRun.java deleted file mode 100644 index d63cee7..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/DatasetRun.java +++ /dev/null @@ -1,427 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = DatasetRun.Builder.class -) -public final class DatasetRun implements IDatasetRun { - private final String id; - - private final String name; - - private final Optional description; - - private final Object metadata; - - private final String datasetId; - - private final String datasetName; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Map additionalProperties; - - private DatasetRun(String id, String name, Optional description, Object metadata, - String datasetId, String datasetName, OffsetDateTime createdAt, OffsetDateTime updatedAt, - Map additionalProperties) { - this.id = id; - this.name = name; - this.description = description; - this.metadata = metadata; - this.datasetId = datasetId; - this.datasetName = datasetName; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier of the dataset run - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Name of the dataset run - */ - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - /** - * @return Description of the run - */ - @JsonIgnore - @java.lang.Override - public Optional getDescription() { - if (description == null) { - return Optional.empty(); - } - return description; - } - - /** - * @return Metadata of the dataset run - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Id of the associated dataset - */ - @JsonProperty("datasetId") - @java.lang.Override - public String getDatasetId() { - return datasetId; - } - - /** - * @return Name of the associated dataset - */ - @JsonProperty("datasetName") - @java.lang.Override - public String getDatasetName() { - return datasetName; - } - - /** - * @return The date and time when the dataset run was created - */ - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - /** - * @return The date and time when the dataset run was last updated - */ - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("description") - private Optional _getDescription() { - return description; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DatasetRun && equalTo((DatasetRun) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DatasetRun other) { - return id.equals(other.id) && name.equals(other.name) && description.equals(other.description) && metadata.equals(other.metadata) && datasetId.equals(other.datasetId) && datasetName.equals(other.datasetName) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name, this.description, this.metadata, this.datasetId, this.datasetName, this.createdAt, this.updatedAt); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

Unique identifier of the dataset run

- */ - NameStage id(@NotNull String id); - - Builder from(DatasetRun other); - } - - public interface NameStage { - /** - *

Name of the dataset run

- */ - MetadataStage name(@NotNull String name); - } - - public interface MetadataStage { - /** - *

Metadata of the dataset run

- */ - DatasetIdStage metadata(Object metadata); - } - - public interface DatasetIdStage { - /** - *

Id of the associated dataset

- */ - DatasetNameStage datasetId(@NotNull String datasetId); - } - - public interface DatasetNameStage { - /** - *

Name of the associated dataset

- */ - CreatedAtStage datasetName(@NotNull String datasetName); - } - - public interface CreatedAtStage { - /** - *

The date and time when the dataset run was created

- */ - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - /** - *

The date and time when the dataset run was last updated

- */ - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface _FinalStage { - DatasetRun build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Description of the run

- */ - _FinalStage description(Optional description); - - _FinalStage description(String description); - - _FinalStage description(Nullable description); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, NameStage, MetadataStage, DatasetIdStage, DatasetNameStage, CreatedAtStage, UpdatedAtStage, _FinalStage { - private String id; - - private String name; - - private Object metadata; - - private String datasetId; - - private String datasetName; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Optional description = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(DatasetRun other) { - id(other.getId()); - name(other.getName()); - description(other.getDescription()); - metadata(other.getMetadata()); - datasetId(other.getDatasetId()); - datasetName(other.getDatasetName()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - return this; - } - - /** - *

Unique identifier of the dataset run

- *

Unique identifier of the dataset run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Name of the dataset run

- *

Name of the dataset run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("name") - public MetadataStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - /** - *

Metadata of the dataset run

- *

Metadata of the dataset run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public DatasetIdStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

Id of the associated dataset

- *

Id of the associated dataset

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("datasetId") - public DatasetNameStage datasetId(@NotNull String datasetId) { - this.datasetId = Objects.requireNonNull(datasetId, "datasetId must not be null"); - return this; - } - - /** - *

Name of the associated dataset

- *

Name of the associated dataset

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("datasetName") - public CreatedAtStage datasetName(@NotNull String datasetName) { - this.datasetName = Objects.requireNonNull(datasetName, "datasetName must not be null"); - return this; - } - - /** - *

The date and time when the dataset run was created

- *

The date and time when the dataset run was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - /** - *

The date and time when the dataset run was last updated

- *

The date and time when the dataset run was last updated

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("updatedAt") - public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Description of the run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage description(Nullable description) { - if (description.isNull()) { - this.description = null; - } - else if (description.isEmpty()) { - this.description = Optional.empty(); - } - else { - this.description = Optional.of(description.get()); - } - return this; - } - - /** - *

Description of the run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage description(String description) { - this.description = Optional.ofNullable(description); - return this; - } - - /** - *

Description of the run

- */ - @java.lang.Override - @JsonSetter( - value = "description", - nulls = Nulls.SKIP - ) - public _FinalStage description(Optional description) { - this.description = description; - return this; - } - - @java.lang.Override - public DatasetRun build() { - return new DatasetRun(id, name, description, metadata, datasetId, datasetName, createdAt, updatedAt, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/DatasetRunItem.java b/src/main/java/com/langfuse/client/resources/commons/types/DatasetRunItem.java deleted file mode 100644 index cfe9ed7..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/DatasetRunItem.java +++ /dev/null @@ -1,343 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = DatasetRunItem.Builder.class -) -public final class DatasetRunItem { - private final String id; - - private final String datasetRunId; - - private final String datasetRunName; - - private final String datasetItemId; - - private final String traceId; - - private final Optional observationId; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Map additionalProperties; - - private DatasetRunItem(String id, String datasetRunId, String datasetRunName, - String datasetItemId, String traceId, Optional observationId, - OffsetDateTime createdAt, OffsetDateTime updatedAt, - Map additionalProperties) { - this.id = id; - this.datasetRunId = datasetRunId; - this.datasetRunName = datasetRunName; - this.datasetItemId = datasetItemId; - this.traceId = traceId; - this.observationId = observationId; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("datasetRunId") - public String getDatasetRunId() { - return datasetRunId; - } - - @JsonProperty("datasetRunName") - public String getDatasetRunName() { - return datasetRunName; - } - - @JsonProperty("datasetItemId") - public String getDatasetItemId() { - return datasetItemId; - } - - @JsonProperty("traceId") - public String getTraceId() { - return traceId; - } - - /** - * @return The observation ID associated with this run item - */ - @JsonIgnore - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - @JsonProperty("createdAt") - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DatasetRunItem && equalTo((DatasetRunItem) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DatasetRunItem other) { - return id.equals(other.id) && datasetRunId.equals(other.datasetRunId) && datasetRunName.equals(other.datasetRunName) && datasetItemId.equals(other.datasetItemId) && traceId.equals(other.traceId) && observationId.equals(other.observationId) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.datasetRunId, this.datasetRunName, this.datasetItemId, this.traceId, this.observationId, this.createdAt, this.updatedAt); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - DatasetRunIdStage id(@NotNull String id); - - Builder from(DatasetRunItem other); - } - - public interface DatasetRunIdStage { - DatasetRunNameStage datasetRunId(@NotNull String datasetRunId); - } - - public interface DatasetRunNameStage { - DatasetItemIdStage datasetRunName(@NotNull String datasetRunName); - } - - public interface DatasetItemIdStage { - TraceIdStage datasetItemId(@NotNull String datasetItemId); - } - - public interface TraceIdStage { - CreatedAtStage traceId(@NotNull String traceId); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface _FinalStage { - DatasetRunItem build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The observation ID associated with this run item

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, DatasetRunIdStage, DatasetRunNameStage, DatasetItemIdStage, TraceIdStage, CreatedAtStage, UpdatedAtStage, _FinalStage { - private String id; - - private String datasetRunId; - - private String datasetRunName; - - private String datasetItemId; - - private String traceId; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Optional observationId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(DatasetRunItem other) { - id(other.getId()); - datasetRunId(other.getDatasetRunId()); - datasetRunName(other.getDatasetRunName()); - datasetItemId(other.getDatasetItemId()); - traceId(other.getTraceId()); - observationId(other.getObservationId()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public DatasetRunIdStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("datasetRunId") - public DatasetRunNameStage datasetRunId(@NotNull String datasetRunId) { - this.datasetRunId = Objects.requireNonNull(datasetRunId, "datasetRunId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("datasetRunName") - public DatasetItemIdStage datasetRunName(@NotNull String datasetRunName) { - this.datasetRunName = Objects.requireNonNull(datasetRunName, "datasetRunName must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("datasetItemId") - public TraceIdStage datasetItemId(@NotNull String datasetItemId) { - this.datasetItemId = Objects.requireNonNull(datasetItemId, "datasetItemId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("traceId") - public CreatedAtStage traceId(@NotNull String traceId) { - this.traceId = Objects.requireNonNull(traceId, "traceId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

The observation ID associated with this run item

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with this run item

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with this run item

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - @java.lang.Override - public DatasetRunItem build() { - return new DatasetRunItem(id, datasetRunId, datasetRunName, datasetItemId, traceId, observationId, createdAt, updatedAt, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/DatasetRunWithItems.java b/src/main/java/com/langfuse/client/resources/commons/types/DatasetRunWithItems.java deleted file mode 100644 index fea2d83..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/DatasetRunWithItems.java +++ /dev/null @@ -1,473 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = DatasetRunWithItems.Builder.class -) -public final class DatasetRunWithItems implements IDatasetRun { - private final String id; - - private final String name; - - private final Optional description; - - private final Object metadata; - - private final String datasetId; - - private final String datasetName; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final List datasetRunItems; - - private final Map additionalProperties; - - private DatasetRunWithItems(String id, String name, Optional description, Object metadata, - String datasetId, String datasetName, OffsetDateTime createdAt, OffsetDateTime updatedAt, - List datasetRunItems, Map additionalProperties) { - this.id = id; - this.name = name; - this.description = description; - this.metadata = metadata; - this.datasetId = datasetId; - this.datasetName = datasetName; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.datasetRunItems = datasetRunItems; - this.additionalProperties = additionalProperties; - } - - /** - * @return Unique identifier of the dataset run - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Name of the dataset run - */ - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - /** - * @return Description of the run - */ - @JsonIgnore - @java.lang.Override - public Optional getDescription() { - if (description == null) { - return Optional.empty(); - } - return description; - } - - /** - * @return Metadata of the dataset run - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Id of the associated dataset - */ - @JsonProperty("datasetId") - @java.lang.Override - public String getDatasetId() { - return datasetId; - } - - /** - * @return Name of the associated dataset - */ - @JsonProperty("datasetName") - @java.lang.Override - public String getDatasetName() { - return datasetName; - } - - /** - * @return The date and time when the dataset run was created - */ - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - /** - * @return The date and time when the dataset run was last updated - */ - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - @JsonProperty("datasetRunItems") - public List getDatasetRunItems() { - return datasetRunItems; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("description") - private Optional _getDescription() { - return description; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DatasetRunWithItems && equalTo((DatasetRunWithItems) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DatasetRunWithItems other) { - return id.equals(other.id) && name.equals(other.name) && description.equals(other.description) && metadata.equals(other.metadata) && datasetId.equals(other.datasetId) && datasetName.equals(other.datasetName) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && datasetRunItems.equals(other.datasetRunItems); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.name, this.description, this.metadata, this.datasetId, this.datasetName, this.createdAt, this.updatedAt, this.datasetRunItems); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

Unique identifier of the dataset run

- */ - NameStage id(@NotNull String id); - - Builder from(DatasetRunWithItems other); - } - - public interface NameStage { - /** - *

Name of the dataset run

- */ - MetadataStage name(@NotNull String name); - } - - public interface MetadataStage { - /** - *

Metadata of the dataset run

- */ - DatasetIdStage metadata(Object metadata); - } - - public interface DatasetIdStage { - /** - *

Id of the associated dataset

- */ - DatasetNameStage datasetId(@NotNull String datasetId); - } - - public interface DatasetNameStage { - /** - *

Name of the associated dataset

- */ - CreatedAtStage datasetName(@NotNull String datasetName); - } - - public interface CreatedAtStage { - /** - *

The date and time when the dataset run was created

- */ - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - /** - *

The date and time when the dataset run was last updated

- */ - _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface _FinalStage { - DatasetRunWithItems build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Description of the run

- */ - _FinalStage description(Optional description); - - _FinalStage description(String description); - - _FinalStage description(Nullable description); - - _FinalStage datasetRunItems(List datasetRunItems); - - _FinalStage addDatasetRunItems(DatasetRunItem datasetRunItems); - - _FinalStage addAllDatasetRunItems(List datasetRunItems); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, NameStage, MetadataStage, DatasetIdStage, DatasetNameStage, CreatedAtStage, UpdatedAtStage, _FinalStage { - private String id; - - private String name; - - private Object metadata; - - private String datasetId; - - private String datasetName; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private List datasetRunItems = new ArrayList<>(); - - private Optional description = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(DatasetRunWithItems other) { - id(other.getId()); - name(other.getName()); - description(other.getDescription()); - metadata(other.getMetadata()); - datasetId(other.getDatasetId()); - datasetName(other.getDatasetName()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - datasetRunItems(other.getDatasetRunItems()); - return this; - } - - /** - *

Unique identifier of the dataset run

- *

Unique identifier of the dataset run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Name of the dataset run

- *

Name of the dataset run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("name") - public MetadataStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - /** - *

Metadata of the dataset run

- *

Metadata of the dataset run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public DatasetIdStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

Id of the associated dataset

- *

Id of the associated dataset

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("datasetId") - public DatasetNameStage datasetId(@NotNull String datasetId) { - this.datasetId = Objects.requireNonNull(datasetId, "datasetId must not be null"); - return this; - } - - /** - *

Name of the associated dataset

- *

Name of the associated dataset

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("datasetName") - public CreatedAtStage datasetName(@NotNull String datasetName) { - this.datasetName = Objects.requireNonNull(datasetName, "datasetName must not be null"); - return this; - } - - /** - *

The date and time when the dataset run was created

- *

The date and time when the dataset run was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - /** - *

The date and time when the dataset run was last updated

- *

The date and time when the dataset run was last updated

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("updatedAt") - public _FinalStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllDatasetRunItems(List datasetRunItems) { - if (datasetRunItems != null) { - this.datasetRunItems.addAll(datasetRunItems); - } - return this; - } - - @java.lang.Override - public _FinalStage addDatasetRunItems(DatasetRunItem datasetRunItems) { - this.datasetRunItems.add(datasetRunItems); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "datasetRunItems", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunItems(List datasetRunItems) { - this.datasetRunItems.clear(); - if (datasetRunItems != null) { - this.datasetRunItems.addAll(datasetRunItems); - } - return this; - } - - /** - *

Description of the run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage description(Nullable description) { - if (description.isNull()) { - this.description = null; - } - else if (description.isEmpty()) { - this.description = Optional.empty(); - } - else { - this.description = Optional.of(description.get()); - } - return this; - } - - /** - *

Description of the run

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage description(String description) { - this.description = Optional.ofNullable(description); - return this; - } - - /** - *

Description of the run

- */ - @java.lang.Override - @JsonSetter( - value = "description", - nulls = Nulls.SKIP - ) - public _FinalStage description(Optional description) { - this.description = description; - return this; - } - - @java.lang.Override - public DatasetRunWithItems build() { - return new DatasetRunWithItems(id, name, description, metadata, datasetId, datasetName, createdAt, updatedAt, datasetRunItems, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/IBaseScore.java b/src/main/java/com/langfuse/client/resources/commons/types/IBaseScore.java deleted file mode 100644 index f8e6742..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/IBaseScore.java +++ /dev/null @@ -1,44 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Optional; - -public interface IBaseScore { - String getId(); - - Optional getTraceId(); - - Optional getSessionId(); - - Optional getObservationId(); - - Optional getDatasetRunId(); - - String getName(); - - ScoreSource getSource(); - - OffsetDateTime getTimestamp(); - - OffsetDateTime getCreatedAt(); - - OffsetDateTime getUpdatedAt(); - - Optional getAuthorUserId(); - - Optional getComment(); - - Object getMetadata(); - - Optional getConfigId(); - - Optional getQueueId(); - - String getEnvironment(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/IBaseScoreV1.java b/src/main/java/com/langfuse/client/resources/commons/types/IBaseScoreV1.java deleted file mode 100644 index e539adc..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/IBaseScoreV1.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Optional; - -public interface IBaseScoreV1 { - String getId(); - - String getTraceId(); - - String getName(); - - ScoreSource getSource(); - - Optional getObservationId(); - - OffsetDateTime getTimestamp(); - - OffsetDateTime getCreatedAt(); - - OffsetDateTime getUpdatedAt(); - - Optional getAuthorUserId(); - - Optional getComment(); - - Object getMetadata(); - - Optional getConfigId(); - - Optional getQueueId(); - - String getEnvironment(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/IBooleanScore.java b/src/main/java/com/langfuse/client/resources/commons/types/IBooleanScore.java deleted file mode 100644 index b5b5d26..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/IBooleanScore.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.String; - -public interface IBooleanScore extends IBaseScore { - double getValue(); - - String getStringValue(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/ICategoricalScore.java b/src/main/java/com/langfuse/client/resources/commons/types/ICategoricalScore.java deleted file mode 100644 index 35ce204..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/ICategoricalScore.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.String; - -public interface ICategoricalScore extends IBaseScore { - double getValue(); - - String getStringValue(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/ICorrectionScore.java b/src/main/java/com/langfuse/client/resources/commons/types/ICorrectionScore.java deleted file mode 100644 index bfa3b94..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/ICorrectionScore.java +++ /dev/null @@ -1,13 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.String; - -public interface ICorrectionScore extends IBaseScore { - double getValue(); - - String getStringValue(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/IDatasetRun.java b/src/main/java/com/langfuse/client/resources/commons/types/IDatasetRun.java deleted file mode 100644 index 035351d..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/IDatasetRun.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Optional; - -public interface IDatasetRun { - String getId(); - - String getName(); - - Optional getDescription(); - - Object getMetadata(); - - String getDatasetId(); - - String getDatasetName(); - - OffsetDateTime getCreatedAt(); - - OffsetDateTime getUpdatedAt(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/INumericScore.java b/src/main/java/com/langfuse/client/resources/commons/types/INumericScore.java deleted file mode 100644 index ceef6ab..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/INumericScore.java +++ /dev/null @@ -1,9 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -public interface INumericScore extends IBaseScore { - double getValue(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/IObservation.java b/src/main/java/com/langfuse/client/resources/commons/types/IObservation.java deleted file mode 100644 index e7d9c4c..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/IObservation.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.Double; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Map; -import java.util.Optional; - -public interface IObservation { - String getId(); - - Optional getTraceId(); - - String getType(); - - Optional getName(); - - OffsetDateTime getStartTime(); - - Optional getEndTime(); - - Optional getCompletionStartTime(); - - Optional getModel(); - - Object getModelParameters(); - - Object getInput(); - - Optional getVersion(); - - Object getMetadata(); - - Object getOutput(); - - Usage getUsage(); - - ObservationLevel getLevel(); - - Optional getStatusMessage(); - - Optional getParentObservationId(); - - Optional getPromptId(); - - Map getUsageDetails(); - - Map getCostDetails(); - - String getEnvironment(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/ISession.java b/src/main/java/com/langfuse/client/resources/commons/types/ISession.java deleted file mode 100644 index 6f1a7ff..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/ISession.java +++ /dev/null @@ -1,18 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.String; -import java.time.OffsetDateTime; - -public interface ISession { - String getId(); - - OffsetDateTime getCreatedAt(); - - String getProjectId(); - - String getEnvironment(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/ITrace.java b/src/main/java/com/langfuse/client/resources/commons/types/ITrace.java deleted file mode 100644 index 9419390..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/ITrace.java +++ /dev/null @@ -1,39 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.List; -import java.util.Optional; - -public interface ITrace { - String getId(); - - OffsetDateTime getTimestamp(); - - Optional getName(); - - Optional getInput(); - - Optional getOutput(); - - Optional getSessionId(); - - Optional getRelease(); - - Optional getVersion(); - - Optional getUserId(); - - Optional getMetadata(); - - List getTags(); - - boolean getPublic(); - - String getEnvironment(); -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/MapValue.java b/src/main/java/com/langfuse/client/resources/commons/types/MapValue.java deleted file mode 100644 index fcf4072..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/MapValue.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.langfuse.client.core.ObjectMappers; -import java.io.IOException; -import java.lang.Boolean; -import java.lang.Float; -import java.lang.IllegalStateException; -import java.lang.Integer; -import java.lang.Object; -import java.lang.RuntimeException; -import java.lang.String; -import java.lang.SuppressWarnings; -import java.util.List; -import java.util.Objects; -import java.util.Optional; - -@JsonDeserialize( - using = MapValue.Deserializer.class -) -public final class MapValue { - private final Object value; - - private final int type; - - private MapValue(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if(this.type == 0) { - return visitor.visitOptionalString((Optional) this.value); - } else if(this.type == 1) { - return visitor.visitOptionalInteger((Optional) this.value); - } else if(this.type == 2) { - return visitor.visitOptionalFloat((Optional) this.value); - } else if(this.type == 3) { - return visitor.visitOptionalBoolean((Optional) this.value); - } else if(this.type == 4) { - return visitor.visitOptionalListOfString((Optional>) this.value); - } - throw new IllegalStateException("Failed to visit value. This should never happen."); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MapValue && equalTo((MapValue) other); - } - - private boolean equalTo(MapValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return this.value.toString(); - } - - public static MapValue ofOptionalString(Optional value) { - return new MapValue(value, 0); - } - - public static MapValue ofOptionalInteger(Optional value) { - return new MapValue(value, 1); - } - - public static MapValue ofOptionalFloat(Optional value) { - return new MapValue(value, 2); - } - - public static MapValue ofOptionalBoolean(Optional value) { - return new MapValue(value, 3); - } - - public static MapValue ofOptionalListOfString(Optional> value) { - return new MapValue(value, 4); - } - - public interface Visitor { - T visitOptionalString(Optional value); - - T visitOptionalInteger(Optional value); - - T visitOptionalFloat(Optional value); - - T visitOptionalBoolean(Optional value); - - T visitOptionalListOfString(Optional> value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(MapValue.class); - } - - @java.lang.Override - public MapValue deserialize(JsonParser p, DeserializationContext context) throws IOException { - Object value = p.readValueAs(Object.class); - try { - return ofOptionalString(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); - } catch(RuntimeException e) { - } - try { - return ofOptionalInteger(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); - } catch(RuntimeException e) { - } - try { - return ofOptionalFloat(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); - } catch(RuntimeException e) { - } - try { - return ofOptionalBoolean(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); - } catch(RuntimeException e) { - } - try { - return ofOptionalListOfString(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>>() {})); - } catch(RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/NumericScore.java b/src/main/java/com/langfuse/client/resources/commons/types/NumericScore.java deleted file mode 100644 index cdcc442..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/NumericScore.java +++ /dev/null @@ -1,971 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = NumericScore.Builder.class -) -public final class NumericScore implements INumericScore, IBaseScore { - private final double value; - - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Map additionalProperties; - - private NumericScore(double value, String id, Optional traceId, - Optional sessionId, Optional observationId, Optional datasetRunId, - String name, ScoreSource source, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - Map additionalProperties) { - this.value = value; - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - /** - * @return The numeric value of the score - */ - @JsonProperty("value") - @java.lang.Override - public double getValue() { - return value; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumericScore && equalTo((NumericScore) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(NumericScore other) { - return value == other.value && id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value, this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - /** - *

The numeric value of the score

- */ - IdStage value(double value); - - Builder from(NumericScore other); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - NumericScore build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements ValueStage, IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private double value; - - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(NumericScore other) { - value(other.getValue()); - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - return this; - } - - /** - *

The numeric value of the score

- *

The numeric value of the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public IdStage value(double value) { - this.value = value; - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public NumericScore build() { - return new NumericScore(value, id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/NumericScoreV1.java b/src/main/java/com/langfuse/client/resources/commons/types/NumericScoreV1.java deleted file mode 100644 index 1ad7e83..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/NumericScoreV1.java +++ /dev/null @@ -1,761 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = NumericScoreV1.Builder.class -) -public final class NumericScoreV1 implements IBaseScoreV1 { - private final String id; - - private final String traceId; - - private final String name; - - private final ScoreSource source; - - private final Optional observationId; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final double value; - - private final Map additionalProperties; - - private NumericScoreV1(String id, String traceId, String name, ScoreSource source, - Optional observationId, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - double value, Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.name = name; - this.source = source; - this.observationId = observationId; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.value = value; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public String getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - /** - * @return The numeric value of the score - */ - @JsonProperty("value") - public double getValue() { - return value; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumericScoreV1 && equalTo((NumericScoreV1) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(NumericScoreV1 other) { - return id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && source.equals(other.source) && observationId.equals(other.observationId) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment) && value == other.value; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.name, this.source, this.observationId, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment, this.value); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - TraceIdStage id(@NotNull String id); - - Builder from(NumericScoreV1 other); - } - - public interface TraceIdStage { - NameStage traceId(@NotNull String traceId); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - ValueStage environment(@NotNull String environment); - } - - public interface ValueStage { - /** - *

The numeric value of the score

- */ - _FinalStage value(double value); - } - - public interface _FinalStage { - NumericScoreV1 build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TraceIdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, ValueStage, _FinalStage { - private String id; - - private String traceId; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private double value; - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(NumericScoreV1 other) { - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - source(other.getSource()); - observationId(other.getObservationId()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - value(other.getValue()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public TraceIdStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("traceId") - public NameStage traceId(@NotNull String traceId) { - this.traceId = Objects.requireNonNull(traceId, "traceId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public ValueStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The numeric value of the score

- *

The numeric value of the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public _FinalStage value(double value) { - this.value = value; - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - @java.lang.Override - public NumericScoreV1 build() { - return new NumericScoreV1(id, traceId, name, source, observationId, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, value, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/Observation.java b/src/main/java/com/langfuse/client/resources/commons/types/Observation.java deleted file mode 100644 index e64bb40..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/Observation.java +++ /dev/null @@ -1,1276 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Double; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = Observation.Builder.class -) -public final class Observation implements IObservation { - private final String id; - - private final Optional traceId; - - private final String type; - - private final Optional name; - - private final OffsetDateTime startTime; - - private final Optional endTime; - - private final Optional completionStartTime; - - private final Optional model; - - private final Object modelParameters; - - private final Object input; - - private final Optional version; - - private final Object metadata; - - private final Object output; - - private final Usage usage; - - private final ObservationLevel level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional promptId; - - private final Map usageDetails; - - private final Map costDetails; - - private final String environment; - - private final Map additionalProperties; - - private Observation(String id, Optional traceId, String type, Optional name, - OffsetDateTime startTime, Optional endTime, - Optional completionStartTime, Optional model, Object modelParameters, - Object input, Optional version, Object metadata, Object output, Usage usage, - ObservationLevel level, Optional statusMessage, Optional parentObservationId, - Optional promptId, Map usageDetails, Map costDetails, - String environment, Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.type = type; - this.name = name; - this.startTime = startTime; - this.endTime = endTime; - this.completionStartTime = completionStartTime; - this.model = model; - this.modelParameters = modelParameters; - this.input = input; - this.version = version; - this.metadata = metadata; - this.output = output; - this.usage = usage; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.promptId = promptId; - this.usageDetails = usageDetails; - this.costDetails = costDetails; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the observation - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The type of the observation - */ - @JsonProperty("type") - @java.lang.Override - public String getType() { - return type; - } - - /** - * @return The name of the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getName() { - if (name == null) { - return Optional.empty(); - } - return name; - } - - /** - * @return The start time of the observation - */ - @JsonProperty("startTime") - @java.lang.Override - public OffsetDateTime getStartTime() { - return startTime; - } - - /** - * @return The end time of the observation. - */ - @JsonIgnore - @java.lang.Override - public Optional getEndTime() { - if (endTime == null) { - return Optional.empty(); - } - return endTime; - } - - /** - * @return The completion start time of the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getCompletionStartTime() { - if (completionStartTime == null) { - return Optional.empty(); - } - return completionStartTime; - } - - /** - * @return The model used for the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getModel() { - if (model == null) { - return Optional.empty(); - } - return model; - } - - /** - * @return The parameters of the model used for the observation - */ - @JsonProperty("modelParameters") - @java.lang.Override - public Object getModelParameters() { - return modelParameters; - } - - /** - * @return The input data of the observation - */ - @JsonProperty("input") - @java.lang.Override - public Object getInput() { - return input; - } - - /** - * @return The version of the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getVersion() { - if (version == null) { - return Optional.empty(); - } - return version; - } - - /** - * @return Additional metadata of the observation - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return The output data of the observation - */ - @JsonProperty("output") - @java.lang.Override - public Object getOutput() { - return output; - } - - /** - * @return (Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation - */ - @JsonProperty("usage") - @java.lang.Override - public Usage getUsage() { - return usage; - } - - /** - * @return The level of the observation - */ - @JsonProperty("level") - @java.lang.Override - public ObservationLevel getLevel() { - return level; - } - - /** - * @return The status message of the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getStatusMessage() { - if (statusMessage == null) { - return Optional.empty(); - } - return statusMessage; - } - - /** - * @return The parent observation ID - */ - @JsonIgnore - @java.lang.Override - public Optional getParentObservationId() { - if (parentObservationId == null) { - return Optional.empty(); - } - return parentObservationId; - } - - /** - * @return The prompt ID associated with the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getPromptId() { - if (promptId == null) { - return Optional.empty(); - } - return promptId; - } - - /** - * @return The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested. - */ - @JsonProperty("usageDetails") - @java.lang.Override - public Map getUsageDetails() { - return usageDetails; - } - - /** - * @return The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested. - */ - @JsonProperty("costDetails") - @java.lang.Override - public Map getCostDetails() { - return costDetails; - } - - /** - * @return The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("name") - private Optional _getName() { - return name; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("endTime") - private Optional _getEndTime() { - return endTime; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("completionStartTime") - private Optional _getCompletionStartTime() { - return completionStartTime; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("model") - private Optional _getModel() { - return model; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("version") - private Optional _getVersion() { - return version; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("statusMessage") - private Optional _getStatusMessage() { - return statusMessage; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("parentObservationId") - private Optional _getParentObservationId() { - return parentObservationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("promptId") - private Optional _getPromptId() { - return promptId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Observation && equalTo((Observation) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Observation other) { - return id.equals(other.id) && traceId.equals(other.traceId) && type.equals(other.type) && name.equals(other.name) && startTime.equals(other.startTime) && endTime.equals(other.endTime) && completionStartTime.equals(other.completionStartTime) && model.equals(other.model) && modelParameters.equals(other.modelParameters) && input.equals(other.input) && version.equals(other.version) && metadata.equals(other.metadata) && output.equals(other.output) && usage.equals(other.usage) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && promptId.equals(other.promptId) && usageDetails.equals(other.usageDetails) && costDetails.equals(other.costDetails) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.type, this.name, this.startTime, this.endTime, this.completionStartTime, this.model, this.modelParameters, this.input, this.version, this.metadata, this.output, this.usage, this.level, this.statusMessage, this.parentObservationId, this.promptId, this.usageDetails, this.costDetails, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

The unique identifier of the observation

- */ - TypeStage id(@NotNull String id); - - Builder from(Observation other); - } - - public interface TypeStage { - /** - *

The type of the observation

- */ - StartTimeStage type(@NotNull String type); - } - - public interface StartTimeStage { - /** - *

The start time of the observation

- */ - ModelParametersStage startTime(@NotNull OffsetDateTime startTime); - } - - public interface ModelParametersStage { - /** - *

The parameters of the model used for the observation

- */ - InputStage modelParameters(Object modelParameters); - } - - public interface InputStage { - /** - *

The input data of the observation

- */ - MetadataStage input(Object input); - } - - public interface MetadataStage { - /** - *

Additional metadata of the observation

- */ - OutputStage metadata(Object metadata); - } - - public interface OutputStage { - /** - *

The output data of the observation

- */ - UsageStage output(Object output); - } - - public interface UsageStage { - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation

- */ - LevelStage usage(@NotNull Usage usage); - } - - public interface LevelStage { - /** - *

The level of the observation

- */ - EnvironmentStage level(@NotNull ObservationLevel level); - } - - public interface EnvironmentStage { - /** - *

The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - Observation build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the observation

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The name of the observation

- */ - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage name(Nullable name); - - /** - *

The end time of the observation.

- */ - _FinalStage endTime(Optional endTime); - - _FinalStage endTime(OffsetDateTime endTime); - - _FinalStage endTime(Nullable endTime); - - /** - *

The completion start time of the observation

- */ - _FinalStage completionStartTime(Optional completionStartTime); - - _FinalStage completionStartTime(OffsetDateTime completionStartTime); - - _FinalStage completionStartTime(Nullable completionStartTime); - - /** - *

The model used for the observation

- */ - _FinalStage model(Optional model); - - _FinalStage model(String model); - - _FinalStage model(Nullable model); - - /** - *

The version of the observation

- */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage version(Nullable version); - - /** - *

The status message of the observation

- */ - _FinalStage statusMessage(Optional statusMessage); - - _FinalStage statusMessage(String statusMessage); - - _FinalStage statusMessage(Nullable statusMessage); - - /** - *

The parent observation ID

- */ - _FinalStage parentObservationId(Optional parentObservationId); - - _FinalStage parentObservationId(String parentObservationId); - - _FinalStage parentObservationId(Nullable parentObservationId); - - /** - *

The prompt ID associated with the observation

- */ - _FinalStage promptId(Optional promptId); - - _FinalStage promptId(String promptId); - - _FinalStage promptId(Nullable promptId); - - /** - *

The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.

- */ - _FinalStage usageDetails(Map usageDetails); - - _FinalStage putAllUsageDetails(Map usageDetails); - - _FinalStage usageDetails(String key, Integer value); - - /** - *

The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.

- */ - _FinalStage costDetails(Map costDetails); - - _FinalStage putAllCostDetails(Map costDetails); - - _FinalStage costDetails(String key, Double value); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TypeStage, StartTimeStage, ModelParametersStage, InputStage, MetadataStage, OutputStage, UsageStage, LevelStage, EnvironmentStage, _FinalStage { - private String id; - - private String type; - - private OffsetDateTime startTime; - - private Object modelParameters; - - private Object input; - - private Object metadata; - - private Object output; - - private Usage usage; - - private ObservationLevel level; - - private String environment; - - private Map costDetails = new LinkedHashMap<>(); - - private Map usageDetails = new LinkedHashMap<>(); - - private Optional promptId = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional completionStartTime = Optional.empty(); - - private Optional endTime = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(Observation other) { - id(other.getId()); - traceId(other.getTraceId()); - type(other.getType()); - name(other.getName()); - startTime(other.getStartTime()); - endTime(other.getEndTime()); - completionStartTime(other.getCompletionStartTime()); - model(other.getModel()); - modelParameters(other.getModelParameters()); - input(other.getInput()); - version(other.getVersion()); - metadata(other.getMetadata()); - output(other.getOutput()); - usage(other.getUsage()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - promptId(other.getPromptId()); - usageDetails(other.getUsageDetails()); - costDetails(other.getCostDetails()); - environment(other.getEnvironment()); - return this; - } - - /** - *

The unique identifier of the observation

- *

The unique identifier of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TypeStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

The type of the observation

- *

The type of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public StartTimeStage type(@NotNull String type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - /** - *

The start time of the observation

- *

The start time of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("startTime") - public ModelParametersStage startTime(@NotNull OffsetDateTime startTime) { - this.startTime = Objects.requireNonNull(startTime, "startTime must not be null"); - return this; - } - - /** - *

The parameters of the model used for the observation

- *

The parameters of the model used for the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("modelParameters") - public InputStage modelParameters(Object modelParameters) { - this.modelParameters = modelParameters; - return this; - } - - /** - *

The input data of the observation

- *

The input data of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("input") - public MetadataStage input(Object input) { - this.input = input; - return this; - } - - /** - *

Additional metadata of the observation

- *

Additional metadata of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public OutputStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The output data of the observation

- *

The output data of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("output") - public UsageStage output(Object output) { - this.output = output; - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation

- *

(Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("usage") - public LevelStage usage(@NotNull Usage usage) { - this.usage = Objects.requireNonNull(usage, "usage must not be null"); - return this; - } - - /** - *

The level of the observation

- *

The level of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("level") - public EnvironmentStage level(@NotNull ObservationLevel level) { - this.level = Objects.requireNonNull(level, "level must not be null"); - return this; - } - - /** - *

The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage costDetails(String key, Double value) { - this.costDetails.put(key, value); - return this; - } - - /** - *

The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage putAllCostDetails(Map costDetails) { - if (costDetails != null) { - this.costDetails.putAll(costDetails); - } - return this; - } - - /** - *

The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.

- */ - @java.lang.Override - @JsonSetter( - value = "costDetails", - nulls = Nulls.SKIP - ) - public _FinalStage costDetails(Map costDetails) { - this.costDetails.clear(); - if (costDetails != null) { - this.costDetails.putAll(costDetails); - } - return this; - } - - /** - *

The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage usageDetails(String key, Integer value) { - this.usageDetails.put(key, value); - return this; - } - - /** - *

The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage putAllUsageDetails(Map usageDetails) { - if (usageDetails != null) { - this.usageDetails.putAll(usageDetails); - } - return this; - } - - /** - *

The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.

- */ - @java.lang.Override - @JsonSetter( - value = "usageDetails", - nulls = Nulls.SKIP - ) - public _FinalStage usageDetails(Map usageDetails) { - this.usageDetails.clear(); - if (usageDetails != null) { - this.usageDetails.putAll(usageDetails); - } - return this; - } - - /** - *

The prompt ID associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage promptId(Nullable promptId) { - if (promptId.isNull()) { - this.promptId = null; - } - else if (promptId.isEmpty()) { - this.promptId = Optional.empty(); - } - else { - this.promptId = Optional.of(promptId.get()); - } - return this; - } - - /** - *

The prompt ID associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage promptId(String promptId) { - this.promptId = Optional.ofNullable(promptId); - return this; - } - - /** - *

The prompt ID associated with the observation

- */ - @java.lang.Override - @JsonSetter( - value = "promptId", - nulls = Nulls.SKIP - ) - public _FinalStage promptId(Optional promptId) { - this.promptId = promptId; - return this; - } - - /** - *

The parent observation ID

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage parentObservationId(Nullable parentObservationId) { - if (parentObservationId.isNull()) { - this.parentObservationId = null; - } - else if (parentObservationId.isEmpty()) { - this.parentObservationId = Optional.empty(); - } - else { - this.parentObservationId = Optional.of(parentObservationId.get()); - } - return this; - } - - /** - *

The parent observation ID

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - /** - *

The parent observation ID

- */ - @java.lang.Override - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public _FinalStage parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - /** - *

The status message of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage statusMessage(Nullable statusMessage) { - if (statusMessage.isNull()) { - this.statusMessage = null; - } - else if (statusMessage.isEmpty()) { - this.statusMessage = Optional.empty(); - } - else { - this.statusMessage = Optional.of(statusMessage.get()); - } - return this; - } - - /** - *

The status message of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - /** - *

The status message of the observation

- */ - @java.lang.Override - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public _FinalStage statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - /** - *

The version of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(Nullable version) { - if (version.isNull()) { - this.version = null; - } - else if (version.isEmpty()) { - this.version = Optional.empty(); - } - else { - this.version = Optional.of(version.get()); - } - return this; - } - - /** - *

The version of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** - *

The version of the observation

- */ - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - /** - *

The model used for the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage model(Nullable model) { - if (model.isNull()) { - this.model = null; - } - else if (model.isEmpty()) { - this.model = Optional.empty(); - } - else { - this.model = Optional.of(model.get()); - } - return this; - } - - /** - *

The model used for the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage model(String model) { - this.model = Optional.ofNullable(model); - return this; - } - - /** - *

The model used for the observation

- */ - @java.lang.Override - @JsonSetter( - value = "model", - nulls = Nulls.SKIP - ) - public _FinalStage model(Optional model) { - this.model = model; - return this; - } - - /** - *

The completion start time of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage completionStartTime(Nullable completionStartTime) { - if (completionStartTime.isNull()) { - this.completionStartTime = null; - } - else if (completionStartTime.isEmpty()) { - this.completionStartTime = Optional.empty(); - } - else { - this.completionStartTime = Optional.of(completionStartTime.get()); - } - return this; - } - - /** - *

The completion start time of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage completionStartTime(OffsetDateTime completionStartTime) { - this.completionStartTime = Optional.ofNullable(completionStartTime); - return this; - } - - /** - *

The completion start time of the observation

- */ - @java.lang.Override - @JsonSetter( - value = "completionStartTime", - nulls = Nulls.SKIP - ) - public _FinalStage completionStartTime(Optional completionStartTime) { - this.completionStartTime = completionStartTime; - return this; - } - - /** - *

The end time of the observation.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage endTime(Nullable endTime) { - if (endTime.isNull()) { - this.endTime = null; - } - else if (endTime.isEmpty()) { - this.endTime = Optional.empty(); - } - else { - this.endTime = Optional.of(endTime.get()); - } - return this; - } - - /** - *

The end time of the observation.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage endTime(OffsetDateTime endTime) { - this.endTime = Optional.ofNullable(endTime); - return this; - } - - /** - *

The end time of the observation.

- */ - @java.lang.Override - @JsonSetter( - value = "endTime", - nulls = Nulls.SKIP - ) - public _FinalStage endTime(Optional endTime) { - this.endTime = endTime; - return this; - } - - /** - *

The name of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(Nullable name) { - if (name.isNull()) { - this.name = null; - } - else if (name.isEmpty()) { - this.name = Optional.empty(); - } - else { - this.name = Optional.of(name.get()); - } - return this; - } - - /** - *

The name of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - /** - *

The name of the observation

- */ - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - /** - *

The trace ID associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the observation

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public Observation build() { - return new Observation(id, traceId, type, name, startTime, endTime, completionStartTime, model, modelParameters, input, version, metadata, output, usage, level, statusMessage, parentObservationId, promptId, usageDetails, costDetails, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/ObservationsView.java b/src/main/java/com/langfuse/client/resources/commons/types/ObservationsView.java deleted file mode 100644 index 7b5a061..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/ObservationsView.java +++ /dev/null @@ -1,2117 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Double; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = ObservationsView.Builder.class -) -public final class ObservationsView implements IObservation { - private final String id; - - private final Optional traceId; - - private final String type; - - private final Optional name; - - private final OffsetDateTime startTime; - - private final Optional endTime; - - private final Optional completionStartTime; - - private final Optional model; - - private final Object modelParameters; - - private final Object input; - - private final Optional version; - - private final Object metadata; - - private final Object output; - - private final Usage usage; - - private final ObservationLevel level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional promptId; - - private final Map usageDetails; - - private final Map costDetails; - - private final String environment; - - private final Optional promptName; - - private final Optional promptVersion; - - private final Optional modelId; - - private final Optional inputPrice; - - private final Optional outputPrice; - - private final Optional totalPrice; - - private final Optional calculatedInputCost; - - private final Optional calculatedOutputCost; - - private final Optional calculatedTotalCost; - - private final Optional latency; - - private final Optional timeToFirstToken; - - private final Map additionalProperties; - - private ObservationsView(String id, Optional traceId, String type, Optional name, - OffsetDateTime startTime, Optional endTime, - Optional completionStartTime, Optional model, Object modelParameters, - Object input, Optional version, Object metadata, Object output, Usage usage, - ObservationLevel level, Optional statusMessage, Optional parentObservationId, - Optional promptId, Map usageDetails, Map costDetails, - String environment, Optional promptName, Optional promptVersion, - Optional modelId, Optional inputPrice, Optional outputPrice, - Optional totalPrice, Optional calculatedInputCost, - Optional calculatedOutputCost, Optional calculatedTotalCost, - Optional latency, Optional timeToFirstToken, - Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.type = type; - this.name = name; - this.startTime = startTime; - this.endTime = endTime; - this.completionStartTime = completionStartTime; - this.model = model; - this.modelParameters = modelParameters; - this.input = input; - this.version = version; - this.metadata = metadata; - this.output = output; - this.usage = usage; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.promptId = promptId; - this.usageDetails = usageDetails; - this.costDetails = costDetails; - this.environment = environment; - this.promptName = promptName; - this.promptVersion = promptVersion; - this.modelId = modelId; - this.inputPrice = inputPrice; - this.outputPrice = outputPrice; - this.totalPrice = totalPrice; - this.calculatedInputCost = calculatedInputCost; - this.calculatedOutputCost = calculatedOutputCost; - this.calculatedTotalCost = calculatedTotalCost; - this.latency = latency; - this.timeToFirstToken = timeToFirstToken; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of the observation - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The type of the observation - */ - @JsonProperty("type") - @java.lang.Override - public String getType() { - return type; - } - - /** - * @return The name of the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getName() { - if (name == null) { - return Optional.empty(); - } - return name; - } - - /** - * @return The start time of the observation - */ - @JsonProperty("startTime") - @java.lang.Override - public OffsetDateTime getStartTime() { - return startTime; - } - - /** - * @return The end time of the observation. - */ - @JsonIgnore - @java.lang.Override - public Optional getEndTime() { - if (endTime == null) { - return Optional.empty(); - } - return endTime; - } - - /** - * @return The completion start time of the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getCompletionStartTime() { - if (completionStartTime == null) { - return Optional.empty(); - } - return completionStartTime; - } - - /** - * @return The model used for the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getModel() { - if (model == null) { - return Optional.empty(); - } - return model; - } - - /** - * @return The parameters of the model used for the observation - */ - @JsonProperty("modelParameters") - @java.lang.Override - public Object getModelParameters() { - return modelParameters; - } - - /** - * @return The input data of the observation - */ - @JsonProperty("input") - @java.lang.Override - public Object getInput() { - return input; - } - - /** - * @return The version of the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getVersion() { - if (version == null) { - return Optional.empty(); - } - return version; - } - - /** - * @return Additional metadata of the observation - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return The output data of the observation - */ - @JsonProperty("output") - @java.lang.Override - public Object getOutput() { - return output; - } - - /** - * @return (Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation - */ - @JsonProperty("usage") - @java.lang.Override - public Usage getUsage() { - return usage; - } - - /** - * @return The level of the observation - */ - @JsonProperty("level") - @java.lang.Override - public ObservationLevel getLevel() { - return level; - } - - /** - * @return The status message of the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getStatusMessage() { - if (statusMessage == null) { - return Optional.empty(); - } - return statusMessage; - } - - /** - * @return The parent observation ID - */ - @JsonIgnore - @java.lang.Override - public Optional getParentObservationId() { - if (parentObservationId == null) { - return Optional.empty(); - } - return parentObservationId; - } - - /** - * @return The prompt ID associated with the observation - */ - @JsonIgnore - @java.lang.Override - public Optional getPromptId() { - if (promptId == null) { - return Optional.empty(); - } - return promptId; - } - - /** - * @return The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested. - */ - @JsonProperty("usageDetails") - @java.lang.Override - public Map getUsageDetails() { - return usageDetails; - } - - /** - * @return The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested. - */ - @JsonProperty("costDetails") - @java.lang.Override - public Map getCostDetails() { - return costDetails; - } - - /** - * @return The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - /** - * @return The name of the prompt associated with the observation - */ - @JsonIgnore - public Optional getPromptName() { - if (promptName == null) { - return Optional.empty(); - } - return promptName; - } - - /** - * @return The version of the prompt associated with the observation - */ - @JsonIgnore - public Optional getPromptVersion() { - if (promptVersion == null) { - return Optional.empty(); - } - return promptVersion; - } - - /** - * @return The unique identifier of the model - */ - @JsonIgnore - public Optional getModelId() { - if (modelId == null) { - return Optional.empty(); - } - return modelId; - } - - /** - * @return The price of the input in USD - */ - @JsonIgnore - public Optional getInputPrice() { - if (inputPrice == null) { - return Optional.empty(); - } - return inputPrice; - } - - /** - * @return The price of the output in USD. - */ - @JsonIgnore - public Optional getOutputPrice() { - if (outputPrice == null) { - return Optional.empty(); - } - return outputPrice; - } - - /** - * @return The total price in USD. - */ - @JsonIgnore - public Optional getTotalPrice() { - if (totalPrice == null) { - return Optional.empty(); - } - return totalPrice; - } - - /** - * @return (Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the input in USD - */ - @JsonIgnore - public Optional getCalculatedInputCost() { - if (calculatedInputCost == null) { - return Optional.empty(); - } - return calculatedInputCost; - } - - /** - * @return (Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the output in USD - */ - @JsonIgnore - public Optional getCalculatedOutputCost() { - if (calculatedOutputCost == null) { - return Optional.empty(); - } - return calculatedOutputCost; - } - - /** - * @return (Deprecated. Use usageDetails and costDetails instead.) The calculated total cost in USD - */ - @JsonIgnore - public Optional getCalculatedTotalCost() { - if (calculatedTotalCost == null) { - return Optional.empty(); - } - return calculatedTotalCost; - } - - /** - * @return The latency in seconds. - */ - @JsonIgnore - public Optional getLatency() { - if (latency == null) { - return Optional.empty(); - } - return latency; - } - - /** - * @return The time to the first token in seconds - */ - @JsonIgnore - public Optional getTimeToFirstToken() { - if (timeToFirstToken == null) { - return Optional.empty(); - } - return timeToFirstToken; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("name") - private Optional _getName() { - return name; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("endTime") - private Optional _getEndTime() { - return endTime; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("completionStartTime") - private Optional _getCompletionStartTime() { - return completionStartTime; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("model") - private Optional _getModel() { - return model; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("version") - private Optional _getVersion() { - return version; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("statusMessage") - private Optional _getStatusMessage() { - return statusMessage; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("parentObservationId") - private Optional _getParentObservationId() { - return parentObservationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("promptId") - private Optional _getPromptId() { - return promptId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("promptName") - private Optional _getPromptName() { - return promptName; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("promptVersion") - private Optional _getPromptVersion() { - return promptVersion; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("modelId") - private Optional _getModelId() { - return modelId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("inputPrice") - private Optional _getInputPrice() { - return inputPrice; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("outputPrice") - private Optional _getOutputPrice() { - return outputPrice; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("totalPrice") - private Optional _getTotalPrice() { - return totalPrice; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("calculatedInputCost") - private Optional _getCalculatedInputCost() { - return calculatedInputCost; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("calculatedOutputCost") - private Optional _getCalculatedOutputCost() { - return calculatedOutputCost; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("calculatedTotalCost") - private Optional _getCalculatedTotalCost() { - return calculatedTotalCost; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("latency") - private Optional _getLatency() { - return latency; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("timeToFirstToken") - private Optional _getTimeToFirstToken() { - return timeToFirstToken; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ObservationsView && equalTo((ObservationsView) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ObservationsView other) { - return id.equals(other.id) && traceId.equals(other.traceId) && type.equals(other.type) && name.equals(other.name) && startTime.equals(other.startTime) && endTime.equals(other.endTime) && completionStartTime.equals(other.completionStartTime) && model.equals(other.model) && modelParameters.equals(other.modelParameters) && input.equals(other.input) && version.equals(other.version) && metadata.equals(other.metadata) && output.equals(other.output) && usage.equals(other.usage) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && promptId.equals(other.promptId) && usageDetails.equals(other.usageDetails) && costDetails.equals(other.costDetails) && environment.equals(other.environment) && promptName.equals(other.promptName) && promptVersion.equals(other.promptVersion) && modelId.equals(other.modelId) && inputPrice.equals(other.inputPrice) && outputPrice.equals(other.outputPrice) && totalPrice.equals(other.totalPrice) && calculatedInputCost.equals(other.calculatedInputCost) && calculatedOutputCost.equals(other.calculatedOutputCost) && calculatedTotalCost.equals(other.calculatedTotalCost) && latency.equals(other.latency) && timeToFirstToken.equals(other.timeToFirstToken); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.type, this.name, this.startTime, this.endTime, this.completionStartTime, this.model, this.modelParameters, this.input, this.version, this.metadata, this.output, this.usage, this.level, this.statusMessage, this.parentObservationId, this.promptId, this.usageDetails, this.costDetails, this.environment, this.promptName, this.promptVersion, this.modelId, this.inputPrice, this.outputPrice, this.totalPrice, this.calculatedInputCost, this.calculatedOutputCost, this.calculatedTotalCost, this.latency, this.timeToFirstToken); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

The unique identifier of the observation

- */ - TypeStage id(@NotNull String id); - - Builder from(ObservationsView other); - } - - public interface TypeStage { - /** - *

The type of the observation

- */ - StartTimeStage type(@NotNull String type); - } - - public interface StartTimeStage { - /** - *

The start time of the observation

- */ - ModelParametersStage startTime(@NotNull OffsetDateTime startTime); - } - - public interface ModelParametersStage { - /** - *

The parameters of the model used for the observation

- */ - InputStage modelParameters(Object modelParameters); - } - - public interface InputStage { - /** - *

The input data of the observation

- */ - MetadataStage input(Object input); - } - - public interface MetadataStage { - /** - *

Additional metadata of the observation

- */ - OutputStage metadata(Object metadata); - } - - public interface OutputStage { - /** - *

The output data of the observation

- */ - UsageStage output(Object output); - } - - public interface UsageStage { - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation

- */ - LevelStage usage(@NotNull Usage usage); - } - - public interface LevelStage { - /** - *

The level of the observation

- */ - EnvironmentStage level(@NotNull ObservationLevel level); - } - - public interface EnvironmentStage { - /** - *

The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - ObservationsView build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the observation

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The name of the observation

- */ - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage name(Nullable name); - - /** - *

The end time of the observation.

- */ - _FinalStage endTime(Optional endTime); - - _FinalStage endTime(OffsetDateTime endTime); - - _FinalStage endTime(Nullable endTime); - - /** - *

The completion start time of the observation

- */ - _FinalStage completionStartTime(Optional completionStartTime); - - _FinalStage completionStartTime(OffsetDateTime completionStartTime); - - _FinalStage completionStartTime(Nullable completionStartTime); - - /** - *

The model used for the observation

- */ - _FinalStage model(Optional model); - - _FinalStage model(String model); - - _FinalStage model(Nullable model); - - /** - *

The version of the observation

- */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage version(Nullable version); - - /** - *

The status message of the observation

- */ - _FinalStage statusMessage(Optional statusMessage); - - _FinalStage statusMessage(String statusMessage); - - _FinalStage statusMessage(Nullable statusMessage); - - /** - *

The parent observation ID

- */ - _FinalStage parentObservationId(Optional parentObservationId); - - _FinalStage parentObservationId(String parentObservationId); - - _FinalStage parentObservationId(Nullable parentObservationId); - - /** - *

The prompt ID associated with the observation

- */ - _FinalStage promptId(Optional promptId); - - _FinalStage promptId(String promptId); - - _FinalStage promptId(Nullable promptId); - - /** - *

The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.

- */ - _FinalStage usageDetails(Map usageDetails); - - _FinalStage putAllUsageDetails(Map usageDetails); - - _FinalStage usageDetails(String key, Integer value); - - /** - *

The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.

- */ - _FinalStage costDetails(Map costDetails); - - _FinalStage putAllCostDetails(Map costDetails); - - _FinalStage costDetails(String key, Double value); - - /** - *

The name of the prompt associated with the observation

- */ - _FinalStage promptName(Optional promptName); - - _FinalStage promptName(String promptName); - - _FinalStage promptName(Nullable promptName); - - /** - *

The version of the prompt associated with the observation

- */ - _FinalStage promptVersion(Optional promptVersion); - - _FinalStage promptVersion(Integer promptVersion); - - _FinalStage promptVersion(Nullable promptVersion); - - /** - *

The unique identifier of the model

- */ - _FinalStage modelId(Optional modelId); - - _FinalStage modelId(String modelId); - - _FinalStage modelId(Nullable modelId); - - /** - *

The price of the input in USD

- */ - _FinalStage inputPrice(Optional inputPrice); - - _FinalStage inputPrice(Double inputPrice); - - _FinalStage inputPrice(Nullable inputPrice); - - /** - *

The price of the output in USD.

- */ - _FinalStage outputPrice(Optional outputPrice); - - _FinalStage outputPrice(Double outputPrice); - - _FinalStage outputPrice(Nullable outputPrice); - - /** - *

The total price in USD.

- */ - _FinalStage totalPrice(Optional totalPrice); - - _FinalStage totalPrice(Double totalPrice); - - _FinalStage totalPrice(Nullable totalPrice); - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the input in USD

- */ - _FinalStage calculatedInputCost(Optional calculatedInputCost); - - _FinalStage calculatedInputCost(Double calculatedInputCost); - - _FinalStage calculatedInputCost(Nullable calculatedInputCost); - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the output in USD

- */ - _FinalStage calculatedOutputCost(Optional calculatedOutputCost); - - _FinalStage calculatedOutputCost(Double calculatedOutputCost); - - _FinalStage calculatedOutputCost(Nullable calculatedOutputCost); - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated total cost in USD

- */ - _FinalStage calculatedTotalCost(Optional calculatedTotalCost); - - _FinalStage calculatedTotalCost(Double calculatedTotalCost); - - _FinalStage calculatedTotalCost(Nullable calculatedTotalCost); - - /** - *

The latency in seconds.

- */ - _FinalStage latency(Optional latency); - - _FinalStage latency(Double latency); - - _FinalStage latency(Nullable latency); - - /** - *

The time to the first token in seconds

- */ - _FinalStage timeToFirstToken(Optional timeToFirstToken); - - _FinalStage timeToFirstToken(Double timeToFirstToken); - - _FinalStage timeToFirstToken(Nullable timeToFirstToken); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TypeStage, StartTimeStage, ModelParametersStage, InputStage, MetadataStage, OutputStage, UsageStage, LevelStage, EnvironmentStage, _FinalStage { - private String id; - - private String type; - - private OffsetDateTime startTime; - - private Object modelParameters; - - private Object input; - - private Object metadata; - - private Object output; - - private Usage usage; - - private ObservationLevel level; - - private String environment; - - private Optional timeToFirstToken = Optional.empty(); - - private Optional latency = Optional.empty(); - - private Optional calculatedTotalCost = Optional.empty(); - - private Optional calculatedOutputCost = Optional.empty(); - - private Optional calculatedInputCost = Optional.empty(); - - private Optional totalPrice = Optional.empty(); - - private Optional outputPrice = Optional.empty(); - - private Optional inputPrice = Optional.empty(); - - private Optional modelId = Optional.empty(); - - private Optional promptVersion = Optional.empty(); - - private Optional promptName = Optional.empty(); - - private Map costDetails = new LinkedHashMap<>(); - - private Map usageDetails = new LinkedHashMap<>(); - - private Optional promptId = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional completionStartTime = Optional.empty(); - - private Optional endTime = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(ObservationsView other) { - id(other.getId()); - traceId(other.getTraceId()); - type(other.getType()); - name(other.getName()); - startTime(other.getStartTime()); - endTime(other.getEndTime()); - completionStartTime(other.getCompletionStartTime()); - model(other.getModel()); - modelParameters(other.getModelParameters()); - input(other.getInput()); - version(other.getVersion()); - metadata(other.getMetadata()); - output(other.getOutput()); - usage(other.getUsage()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - promptId(other.getPromptId()); - usageDetails(other.getUsageDetails()); - costDetails(other.getCostDetails()); - environment(other.getEnvironment()); - promptName(other.getPromptName()); - promptVersion(other.getPromptVersion()); - modelId(other.getModelId()); - inputPrice(other.getInputPrice()); - outputPrice(other.getOutputPrice()); - totalPrice(other.getTotalPrice()); - calculatedInputCost(other.getCalculatedInputCost()); - calculatedOutputCost(other.getCalculatedOutputCost()); - calculatedTotalCost(other.getCalculatedTotalCost()); - latency(other.getLatency()); - timeToFirstToken(other.getTimeToFirstToken()); - return this; - } - - /** - *

The unique identifier of the observation

- *

The unique identifier of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TypeStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

The type of the observation

- *

The type of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("type") - public StartTimeStage type(@NotNull String type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - /** - *

The start time of the observation

- *

The start time of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("startTime") - public ModelParametersStage startTime(@NotNull OffsetDateTime startTime) { - this.startTime = Objects.requireNonNull(startTime, "startTime must not be null"); - return this; - } - - /** - *

The parameters of the model used for the observation

- *

The parameters of the model used for the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("modelParameters") - public InputStage modelParameters(Object modelParameters) { - this.modelParameters = modelParameters; - return this; - } - - /** - *

The input data of the observation

- *

The input data of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("input") - public MetadataStage input(Object input) { - this.input = input; - return this; - } - - /** - *

Additional metadata of the observation

- *

Additional metadata of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public OutputStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The output data of the observation

- *

The output data of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("output") - public UsageStage output(Object output) { - this.output = output; - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation

- *

(Deprecated. Use usageDetails and costDetails instead.) The usage data of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("usage") - public LevelStage usage(@NotNull Usage usage) { - this.usage = Objects.requireNonNull(usage, "usage must not be null"); - return this; - } - - /** - *

The level of the observation

- *

The level of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("level") - public EnvironmentStage level(@NotNull ObservationLevel level) { - this.level = Objects.requireNonNull(level, "level must not be null"); - return this; - } - - /** - *

The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this observation originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The time to the first token in seconds

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage timeToFirstToken(Nullable timeToFirstToken) { - if (timeToFirstToken.isNull()) { - this.timeToFirstToken = null; - } - else if (timeToFirstToken.isEmpty()) { - this.timeToFirstToken = Optional.empty(); - } - else { - this.timeToFirstToken = Optional.of(timeToFirstToken.get()); - } - return this; - } - - /** - *

The time to the first token in seconds

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage timeToFirstToken(Double timeToFirstToken) { - this.timeToFirstToken = Optional.ofNullable(timeToFirstToken); - return this; - } - - /** - *

The time to the first token in seconds

- */ - @java.lang.Override - @JsonSetter( - value = "timeToFirstToken", - nulls = Nulls.SKIP - ) - public _FinalStage timeToFirstToken(Optional timeToFirstToken) { - this.timeToFirstToken = timeToFirstToken; - return this; - } - - /** - *

The latency in seconds.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage latency(Nullable latency) { - if (latency.isNull()) { - this.latency = null; - } - else if (latency.isEmpty()) { - this.latency = Optional.empty(); - } - else { - this.latency = Optional.of(latency.get()); - } - return this; - } - - /** - *

The latency in seconds.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage latency(Double latency) { - this.latency = Optional.ofNullable(latency); - return this; - } - - /** - *

The latency in seconds.

- */ - @java.lang.Override - @JsonSetter( - value = "latency", - nulls = Nulls.SKIP - ) - public _FinalStage latency(Optional latency) { - this.latency = latency; - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated total cost in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage calculatedTotalCost(Nullable calculatedTotalCost) { - if (calculatedTotalCost.isNull()) { - this.calculatedTotalCost = null; - } - else if (calculatedTotalCost.isEmpty()) { - this.calculatedTotalCost = Optional.empty(); - } - else { - this.calculatedTotalCost = Optional.of(calculatedTotalCost.get()); - } - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated total cost in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage calculatedTotalCost(Double calculatedTotalCost) { - this.calculatedTotalCost = Optional.ofNullable(calculatedTotalCost); - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated total cost in USD

- */ - @java.lang.Override - @JsonSetter( - value = "calculatedTotalCost", - nulls = Nulls.SKIP - ) - public _FinalStage calculatedTotalCost(Optional calculatedTotalCost) { - this.calculatedTotalCost = calculatedTotalCost; - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the output in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage calculatedOutputCost(Nullable calculatedOutputCost) { - if (calculatedOutputCost.isNull()) { - this.calculatedOutputCost = null; - } - else if (calculatedOutputCost.isEmpty()) { - this.calculatedOutputCost = Optional.empty(); - } - else { - this.calculatedOutputCost = Optional.of(calculatedOutputCost.get()); - } - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the output in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage calculatedOutputCost(Double calculatedOutputCost) { - this.calculatedOutputCost = Optional.ofNullable(calculatedOutputCost); - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the output in USD

- */ - @java.lang.Override - @JsonSetter( - value = "calculatedOutputCost", - nulls = Nulls.SKIP - ) - public _FinalStage calculatedOutputCost(Optional calculatedOutputCost) { - this.calculatedOutputCost = calculatedOutputCost; - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the input in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage calculatedInputCost(Nullable calculatedInputCost) { - if (calculatedInputCost.isNull()) { - this.calculatedInputCost = null; - } - else if (calculatedInputCost.isEmpty()) { - this.calculatedInputCost = Optional.empty(); - } - else { - this.calculatedInputCost = Optional.of(calculatedInputCost.get()); - } - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the input in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage calculatedInputCost(Double calculatedInputCost) { - this.calculatedInputCost = Optional.ofNullable(calculatedInputCost); - return this; - } - - /** - *

(Deprecated. Use usageDetails and costDetails instead.) The calculated cost of the input in USD

- */ - @java.lang.Override - @JsonSetter( - value = "calculatedInputCost", - nulls = Nulls.SKIP - ) - public _FinalStage calculatedInputCost(Optional calculatedInputCost) { - this.calculatedInputCost = calculatedInputCost; - return this; - } - - /** - *

The total price in USD.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage totalPrice(Nullable totalPrice) { - if (totalPrice.isNull()) { - this.totalPrice = null; - } - else if (totalPrice.isEmpty()) { - this.totalPrice = Optional.empty(); - } - else { - this.totalPrice = Optional.of(totalPrice.get()); - } - return this; - } - - /** - *

The total price in USD.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage totalPrice(Double totalPrice) { - this.totalPrice = Optional.ofNullable(totalPrice); - return this; - } - - /** - *

The total price in USD.

- */ - @java.lang.Override - @JsonSetter( - value = "totalPrice", - nulls = Nulls.SKIP - ) - public _FinalStage totalPrice(Optional totalPrice) { - this.totalPrice = totalPrice; - return this; - } - - /** - *

The price of the output in USD.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage outputPrice(Nullable outputPrice) { - if (outputPrice.isNull()) { - this.outputPrice = null; - } - else if (outputPrice.isEmpty()) { - this.outputPrice = Optional.empty(); - } - else { - this.outputPrice = Optional.of(outputPrice.get()); - } - return this; - } - - /** - *

The price of the output in USD.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage outputPrice(Double outputPrice) { - this.outputPrice = Optional.ofNullable(outputPrice); - return this; - } - - /** - *

The price of the output in USD.

- */ - @java.lang.Override - @JsonSetter( - value = "outputPrice", - nulls = Nulls.SKIP - ) - public _FinalStage outputPrice(Optional outputPrice) { - this.outputPrice = outputPrice; - return this; - } - - /** - *

The price of the input in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage inputPrice(Nullable inputPrice) { - if (inputPrice.isNull()) { - this.inputPrice = null; - } - else if (inputPrice.isEmpty()) { - this.inputPrice = Optional.empty(); - } - else { - this.inputPrice = Optional.of(inputPrice.get()); - } - return this; - } - - /** - *

The price of the input in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage inputPrice(Double inputPrice) { - this.inputPrice = Optional.ofNullable(inputPrice); - return this; - } - - /** - *

The price of the input in USD

- */ - @java.lang.Override - @JsonSetter( - value = "inputPrice", - nulls = Nulls.SKIP - ) - public _FinalStage inputPrice(Optional inputPrice) { - this.inputPrice = inputPrice; - return this; - } - - /** - *

The unique identifier of the model

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage modelId(Nullable modelId) { - if (modelId.isNull()) { - this.modelId = null; - } - else if (modelId.isEmpty()) { - this.modelId = Optional.empty(); - } - else { - this.modelId = Optional.of(modelId.get()); - } - return this; - } - - /** - *

The unique identifier of the model

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage modelId(String modelId) { - this.modelId = Optional.ofNullable(modelId); - return this; - } - - /** - *

The unique identifier of the model

- */ - @java.lang.Override - @JsonSetter( - value = "modelId", - nulls = Nulls.SKIP - ) - public _FinalStage modelId(Optional modelId) { - this.modelId = modelId; - return this; - } - - /** - *

The version of the prompt associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage promptVersion(Nullable promptVersion) { - if (promptVersion.isNull()) { - this.promptVersion = null; - } - else if (promptVersion.isEmpty()) { - this.promptVersion = Optional.empty(); - } - else { - this.promptVersion = Optional.of(promptVersion.get()); - } - return this; - } - - /** - *

The version of the prompt associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage promptVersion(Integer promptVersion) { - this.promptVersion = Optional.ofNullable(promptVersion); - return this; - } - - /** - *

The version of the prompt associated with the observation

- */ - @java.lang.Override - @JsonSetter( - value = "promptVersion", - nulls = Nulls.SKIP - ) - public _FinalStage promptVersion(Optional promptVersion) { - this.promptVersion = promptVersion; - return this; - } - - /** - *

The name of the prompt associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage promptName(Nullable promptName) { - if (promptName.isNull()) { - this.promptName = null; - } - else if (promptName.isEmpty()) { - this.promptName = Optional.empty(); - } - else { - this.promptName = Optional.of(promptName.get()); - } - return this; - } - - /** - *

The name of the prompt associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage promptName(String promptName) { - this.promptName = Optional.ofNullable(promptName); - return this; - } - - /** - *

The name of the prompt associated with the observation

- */ - @java.lang.Override - @JsonSetter( - value = "promptName", - nulls = Nulls.SKIP - ) - public _FinalStage promptName(Optional promptName) { - this.promptName = promptName; - return this; - } - - /** - *

The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage costDetails(String key, Double value) { - this.costDetails.put(key, value); - return this; - } - - /** - *

The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage putAllCostDetails(Map costDetails) { - if (costDetails != null) { - this.costDetails.putAll(costDetails); - } - return this; - } - - /** - *

The cost details of the observation. Key is the name of the cost metric, value is the cost in USD. The total key is the sum of all (non-total) cost metrics or the total value ingested.

- */ - @java.lang.Override - @JsonSetter( - value = "costDetails", - nulls = Nulls.SKIP - ) - public _FinalStage costDetails(Map costDetails) { - this.costDetails.clear(); - if (costDetails != null) { - this.costDetails.putAll(costDetails); - } - return this; - } - - /** - *

The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage usageDetails(String key, Integer value) { - this.usageDetails.put(key, value); - return this; - } - - /** - *

The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage putAllUsageDetails(Map usageDetails) { - if (usageDetails != null) { - this.usageDetails.putAll(usageDetails); - } - return this; - } - - /** - *

The usage details of the observation. Key is the name of the usage metric, value is the number of units consumed. The total key is the sum of all (non-total) usage metrics or the total value ingested.

- */ - @java.lang.Override - @JsonSetter( - value = "usageDetails", - nulls = Nulls.SKIP - ) - public _FinalStage usageDetails(Map usageDetails) { - this.usageDetails.clear(); - if (usageDetails != null) { - this.usageDetails.putAll(usageDetails); - } - return this; - } - - /** - *

The prompt ID associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage promptId(Nullable promptId) { - if (promptId.isNull()) { - this.promptId = null; - } - else if (promptId.isEmpty()) { - this.promptId = Optional.empty(); - } - else { - this.promptId = Optional.of(promptId.get()); - } - return this; - } - - /** - *

The prompt ID associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage promptId(String promptId) { - this.promptId = Optional.ofNullable(promptId); - return this; - } - - /** - *

The prompt ID associated with the observation

- */ - @java.lang.Override - @JsonSetter( - value = "promptId", - nulls = Nulls.SKIP - ) - public _FinalStage promptId(Optional promptId) { - this.promptId = promptId; - return this; - } - - /** - *

The parent observation ID

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage parentObservationId(Nullable parentObservationId) { - if (parentObservationId.isNull()) { - this.parentObservationId = null; - } - else if (parentObservationId.isEmpty()) { - this.parentObservationId = Optional.empty(); - } - else { - this.parentObservationId = Optional.of(parentObservationId.get()); - } - return this; - } - - /** - *

The parent observation ID

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - /** - *

The parent observation ID

- */ - @java.lang.Override - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public _FinalStage parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - /** - *

The status message of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage statusMessage(Nullable statusMessage) { - if (statusMessage.isNull()) { - this.statusMessage = null; - } - else if (statusMessage.isEmpty()) { - this.statusMessage = Optional.empty(); - } - else { - this.statusMessage = Optional.of(statusMessage.get()); - } - return this; - } - - /** - *

The status message of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - /** - *

The status message of the observation

- */ - @java.lang.Override - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public _FinalStage statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - /** - *

The version of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(Nullable version) { - if (version.isNull()) { - this.version = null; - } - else if (version.isEmpty()) { - this.version = Optional.empty(); - } - else { - this.version = Optional.of(version.get()); - } - return this; - } - - /** - *

The version of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** - *

The version of the observation

- */ - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - /** - *

The model used for the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage model(Nullable model) { - if (model.isNull()) { - this.model = null; - } - else if (model.isEmpty()) { - this.model = Optional.empty(); - } - else { - this.model = Optional.of(model.get()); - } - return this; - } - - /** - *

The model used for the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage model(String model) { - this.model = Optional.ofNullable(model); - return this; - } - - /** - *

The model used for the observation

- */ - @java.lang.Override - @JsonSetter( - value = "model", - nulls = Nulls.SKIP - ) - public _FinalStage model(Optional model) { - this.model = model; - return this; - } - - /** - *

The completion start time of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage completionStartTime(Nullable completionStartTime) { - if (completionStartTime.isNull()) { - this.completionStartTime = null; - } - else if (completionStartTime.isEmpty()) { - this.completionStartTime = Optional.empty(); - } - else { - this.completionStartTime = Optional.of(completionStartTime.get()); - } - return this; - } - - /** - *

The completion start time of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage completionStartTime(OffsetDateTime completionStartTime) { - this.completionStartTime = Optional.ofNullable(completionStartTime); - return this; - } - - /** - *

The completion start time of the observation

- */ - @java.lang.Override - @JsonSetter( - value = "completionStartTime", - nulls = Nulls.SKIP - ) - public _FinalStage completionStartTime(Optional completionStartTime) { - this.completionStartTime = completionStartTime; - return this; - } - - /** - *

The end time of the observation.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage endTime(Nullable endTime) { - if (endTime.isNull()) { - this.endTime = null; - } - else if (endTime.isEmpty()) { - this.endTime = Optional.empty(); - } - else { - this.endTime = Optional.of(endTime.get()); - } - return this; - } - - /** - *

The end time of the observation.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage endTime(OffsetDateTime endTime) { - this.endTime = Optional.ofNullable(endTime); - return this; - } - - /** - *

The end time of the observation.

- */ - @java.lang.Override - @JsonSetter( - value = "endTime", - nulls = Nulls.SKIP - ) - public _FinalStage endTime(Optional endTime) { - this.endTime = endTime; - return this; - } - - /** - *

The name of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(Nullable name) { - if (name.isNull()) { - this.name = null; - } - else if (name.isEmpty()) { - this.name = Optional.empty(); - } - else { - this.name = Optional.of(name.get()); - } - return this; - } - - /** - *

The name of the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - /** - *

The name of the observation

- */ - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - /** - *

The trace ID associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the observation

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the observation

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public ObservationsView build() { - return new ObservationsView(id, traceId, type, name, startTime, endTime, completionStartTime, model, modelParameters, input, version, metadata, output, usage, level, statusMessage, parentObservationId, promptId, usageDetails, costDetails, environment, promptName, promptVersion, modelId, inputPrice, outputPrice, totalPrice, calculatedInputCost, calculatedOutputCost, calculatedTotalCost, latency, timeToFirstToken, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/Score.java b/src/main/java/com/langfuse/client/resources/commons/types/Score.java deleted file mode 100644 index 7b49476..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/Score.java +++ /dev/null @@ -1,347 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.annotation.JsonValue; -import java.lang.Object; -import java.lang.String; -import java.util.Objects; -import java.util.Optional; - -public final class Score { - private final Value value; - - @JsonCreator( - mode = JsonCreator.Mode.DELEGATING - ) - private Score(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static Score numeric(NumericScore value) { - return new Score(new NumericValue(value)); - } - - public static Score categorical(CategoricalScore value) { - return new Score(new CategoricalValue(value)); - } - - public static Score boolean_(BooleanScore value) { - return new Score(new BooleanValue(value)); - } - - public static Score correction(CorrectionScore value) { - return new Score(new CorrectionValue(value)); - } - - public boolean isNumeric() { - return value instanceof NumericValue; - } - - public boolean isCategorical() { - return value instanceof CategoricalValue; - } - - public boolean isBoolean() { - return value instanceof BooleanValue; - } - - public boolean isCorrection() { - return value instanceof CorrectionValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getNumeric() { - if (isNumeric()) { - return Optional.of(((NumericValue) value).value); - } - return Optional.empty(); - } - - public Optional getCategorical() { - if (isCategorical()) { - return Optional.of(((CategoricalValue) value).value); - } - return Optional.empty(); - } - - public Optional getBoolean() { - if (isBoolean()) { - return Optional.of(((BooleanValue) value).value); - } - return Optional.empty(); - } - - public Optional getCorrection() { - if (isCorrection()) { - return Optional.of(((CorrectionValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitNumeric(NumericScore numeric); - - T visitCategorical(CategoricalScore categorical); - - T visitBoolean(BooleanScore boolean_); - - T visitCorrection(CorrectionScore correction); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "dataType", - visible = true, - defaultImpl = _UnknownValue.class - ) - @JsonSubTypes({ - @JsonSubTypes.Type(NumericValue.class), - @JsonSubTypes.Type(CategoricalValue.class), - @JsonSubTypes.Type(BooleanValue.class), - @JsonSubTypes.Type(CorrectionValue.class) - }) - @JsonIgnoreProperties( - ignoreUnknown = true - ) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("NUMERIC") - @JsonIgnoreProperties("dataType") - private static final class NumericValue implements Value { - @JsonUnwrapped - private NumericScore value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private NumericValue() { - } - - private NumericValue(NumericScore value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitNumeric(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumericValue && equalTo((NumericValue) other); - } - - private boolean equalTo(NumericValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "Score{" + "value: " + value + "}"; - } - } - - @JsonTypeName("CATEGORICAL") - @JsonIgnoreProperties("dataType") - private static final class CategoricalValue implements Value { - @JsonUnwrapped - private CategoricalScore value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private CategoricalValue() { - } - - private CategoricalValue(CategoricalScore value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitCategorical(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CategoricalValue && equalTo((CategoricalValue) other); - } - - private boolean equalTo(CategoricalValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "Score{" + "value: " + value + "}"; - } - } - - @JsonTypeName("BOOLEAN") - @JsonIgnoreProperties("dataType") - private static final class BooleanValue implements Value { - @JsonUnwrapped - private BooleanScore value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private BooleanValue() { - } - - private BooleanValue(BooleanScore value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitBoolean(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanValue && equalTo((BooleanValue) other); - } - - private boolean equalTo(BooleanValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "Score{" + "value: " + value + "}"; - } - } - - @JsonTypeName("CORRECTION") - @JsonIgnoreProperties("dataType") - private static final class CorrectionValue implements Value { - @JsonUnwrapped - private CorrectionScore value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private CorrectionValue() { - } - - private CorrectionValue(CorrectionScore value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitCorrection(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CorrectionValue && equalTo((CorrectionValue) other); - } - - private boolean equalTo(CorrectionValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "Score{" + "value: " + value + "}"; - } - } - - @JsonIgnoreProperties("dataType") - private static final class _UnknownValue implements Value { - private String type; - - @JsonValue - private Object value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private _UnknownValue(@JsonProperty("value") Object value) { - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } - - @java.lang.Override - public String toString() { - return "Score{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/ScoreSource.java b/src/main/java/com/langfuse/client/resources/commons/types/ScoreSource.java deleted file mode 100644 index e49b4ad..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/ScoreSource.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import java.lang.Object; -import java.lang.String; - -public final class ScoreSource { - public static final ScoreSource API = new ScoreSource(Value.API, "API"); - - public static final ScoreSource ANNOTATION = new ScoreSource(Value.ANNOTATION, "ANNOTATION"); - - public static final ScoreSource EVAL = new ScoreSource(Value.EVAL, "EVAL"); - - private final Value value; - - private final String string; - - ScoreSource(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ScoreSource && this.string.equals(((ScoreSource) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case API: - return visitor.visitApi(); - case ANNOTATION: - return visitor.visitAnnotation(); - case EVAL: - return visitor.visitEval(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator( - mode = JsonCreator.Mode.DELEGATING - ) - public static ScoreSource valueOf(String value) { - switch (value) { - case "API": - return API; - case "ANNOTATION": - return ANNOTATION; - case "EVAL": - return EVAL; - default: - return new ScoreSource(Value.UNKNOWN, value); - } - } - - public enum Value { - ANNOTATION, - - API, - - EVAL, - - UNKNOWN - } - - public interface Visitor { - T visitAnnotation(); - - T visitApi(); - - T visitEval(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/ScoreV1.java b/src/main/java/com/langfuse/client/resources/commons/types/ScoreV1.java deleted file mode 100644 index 1747bbb..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/ScoreV1.java +++ /dev/null @@ -1,287 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.annotation.JsonValue; -import java.lang.Object; -import java.lang.String; -import java.util.Objects; -import java.util.Optional; - -public final class ScoreV1 { - private final Value value; - - @JsonCreator( - mode = JsonCreator.Mode.DELEGATING - ) - private ScoreV1(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static ScoreV1 numeric(NumericScoreV1 value) { - return new ScoreV1(new NumericValue(value)); - } - - public static ScoreV1 categorical(CategoricalScoreV1 value) { - return new ScoreV1(new CategoricalValue(value)); - } - - public static ScoreV1 boolean_(BooleanScoreV1 value) { - return new ScoreV1(new BooleanValue(value)); - } - - public boolean isNumeric() { - return value instanceof NumericValue; - } - - public boolean isCategorical() { - return value instanceof CategoricalValue; - } - - public boolean isBoolean() { - return value instanceof BooleanValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getNumeric() { - if (isNumeric()) { - return Optional.of(((NumericValue) value).value); - } - return Optional.empty(); - } - - public Optional getCategorical() { - if (isCategorical()) { - return Optional.of(((CategoricalValue) value).value); - } - return Optional.empty(); - } - - public Optional getBoolean() { - if (isBoolean()) { - return Optional.of(((BooleanValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitNumeric(NumericScoreV1 numeric); - - T visitCategorical(CategoricalScoreV1 categorical); - - T visitBoolean(BooleanScoreV1 boolean_); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "dataType", - visible = true, - defaultImpl = _UnknownValue.class - ) - @JsonSubTypes({ - @JsonSubTypes.Type(NumericValue.class), - @JsonSubTypes.Type(CategoricalValue.class), - @JsonSubTypes.Type(BooleanValue.class) - }) - @JsonIgnoreProperties( - ignoreUnknown = true - ) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("NUMERIC") - @JsonIgnoreProperties("dataType") - private static final class NumericValue implements Value { - @JsonUnwrapped - private NumericScoreV1 value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private NumericValue() { - } - - private NumericValue(NumericScoreV1 value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitNumeric(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumericValue && equalTo((NumericValue) other); - } - - private boolean equalTo(NumericValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "ScoreV1{" + "value: " + value + "}"; - } - } - - @JsonTypeName("CATEGORICAL") - @JsonIgnoreProperties("dataType") - private static final class CategoricalValue implements Value { - @JsonUnwrapped - private CategoricalScoreV1 value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private CategoricalValue() { - } - - private CategoricalValue(CategoricalScoreV1 value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitCategorical(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CategoricalValue && equalTo((CategoricalValue) other); - } - - private boolean equalTo(CategoricalValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "ScoreV1{" + "value: " + value + "}"; - } - } - - @JsonTypeName("BOOLEAN") - @JsonIgnoreProperties("dataType") - private static final class BooleanValue implements Value { - @JsonUnwrapped - private BooleanScoreV1 value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private BooleanValue() { - } - - private BooleanValue(BooleanScoreV1 value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitBoolean(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanValue && equalTo((BooleanValue) other); - } - - private boolean equalTo(BooleanValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "ScoreV1{" + "value: " + value + "}"; - } - } - - @JsonIgnoreProperties("dataType") - private static final class _UnknownValue implements Value { - private String type; - - @JsonValue - private Object value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private _UnknownValue(@JsonProperty("value") Object value) { - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } - - @java.lang.Override - public String toString() { - return "ScoreV1{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/Session.java b/src/main/java/com/langfuse/client/resources/commons/types/Session.java deleted file mode 100644 index a15e1fe..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/Session.java +++ /dev/null @@ -1,209 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = Session.Builder.class -) -public final class Session implements ISession { - private final String id; - - private final OffsetDateTime createdAt; - - private final String projectId; - - private final String environment; - - private final Map additionalProperties; - - private Session(String id, OffsetDateTime createdAt, String projectId, String environment, - Map additionalProperties) { - this.id = id; - this.createdAt = createdAt; - this.projectId = projectId; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("projectId") - @java.lang.Override - public String getProjectId() { - return projectId; - } - - /** - * @return The environment from which this session originated. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Session && equalTo((Session) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Session other) { - return id.equals(other.id) && createdAt.equals(other.createdAt) && projectId.equals(other.projectId) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.createdAt, this.projectId, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedAtStage id(@NotNull String id); - - Builder from(Session other); - } - - public interface CreatedAtStage { - ProjectIdStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface ProjectIdStage { - EnvironmentStage projectId(@NotNull String projectId); - } - - public interface EnvironmentStage { - /** - *

The environment from which this session originated.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - Session build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, CreatedAtStage, ProjectIdStage, EnvironmentStage, _FinalStage { - private String id; - - private OffsetDateTime createdAt; - - private String projectId; - - private String environment; - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(Session other) { - id(other.getId()); - createdAt(other.getCreatedAt()); - projectId(other.getProjectId()); - environment(other.getEnvironment()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public CreatedAtStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public ProjectIdStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("projectId") - public EnvironmentStage projectId(@NotNull String projectId) { - this.projectId = Objects.requireNonNull(projectId, "projectId must not be null"); - return this; - } - - /** - *

The environment from which this session originated.

- *

The environment from which this session originated.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - @java.lang.Override - public Session build() { - return new Session(id, createdAt, projectId, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/SessionWithTraces.java b/src/main/java/com/langfuse/client/resources/commons/types/SessionWithTraces.java deleted file mode 100644 index 5da28a2..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/SessionWithTraces.java +++ /dev/null @@ -1,256 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = SessionWithTraces.Builder.class -) -public final class SessionWithTraces implements ISession { - private final String id; - - private final OffsetDateTime createdAt; - - private final String projectId; - - private final String environment; - - private final List traces; - - private final Map additionalProperties; - - private SessionWithTraces(String id, OffsetDateTime createdAt, String projectId, - String environment, List traces, Map additionalProperties) { - this.id = id; - this.createdAt = createdAt; - this.projectId = projectId; - this.environment = environment; - this.traces = traces; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("projectId") - @java.lang.Override - public String getProjectId() { - return projectId; - } - - /** - * @return The environment from which this session originated. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonProperty("traces") - public List getTraces() { - return traces; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SessionWithTraces && equalTo((SessionWithTraces) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SessionWithTraces other) { - return id.equals(other.id) && createdAt.equals(other.createdAt) && projectId.equals(other.projectId) && environment.equals(other.environment) && traces.equals(other.traces); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.createdAt, this.projectId, this.environment, this.traces); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - CreatedAtStage id(@NotNull String id); - - Builder from(SessionWithTraces other); - } - - public interface CreatedAtStage { - ProjectIdStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface ProjectIdStage { - EnvironmentStage projectId(@NotNull String projectId); - } - - public interface EnvironmentStage { - /** - *

The environment from which this session originated.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - SessionWithTraces build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage traces(List traces); - - _FinalStage addTraces(Trace traces); - - _FinalStage addAllTraces(List traces); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, CreatedAtStage, ProjectIdStage, EnvironmentStage, _FinalStage { - private String id; - - private OffsetDateTime createdAt; - - private String projectId; - - private String environment; - - private List traces = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(SessionWithTraces other) { - id(other.getId()); - createdAt(other.getCreatedAt()); - projectId(other.getProjectId()); - environment(other.getEnvironment()); - traces(other.getTraces()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public CreatedAtStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public ProjectIdStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("projectId") - public EnvironmentStage projectId(@NotNull String projectId) { - this.projectId = Objects.requireNonNull(projectId, "projectId must not be null"); - return this; - } - - /** - *

The environment from which this session originated.

- *

The environment from which this session originated.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllTraces(List traces) { - if (traces != null) { - this.traces.addAll(traces); - } - return this; - } - - @java.lang.Override - public _FinalStage addTraces(Trace traces) { - this.traces.add(traces); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "traces", - nulls = Nulls.SKIP - ) - public _FinalStage traces(List traces) { - this.traces.clear(); - if (traces != null) { - this.traces.addAll(traces); - } - return this; - } - - @java.lang.Override - public SessionWithTraces build() { - return new SessionWithTraces(id, createdAt, projectId, environment, traces, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/Trace.java b/src/main/java/com/langfuse/client/resources/commons/types/Trace.java deleted file mode 100644 index 2d16f5f..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/Trace.java +++ /dev/null @@ -1,834 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = Trace.Builder.class -) -public final class Trace implements ITrace { - private final String id; - - private final OffsetDateTime timestamp; - - private final Optional name; - - private final Optional input; - - private final Optional output; - - private final Optional sessionId; - - private final Optional release; - - private final Optional version; - - private final Optional userId; - - private final Optional metadata; - - private final List tags; - - private final boolean public_; - - private final String environment; - - private final Map additionalProperties; - - private Trace(String id, OffsetDateTime timestamp, Optional name, Optional input, - Optional output, Optional sessionId, Optional release, - Optional version, Optional userId, Optional metadata, - List tags, boolean public_, String environment, - Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.name = name; - this.input = input; - this.output = output; - this.sessionId = sessionId; - this.release = release; - this.version = version; - this.userId = userId; - this.metadata = metadata; - this.tags = tags; - this.public_ = public_; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of a trace - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The timestamp when the trace was created - */ - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - /** - * @return The name of the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getName() { - if (name == null) { - return Optional.empty(); - } - return name; - } - - /** - * @return The input data of the trace. Can be any JSON. - */ - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - /** - * @return The output data of the trace. Can be any JSON. - */ - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - /** - * @return The session identifier associated with the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The release version of the application when the trace was created - */ - @JsonIgnore - @java.lang.Override - public Optional getRelease() { - if (release == null) { - return Optional.empty(); - } - return release; - } - - /** - * @return The version of the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getVersion() { - if (version == null) { - return Optional.empty(); - } - return version; - } - - /** - * @return The user identifier associated with the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getUserId() { - if (userId == null) { - return Optional.empty(); - } - return userId; - } - - /** - * @return The metadata associated with the trace. Can be any JSON. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - /** - * @return The tags associated with the trace. - */ - @JsonProperty("tags") - @java.lang.Override - public List getTags() { - return tags; - } - - /** - * @return Public traces are accessible via url without login - */ - @JsonProperty("public") - @java.lang.Override - public boolean getPublic() { - return public_; - } - - /** - * @return The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("name") - private Optional _getName() { - return name; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("release") - private Optional _getRelease() { - return release; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("version") - private Optional _getVersion() { - return version; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("userId") - private Optional _getUserId() { - return userId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Trace && equalTo((Trace) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Trace other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && name.equals(other.name) && input.equals(other.input) && output.equals(other.output) && sessionId.equals(other.sessionId) && release.equals(other.release) && version.equals(other.version) && userId.equals(other.userId) && metadata.equals(other.metadata) && tags.equals(other.tags) && public_ == other.public_ && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.name, this.input, this.output, this.sessionId, this.release, this.version, this.userId, this.metadata, this.tags, this.public_, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

The unique identifier of a trace

- */ - TimestampStage id(@NotNull String id); - - Builder from(Trace other); - } - - public interface TimestampStage { - /** - *

The timestamp when the trace was created

- */ - PublicStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface PublicStage { - /** - *

Public traces are accessible via url without login

- */ - EnvironmentStage public_(boolean public_); - } - - public interface EnvironmentStage { - /** - *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - Trace build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The name of the trace

- */ - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage name(Nullable name); - - /** - *

The input data of the trace. Can be any JSON.

- */ - _FinalStage input(Optional input); - - _FinalStage input(Object input); - - /** - *

The output data of the trace. Can be any JSON.

- */ - _FinalStage output(Optional output); - - _FinalStage output(Object output); - - /** - *

The session identifier associated with the trace

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The release version of the application when the trace was created

- */ - _FinalStage release(Optional release); - - _FinalStage release(String release); - - _FinalStage release(Nullable release); - - /** - *

The version of the trace

- */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage version(Nullable version); - - /** - *

The user identifier associated with the trace

- */ - _FinalStage userId(Optional userId); - - _FinalStage userId(String userId); - - _FinalStage userId(Nullable userId); - - /** - *

The metadata associated with the trace. Can be any JSON.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - /** - *

The tags associated with the trace.

- */ - _FinalStage tags(List tags); - - _FinalStage addTags(String tags); - - _FinalStage addAllTags(List tags); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, PublicStage, EnvironmentStage, _FinalStage { - private String id; - - private OffsetDateTime timestamp; - - private boolean public_; - - private String environment; - - private List tags = new ArrayList<>(); - - private Optional metadata = Optional.empty(); - - private Optional userId = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional release = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional name = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(Trace other) { - id(other.getId()); - timestamp(other.getTimestamp()); - name(other.getName()); - input(other.getInput()); - output(other.getOutput()); - sessionId(other.getSessionId()); - release(other.getRelease()); - version(other.getVersion()); - userId(other.getUserId()); - metadata(other.getMetadata()); - tags(other.getTags()); - public_(other.getPublic()); - environment(other.getEnvironment()); - return this; - } - - /** - *

The unique identifier of a trace

- *

The unique identifier of a trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

The timestamp when the trace was created

- *

The timestamp when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public PublicStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - /** - *

Public traces are accessible via url without login

- *

Public traces are accessible via url without login

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("public") - public EnvironmentStage public_(boolean public_) { - this.public_ = public_; - return this; - } - - /** - *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

The tags associated with the trace.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllTags(List tags) { - if (tags != null) { - this.tags.addAll(tags); - } - return this; - } - - /** - *

The tags associated with the trace.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addTags(String tags) { - this.tags.add(tags); - return this; - } - - /** - *

The tags associated with the trace.

- */ - @java.lang.Override - @JsonSetter( - value = "tags", - nulls = Nulls.SKIP - ) - public _FinalStage tags(List tags) { - this.tags.clear(); - if (tags != null) { - this.tags.addAll(tags); - } - return this; - } - - /** - *

The metadata associated with the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

The metadata associated with the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The user identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage userId(Nullable userId) { - if (userId.isNull()) { - this.userId = null; - } - else if (userId.isEmpty()) { - this.userId = Optional.empty(); - } - else { - this.userId = Optional.of(userId.get()); - } - return this; - } - - /** - *

The user identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - /** - *

The user identifier associated with the trace

- */ - @java.lang.Override - @JsonSetter( - value = "userId", - nulls = Nulls.SKIP - ) - public _FinalStage userId(Optional userId) { - this.userId = userId; - return this; - } - - /** - *

The version of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(Nullable version) { - if (version.isNull()) { - this.version = null; - } - else if (version.isEmpty()) { - this.version = Optional.empty(); - } - else { - this.version = Optional.of(version.get()); - } - return this; - } - - /** - *

The version of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** - *

The version of the trace

- */ - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - /** - *

The release version of the application when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage release(Nullable release) { - if (release.isNull()) { - this.release = null; - } - else if (release.isEmpty()) { - this.release = Optional.empty(); - } - else { - this.release = Optional.of(release.get()); - } - return this; - } - - /** - *

The release version of the application when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage release(String release) { - this.release = Optional.ofNullable(release); - return this; - } - - /** - *

The release version of the application when the trace was created

- */ - @java.lang.Override - @JsonSetter( - value = "release", - nulls = Nulls.SKIP - ) - public _FinalStage release(Optional release) { - this.release = release; - return this; - } - - /** - *

The session identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session identifier associated with the trace

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The output data of the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - /** - *

The output data of the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public _FinalStage output(Optional output) { - this.output = output; - return this; - } - - /** - *

The input data of the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - /** - *

The input data of the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public _FinalStage input(Optional input) { - this.input = input; - return this; - } - - /** - *

The name of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(Nullable name) { - if (name.isNull()) { - this.name = null; - } - else if (name.isEmpty()) { - this.name = Optional.empty(); - } - else { - this.name = Optional.of(name.get()); - } - return this; - } - - /** - *

The name of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - /** - *

The name of the trace

- */ - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @java.lang.Override - public Trace build() { - return new Trace(id, timestamp, name, input, output, sessionId, release, version, userId, metadata, tags, public_, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/TraceWithDetails.java b/src/main/java/com/langfuse/client/resources/commons/types/TraceWithDetails.java deleted file mode 100644 index 1efa3e5..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/TraceWithDetails.java +++ /dev/null @@ -1,1174 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Double; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = TraceWithDetails.Builder.class -) -public final class TraceWithDetails implements ITrace { - private final String id; - - private final OffsetDateTime timestamp; - - private final Optional name; - - private final Optional input; - - private final Optional output; - - private final Optional sessionId; - - private final Optional release; - - private final Optional version; - - private final Optional userId; - - private final Optional metadata; - - private final List tags; - - private final boolean public_; - - private final String environment; - - private final String htmlPath; - - private final Optional latency; - - private final Optional totalCost; - - private final Optional> observations; - - private final Optional> scores; - - private final Map additionalProperties; - - private TraceWithDetails(String id, OffsetDateTime timestamp, Optional name, - Optional input, Optional output, Optional sessionId, - Optional release, Optional version, Optional userId, - Optional metadata, List tags, boolean public_, String environment, - String htmlPath, Optional latency, Optional totalCost, - Optional> observations, Optional> scores, - Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.name = name; - this.input = input; - this.output = output; - this.sessionId = sessionId; - this.release = release; - this.version = version; - this.userId = userId; - this.metadata = metadata; - this.tags = tags; - this.public_ = public_; - this.environment = environment; - this.htmlPath = htmlPath; - this.latency = latency; - this.totalCost = totalCost; - this.observations = observations; - this.scores = scores; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of a trace - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The timestamp when the trace was created - */ - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - /** - * @return The name of the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getName() { - if (name == null) { - return Optional.empty(); - } - return name; - } - - /** - * @return The input data of the trace. Can be any JSON. - */ - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - /** - * @return The output data of the trace. Can be any JSON. - */ - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - /** - * @return The session identifier associated with the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The release version of the application when the trace was created - */ - @JsonIgnore - @java.lang.Override - public Optional getRelease() { - if (release == null) { - return Optional.empty(); - } - return release; - } - - /** - * @return The version of the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getVersion() { - if (version == null) { - return Optional.empty(); - } - return version; - } - - /** - * @return The user identifier associated with the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getUserId() { - if (userId == null) { - return Optional.empty(); - } - return userId; - } - - /** - * @return The metadata associated with the trace. Can be any JSON. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - /** - * @return The tags associated with the trace. - */ - @JsonProperty("tags") - @java.lang.Override - public List getTags() { - return tags; - } - - /** - * @return Public traces are accessible via url without login - */ - @JsonProperty("public") - @java.lang.Override - public boolean getPublic() { - return public_; - } - - /** - * @return The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - /** - * @return Path of trace in Langfuse UI - */ - @JsonProperty("htmlPath") - public String getHtmlPath() { - return htmlPath; - } - - /** - * @return Latency of trace in seconds - */ - @JsonIgnore - public Optional getLatency() { - if (latency == null) { - return Optional.empty(); - } - return latency; - } - - /** - * @return Cost of trace in USD - */ - @JsonIgnore - public Optional getTotalCost() { - if (totalCost == null) { - return Optional.empty(); - } - return totalCost; - } - - /** - * @return List of observation ids - */ - @JsonIgnore - public Optional> getObservations() { - if (observations == null) { - return Optional.empty(); - } - return observations; - } - - /** - * @return List of score ids - */ - @JsonIgnore - public Optional> getScores() { - if (scores == null) { - return Optional.empty(); - } - return scores; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("name") - private Optional _getName() { - return name; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("release") - private Optional _getRelease() { - return release; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("version") - private Optional _getVersion() { - return version; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("userId") - private Optional _getUserId() { - return userId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("latency") - private Optional _getLatency() { - return latency; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("totalCost") - private Optional _getTotalCost() { - return totalCost; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observations") - private Optional> _getObservations() { - return observations; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("scores") - private Optional> _getScores() { - return scores; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TraceWithDetails && equalTo((TraceWithDetails) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(TraceWithDetails other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && name.equals(other.name) && input.equals(other.input) && output.equals(other.output) && sessionId.equals(other.sessionId) && release.equals(other.release) && version.equals(other.version) && userId.equals(other.userId) && metadata.equals(other.metadata) && tags.equals(other.tags) && public_ == other.public_ && environment.equals(other.environment) && htmlPath.equals(other.htmlPath) && latency.equals(other.latency) && totalCost.equals(other.totalCost) && observations.equals(other.observations) && scores.equals(other.scores); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.name, this.input, this.output, this.sessionId, this.release, this.version, this.userId, this.metadata, this.tags, this.public_, this.environment, this.htmlPath, this.latency, this.totalCost, this.observations, this.scores); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

The unique identifier of a trace

- */ - TimestampStage id(@NotNull String id); - - Builder from(TraceWithDetails other); - } - - public interface TimestampStage { - /** - *

The timestamp when the trace was created

- */ - PublicStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface PublicStage { - /** - *

Public traces are accessible via url without login

- */ - EnvironmentStage public_(boolean public_); - } - - public interface EnvironmentStage { - /** - *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - HtmlPathStage environment(@NotNull String environment); - } - - public interface HtmlPathStage { - /** - *

Path of trace in Langfuse UI

- */ - _FinalStage htmlPath(@NotNull String htmlPath); - } - - public interface _FinalStage { - TraceWithDetails build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The name of the trace

- */ - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage name(Nullable name); - - /** - *

The input data of the trace. Can be any JSON.

- */ - _FinalStage input(Optional input); - - _FinalStage input(Object input); - - /** - *

The output data of the trace. Can be any JSON.

- */ - _FinalStage output(Optional output); - - _FinalStage output(Object output); - - /** - *

The session identifier associated with the trace

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The release version of the application when the trace was created

- */ - _FinalStage release(Optional release); - - _FinalStage release(String release); - - _FinalStage release(Nullable release); - - /** - *

The version of the trace

- */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage version(Nullable version); - - /** - *

The user identifier associated with the trace

- */ - _FinalStage userId(Optional userId); - - _FinalStage userId(String userId); - - _FinalStage userId(Nullable userId); - - /** - *

The metadata associated with the trace. Can be any JSON.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - /** - *

The tags associated with the trace.

- */ - _FinalStage tags(List tags); - - _FinalStage addTags(String tags); - - _FinalStage addAllTags(List tags); - - /** - *

Latency of trace in seconds

- */ - _FinalStage latency(Optional latency); - - _FinalStage latency(Double latency); - - _FinalStage latency(Nullable latency); - - /** - *

Cost of trace in USD

- */ - _FinalStage totalCost(Optional totalCost); - - _FinalStage totalCost(Double totalCost); - - _FinalStage totalCost(Nullable totalCost); - - /** - *

List of observation ids

- */ - _FinalStage observations(Optional> observations); - - _FinalStage observations(List observations); - - _FinalStage observations(Nullable> observations); - - /** - *

List of score ids

- */ - _FinalStage scores(Optional> scores); - - _FinalStage scores(List scores); - - _FinalStage scores(Nullable> scores); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, PublicStage, EnvironmentStage, HtmlPathStage, _FinalStage { - private String id; - - private OffsetDateTime timestamp; - - private boolean public_; - - private String environment; - - private String htmlPath; - - private Optional> scores = Optional.empty(); - - private Optional> observations = Optional.empty(); - - private Optional totalCost = Optional.empty(); - - private Optional latency = Optional.empty(); - - private List tags = new ArrayList<>(); - - private Optional metadata = Optional.empty(); - - private Optional userId = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional release = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional name = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(TraceWithDetails other) { - id(other.getId()); - timestamp(other.getTimestamp()); - name(other.getName()); - input(other.getInput()); - output(other.getOutput()); - sessionId(other.getSessionId()); - release(other.getRelease()); - version(other.getVersion()); - userId(other.getUserId()); - metadata(other.getMetadata()); - tags(other.getTags()); - public_(other.getPublic()); - environment(other.getEnvironment()); - htmlPath(other.getHtmlPath()); - latency(other.getLatency()); - totalCost(other.getTotalCost()); - observations(other.getObservations()); - scores(other.getScores()); - return this; - } - - /** - *

The unique identifier of a trace

- *

The unique identifier of a trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

The timestamp when the trace was created

- *

The timestamp when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public PublicStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - /** - *

Public traces are accessible via url without login

- *

Public traces are accessible via url without login

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("public") - public EnvironmentStage public_(boolean public_) { - this.public_ = public_; - return this; - } - - /** - *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public HtmlPathStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

Path of trace in Langfuse UI

- *

Path of trace in Langfuse UI

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("htmlPath") - public _FinalStage htmlPath(@NotNull String htmlPath) { - this.htmlPath = Objects.requireNonNull(htmlPath, "htmlPath must not be null"); - return this; - } - - /** - *

List of score ids

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage scores(Nullable> scores) { - if (scores.isNull()) { - this.scores = null; - } - else if (scores.isEmpty()) { - this.scores = Optional.empty(); - } - else { - this.scores = Optional.of(scores.get()); - } - return this; - } - - /** - *

List of score ids

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage scores(List scores) { - this.scores = Optional.ofNullable(scores); - return this; - } - - /** - *

List of score ids

- */ - @java.lang.Override - @JsonSetter( - value = "scores", - nulls = Nulls.SKIP - ) - public _FinalStage scores(Optional> scores) { - this.scores = scores; - return this; - } - - /** - *

List of observation ids

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observations(Nullable> observations) { - if (observations.isNull()) { - this.observations = null; - } - else if (observations.isEmpty()) { - this.observations = Optional.empty(); - } - else { - this.observations = Optional.of(observations.get()); - } - return this; - } - - /** - *

List of observation ids

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observations(List observations) { - this.observations = Optional.ofNullable(observations); - return this; - } - - /** - *

List of observation ids

- */ - @java.lang.Override - @JsonSetter( - value = "observations", - nulls = Nulls.SKIP - ) - public _FinalStage observations(Optional> observations) { - this.observations = observations; - return this; - } - - /** - *

Cost of trace in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage totalCost(Nullable totalCost) { - if (totalCost.isNull()) { - this.totalCost = null; - } - else if (totalCost.isEmpty()) { - this.totalCost = Optional.empty(); - } - else { - this.totalCost = Optional.of(totalCost.get()); - } - return this; - } - - /** - *

Cost of trace in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage totalCost(Double totalCost) { - this.totalCost = Optional.ofNullable(totalCost); - return this; - } - - /** - *

Cost of trace in USD

- */ - @java.lang.Override - @JsonSetter( - value = "totalCost", - nulls = Nulls.SKIP - ) - public _FinalStage totalCost(Optional totalCost) { - this.totalCost = totalCost; - return this; - } - - /** - *

Latency of trace in seconds

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage latency(Nullable latency) { - if (latency.isNull()) { - this.latency = null; - } - else if (latency.isEmpty()) { - this.latency = Optional.empty(); - } - else { - this.latency = Optional.of(latency.get()); - } - return this; - } - - /** - *

Latency of trace in seconds

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage latency(Double latency) { - this.latency = Optional.ofNullable(latency); - return this; - } - - /** - *

Latency of trace in seconds

- */ - @java.lang.Override - @JsonSetter( - value = "latency", - nulls = Nulls.SKIP - ) - public _FinalStage latency(Optional latency) { - this.latency = latency; - return this; - } - - /** - *

The tags associated with the trace.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllTags(List tags) { - if (tags != null) { - this.tags.addAll(tags); - } - return this; - } - - /** - *

The tags associated with the trace.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addTags(String tags) { - this.tags.add(tags); - return this; - } - - /** - *

The tags associated with the trace.

- */ - @java.lang.Override - @JsonSetter( - value = "tags", - nulls = Nulls.SKIP - ) - public _FinalStage tags(List tags) { - this.tags.clear(); - if (tags != null) { - this.tags.addAll(tags); - } - return this; - } - - /** - *

The metadata associated with the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

The metadata associated with the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The user identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage userId(Nullable userId) { - if (userId.isNull()) { - this.userId = null; - } - else if (userId.isEmpty()) { - this.userId = Optional.empty(); - } - else { - this.userId = Optional.of(userId.get()); - } - return this; - } - - /** - *

The user identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - /** - *

The user identifier associated with the trace

- */ - @java.lang.Override - @JsonSetter( - value = "userId", - nulls = Nulls.SKIP - ) - public _FinalStage userId(Optional userId) { - this.userId = userId; - return this; - } - - /** - *

The version of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(Nullable version) { - if (version.isNull()) { - this.version = null; - } - else if (version.isEmpty()) { - this.version = Optional.empty(); - } - else { - this.version = Optional.of(version.get()); - } - return this; - } - - /** - *

The version of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** - *

The version of the trace

- */ - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - /** - *

The release version of the application when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage release(Nullable release) { - if (release.isNull()) { - this.release = null; - } - else if (release.isEmpty()) { - this.release = Optional.empty(); - } - else { - this.release = Optional.of(release.get()); - } - return this; - } - - /** - *

The release version of the application when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage release(String release) { - this.release = Optional.ofNullable(release); - return this; - } - - /** - *

The release version of the application when the trace was created

- */ - @java.lang.Override - @JsonSetter( - value = "release", - nulls = Nulls.SKIP - ) - public _FinalStage release(Optional release) { - this.release = release; - return this; - } - - /** - *

The session identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session identifier associated with the trace

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The output data of the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - /** - *

The output data of the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public _FinalStage output(Optional output) { - this.output = output; - return this; - } - - /** - *

The input data of the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - /** - *

The input data of the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public _FinalStage input(Optional input) { - this.input = input; - return this; - } - - /** - *

The name of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(Nullable name) { - if (name.isNull()) { - this.name = null; - } - else if (name.isEmpty()) { - this.name = Optional.empty(); - } - else { - this.name = Optional.of(name.get()); - } - return this; - } - - /** - *

The name of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - /** - *

The name of the trace

- */ - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @java.lang.Override - public TraceWithDetails build() { - return new TraceWithDetails(id, timestamp, name, input, output, sessionId, release, version, userId, metadata, tags, public_, environment, htmlPath, latency, totalCost, observations, scores, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/TraceWithFullDetails.java b/src/main/java/com/langfuse/client/resources/commons/types/TraceWithFullDetails.java deleted file mode 100644 index 1404012..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/TraceWithFullDetails.java +++ /dev/null @@ -1,1144 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Double; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = TraceWithFullDetails.Builder.class -) -public final class TraceWithFullDetails implements ITrace { - private final String id; - - private final OffsetDateTime timestamp; - - private final Optional name; - - private final Optional input; - - private final Optional output; - - private final Optional sessionId; - - private final Optional release; - - private final Optional version; - - private final Optional userId; - - private final Optional metadata; - - private final List tags; - - private final boolean public_; - - private final String environment; - - private final String htmlPath; - - private final Optional latency; - - private final Optional totalCost; - - private final List observations; - - private final List scores; - - private final Map additionalProperties; - - private TraceWithFullDetails(String id, OffsetDateTime timestamp, Optional name, - Optional input, Optional output, Optional sessionId, - Optional release, Optional version, Optional userId, - Optional metadata, List tags, boolean public_, String environment, - String htmlPath, Optional latency, Optional totalCost, - List observations, List scores, - Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.name = name; - this.input = input; - this.output = output; - this.sessionId = sessionId; - this.release = release; - this.version = version; - this.userId = userId; - this.metadata = metadata; - this.tags = tags; - this.public_ = public_; - this.environment = environment; - this.htmlPath = htmlPath; - this.latency = latency; - this.totalCost = totalCost; - this.observations = observations; - this.scores = scores; - this.additionalProperties = additionalProperties; - } - - /** - * @return The unique identifier of a trace - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The timestamp when the trace was created - */ - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - /** - * @return The name of the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getName() { - if (name == null) { - return Optional.empty(); - } - return name; - } - - /** - * @return The input data of the trace. Can be any JSON. - */ - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - /** - * @return The output data of the trace. Can be any JSON. - */ - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - /** - * @return The session identifier associated with the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The release version of the application when the trace was created - */ - @JsonIgnore - @java.lang.Override - public Optional getRelease() { - if (release == null) { - return Optional.empty(); - } - return release; - } - - /** - * @return The version of the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getVersion() { - if (version == null) { - return Optional.empty(); - } - return version; - } - - /** - * @return The user identifier associated with the trace - */ - @JsonIgnore - @java.lang.Override - public Optional getUserId() { - if (userId == null) { - return Optional.empty(); - } - return userId; - } - - /** - * @return The metadata associated with the trace. Can be any JSON. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - /** - * @return The tags associated with the trace. - */ - @JsonProperty("tags") - @java.lang.Override - public List getTags() { - return tags; - } - - /** - * @return Public traces are accessible via url without login - */ - @JsonProperty("public") - @java.lang.Override - public boolean getPublic() { - return public_; - } - - /** - * @return The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - /** - * @return Path of trace in Langfuse UI - */ - @JsonProperty("htmlPath") - public String getHtmlPath() { - return htmlPath; - } - - /** - * @return Latency of trace in seconds - */ - @JsonIgnore - public Optional getLatency() { - if (latency == null) { - return Optional.empty(); - } - return latency; - } - - /** - * @return Cost of trace in USD - */ - @JsonIgnore - public Optional getTotalCost() { - if (totalCost == null) { - return Optional.empty(); - } - return totalCost; - } - - /** - * @return List of observations - */ - @JsonProperty("observations") - public List getObservations() { - return observations; - } - - /** - * @return List of scores - */ - @JsonProperty("scores") - public List getScores() { - return scores; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("name") - private Optional _getName() { - return name; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("release") - private Optional _getRelease() { - return release; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("version") - private Optional _getVersion() { - return version; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("userId") - private Optional _getUserId() { - return userId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("latency") - private Optional _getLatency() { - return latency; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("totalCost") - private Optional _getTotalCost() { - return totalCost; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TraceWithFullDetails && equalTo((TraceWithFullDetails) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(TraceWithFullDetails other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && name.equals(other.name) && input.equals(other.input) && output.equals(other.output) && sessionId.equals(other.sessionId) && release.equals(other.release) && version.equals(other.version) && userId.equals(other.userId) && metadata.equals(other.metadata) && tags.equals(other.tags) && public_ == other.public_ && environment.equals(other.environment) && htmlPath.equals(other.htmlPath) && latency.equals(other.latency) && totalCost.equals(other.totalCost) && observations.equals(other.observations) && scores.equals(other.scores); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.name, this.input, this.output, this.sessionId, this.release, this.version, this.userId, this.metadata, this.tags, this.public_, this.environment, this.htmlPath, this.latency, this.totalCost, this.observations, this.scores); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

The unique identifier of a trace

- */ - TimestampStage id(@NotNull String id); - - Builder from(TraceWithFullDetails other); - } - - public interface TimestampStage { - /** - *

The timestamp when the trace was created

- */ - PublicStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface PublicStage { - /** - *

Public traces are accessible via url without login

- */ - EnvironmentStage public_(boolean public_); - } - - public interface EnvironmentStage { - /** - *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - HtmlPathStage environment(@NotNull String environment); - } - - public interface HtmlPathStage { - /** - *

Path of trace in Langfuse UI

- */ - _FinalStage htmlPath(@NotNull String htmlPath); - } - - public interface _FinalStage { - TraceWithFullDetails build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The name of the trace

- */ - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage name(Nullable name); - - /** - *

The input data of the trace. Can be any JSON.

- */ - _FinalStage input(Optional input); - - _FinalStage input(Object input); - - /** - *

The output data of the trace. Can be any JSON.

- */ - _FinalStage output(Optional output); - - _FinalStage output(Object output); - - /** - *

The session identifier associated with the trace

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The release version of the application when the trace was created

- */ - _FinalStage release(Optional release); - - _FinalStage release(String release); - - _FinalStage release(Nullable release); - - /** - *

The version of the trace

- */ - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage version(Nullable version); - - /** - *

The user identifier associated with the trace

- */ - _FinalStage userId(Optional userId); - - _FinalStage userId(String userId); - - _FinalStage userId(Nullable userId); - - /** - *

The metadata associated with the trace. Can be any JSON.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - /** - *

The tags associated with the trace.

- */ - _FinalStage tags(List tags); - - _FinalStage addTags(String tags); - - _FinalStage addAllTags(List tags); - - /** - *

Latency of trace in seconds

- */ - _FinalStage latency(Optional latency); - - _FinalStage latency(Double latency); - - _FinalStage latency(Nullable latency); - - /** - *

Cost of trace in USD

- */ - _FinalStage totalCost(Optional totalCost); - - _FinalStage totalCost(Double totalCost); - - _FinalStage totalCost(Nullable totalCost); - - /** - *

List of observations

- */ - _FinalStage observations(List observations); - - _FinalStage addObservations(ObservationsView observations); - - _FinalStage addAllObservations(List observations); - - /** - *

List of scores

- */ - _FinalStage scores(List scores); - - _FinalStage addScores(ScoreV1 scores); - - _FinalStage addAllScores(List scores); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, PublicStage, EnvironmentStage, HtmlPathStage, _FinalStage { - private String id; - - private OffsetDateTime timestamp; - - private boolean public_; - - private String environment; - - private String htmlPath; - - private List scores = new ArrayList<>(); - - private List observations = new ArrayList<>(); - - private Optional totalCost = Optional.empty(); - - private Optional latency = Optional.empty(); - - private List tags = new ArrayList<>(); - - private Optional metadata = Optional.empty(); - - private Optional userId = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional release = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional name = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(TraceWithFullDetails other) { - id(other.getId()); - timestamp(other.getTimestamp()); - name(other.getName()); - input(other.getInput()); - output(other.getOutput()); - sessionId(other.getSessionId()); - release(other.getRelease()); - version(other.getVersion()); - userId(other.getUserId()); - metadata(other.getMetadata()); - tags(other.getTags()); - public_(other.getPublic()); - environment(other.getEnvironment()); - htmlPath(other.getHtmlPath()); - latency(other.getLatency()); - totalCost(other.getTotalCost()); - observations(other.getObservations()); - scores(other.getScores()); - return this; - } - - /** - *

The unique identifier of a trace

- *

The unique identifier of a trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

The timestamp when the trace was created

- *

The timestamp when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public PublicStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - /** - *

Public traces are accessible via url without login

- *

Public traces are accessible via url without login

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("public") - public EnvironmentStage public_(boolean public_) { - this.public_ = public_; - return this; - } - - /** - *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public HtmlPathStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - /** - *

Path of trace in Langfuse UI

- *

Path of trace in Langfuse UI

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("htmlPath") - public _FinalStage htmlPath(@NotNull String htmlPath) { - this.htmlPath = Objects.requireNonNull(htmlPath, "htmlPath must not be null"); - return this; - } - - /** - *

List of scores

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllScores(List scores) { - if (scores != null) { - this.scores.addAll(scores); - } - return this; - } - - /** - *

List of scores

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addScores(ScoreV1 scores) { - this.scores.add(scores); - return this; - } - - /** - *

List of scores

- */ - @java.lang.Override - @JsonSetter( - value = "scores", - nulls = Nulls.SKIP - ) - public _FinalStage scores(List scores) { - this.scores.clear(); - if (scores != null) { - this.scores.addAll(scores); - } - return this; - } - - /** - *

List of observations

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllObservations(List observations) { - if (observations != null) { - this.observations.addAll(observations); - } - return this; - } - - /** - *

List of observations

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addObservations(ObservationsView observations) { - this.observations.add(observations); - return this; - } - - /** - *

List of observations

- */ - @java.lang.Override - @JsonSetter( - value = "observations", - nulls = Nulls.SKIP - ) - public _FinalStage observations(List observations) { - this.observations.clear(); - if (observations != null) { - this.observations.addAll(observations); - } - return this; - } - - /** - *

Cost of trace in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage totalCost(Nullable totalCost) { - if (totalCost.isNull()) { - this.totalCost = null; - } - else if (totalCost.isEmpty()) { - this.totalCost = Optional.empty(); - } - else { - this.totalCost = Optional.of(totalCost.get()); - } - return this; - } - - /** - *

Cost of trace in USD

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage totalCost(Double totalCost) { - this.totalCost = Optional.ofNullable(totalCost); - return this; - } - - /** - *

Cost of trace in USD

- */ - @java.lang.Override - @JsonSetter( - value = "totalCost", - nulls = Nulls.SKIP - ) - public _FinalStage totalCost(Optional totalCost) { - this.totalCost = totalCost; - return this; - } - - /** - *

Latency of trace in seconds

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage latency(Nullable latency) { - if (latency.isNull()) { - this.latency = null; - } - else if (latency.isEmpty()) { - this.latency = Optional.empty(); - } - else { - this.latency = Optional.of(latency.get()); - } - return this; - } - - /** - *

Latency of trace in seconds

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage latency(Double latency) { - this.latency = Optional.ofNullable(latency); - return this; - } - - /** - *

Latency of trace in seconds

- */ - @java.lang.Override - @JsonSetter( - value = "latency", - nulls = Nulls.SKIP - ) - public _FinalStage latency(Optional latency) { - this.latency = latency; - return this; - } - - /** - *

The tags associated with the trace.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addAllTags(List tags) { - if (tags != null) { - this.tags.addAll(tags); - } - return this; - } - - /** - *

The tags associated with the trace.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage addTags(String tags) { - this.tags.add(tags); - return this; - } - - /** - *

The tags associated with the trace.

- */ - @java.lang.Override - @JsonSetter( - value = "tags", - nulls = Nulls.SKIP - ) - public _FinalStage tags(List tags) { - this.tags.clear(); - if (tags != null) { - this.tags.addAll(tags); - } - return this; - } - - /** - *

The metadata associated with the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

The metadata associated with the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The user identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage userId(Nullable userId) { - if (userId.isNull()) { - this.userId = null; - } - else if (userId.isEmpty()) { - this.userId = Optional.empty(); - } - else { - this.userId = Optional.of(userId.get()); - } - return this; - } - - /** - *

The user identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - /** - *

The user identifier associated with the trace

- */ - @java.lang.Override - @JsonSetter( - value = "userId", - nulls = Nulls.SKIP - ) - public _FinalStage userId(Optional userId) { - this.userId = userId; - return this; - } - - /** - *

The version of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(Nullable version) { - if (version.isNull()) { - this.version = null; - } - else if (version.isEmpty()) { - this.version = Optional.empty(); - } - else { - this.version = Optional.of(version.get()); - } - return this; - } - - /** - *

The version of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** - *

The version of the trace

- */ - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - /** - *

The release version of the application when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage release(Nullable release) { - if (release.isNull()) { - this.release = null; - } - else if (release.isEmpty()) { - this.release = Optional.empty(); - } - else { - this.release = Optional.of(release.get()); - } - return this; - } - - /** - *

The release version of the application when the trace was created

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage release(String release) { - this.release = Optional.ofNullable(release); - return this; - } - - /** - *

The release version of the application when the trace was created

- */ - @java.lang.Override - @JsonSetter( - value = "release", - nulls = Nulls.SKIP - ) - public _FinalStage release(Optional release) { - this.release = release; - return this; - } - - /** - *

The session identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session identifier associated with the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session identifier associated with the trace

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The output data of the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - /** - *

The output data of the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public _FinalStage output(Optional output) { - this.output = output; - return this; - } - - /** - *

The input data of the trace. Can be any JSON.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - /** - *

The input data of the trace. Can be any JSON.

- */ - @java.lang.Override - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public _FinalStage input(Optional input) { - this.input = input; - return this; - } - - /** - *

The name of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(Nullable name) { - if (name.isNull()) { - this.name = null; - } - else if (name.isEmpty()) { - this.name = Optional.empty(); - } - else { - this.name = Optional.of(name.get()); - } - return this; - } - - /** - *

The name of the trace

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - /** - *

The name of the trace

- */ - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @java.lang.Override - public TraceWithFullDetails build() { - return new TraceWithFullDetails(id, timestamp, name, input, output, sessionId, release, version, userId, metadata, tags, public_, environment, htmlPath, latency, totalCost, observations, scores, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/commons/types/Usage.java b/src/main/java/com/langfuse/client/resources/commons/types/Usage.java deleted file mode 100644 index 6194828..0000000 --- a/src/main/java/com/langfuse/client/resources/commons/types/Usage.java +++ /dev/null @@ -1,418 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.commons.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Double; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = Usage.Builder.class -) -public final class Usage { - private final int input; - - private final int output; - - private final int total; - - private final Optional unit; - - private final Optional inputCost; - - private final Optional outputCost; - - private final Optional totalCost; - - private final Map additionalProperties; - - private Usage(int input, int output, int total, Optional unit, Optional inputCost, - Optional outputCost, Optional totalCost, - Map additionalProperties) { - this.input = input; - this.output = output; - this.total = total; - this.unit = unit; - this.inputCost = inputCost; - this.outputCost = outputCost; - this.totalCost = totalCost; - this.additionalProperties = additionalProperties; - } - - /** - * @return Number of input units (e.g. tokens) - */ - @JsonProperty("input") - public int getInput() { - return input; - } - - /** - * @return Number of output units (e.g. tokens) - */ - @JsonProperty("output") - public int getOutput() { - return output; - } - - /** - * @return Defaults to input+output if not set - */ - @JsonProperty("total") - public int getTotal() { - return total; - } - - /** - * @return Unit of measurement - */ - @JsonIgnore - public Optional getUnit() { - if (unit == null) { - return Optional.empty(); - } - return unit; - } - - /** - * @return USD input cost - */ - @JsonProperty("inputCost") - public Optional getInputCost() { - return inputCost; - } - - /** - * @return USD output cost - */ - @JsonProperty("outputCost") - public Optional getOutputCost() { - return outputCost; - } - - /** - * @return USD total cost, defaults to input+output - */ - @JsonProperty("totalCost") - public Optional getTotalCost() { - return totalCost; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("unit") - private Optional _getUnit() { - return unit; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Usage && equalTo((Usage) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Usage other) { - return input == other.input && output == other.output && total == other.total && unit.equals(other.unit) && inputCost.equals(other.inputCost) && outputCost.equals(other.outputCost) && totalCost.equals(other.totalCost); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.input, this.output, this.total, this.unit, this.inputCost, this.outputCost, this.totalCost); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static InputStage builder() { - return new Builder(); - } - - public interface InputStage { - /** - *

Number of input units (e.g. tokens)

- */ - OutputStage input(int input); - - Builder from(Usage other); - } - - public interface OutputStage { - /** - *

Number of output units (e.g. tokens)

- */ - TotalStage output(int output); - } - - public interface TotalStage { - /** - *

Defaults to input+output if not set

- */ - _FinalStage total(int total); - } - - public interface _FinalStage { - Usage build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Unit of measurement

- */ - _FinalStage unit(Optional unit); - - _FinalStage unit(String unit); - - _FinalStage unit(Nullable unit); - - /** - *

USD input cost

- */ - _FinalStage inputCost(Optional inputCost); - - _FinalStage inputCost(Double inputCost); - - /** - *

USD output cost

- */ - _FinalStage outputCost(Optional outputCost); - - _FinalStage outputCost(Double outputCost); - - /** - *

USD total cost, defaults to input+output

- */ - _FinalStage totalCost(Optional totalCost); - - _FinalStage totalCost(Double totalCost); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements InputStage, OutputStage, TotalStage, _FinalStage { - private int input; - - private int output; - - private int total; - - private Optional totalCost = Optional.empty(); - - private Optional outputCost = Optional.empty(); - - private Optional inputCost = Optional.empty(); - - private Optional unit = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(Usage other) { - input(other.getInput()); - output(other.getOutput()); - total(other.getTotal()); - unit(other.getUnit()); - inputCost(other.getInputCost()); - outputCost(other.getOutputCost()); - totalCost(other.getTotalCost()); - return this; - } - - /** - *

Number of input units (e.g. tokens)

- *

Number of input units (e.g. tokens)

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("input") - public OutputStage input(int input) { - this.input = input; - return this; - } - - /** - *

Number of output units (e.g. tokens)

- *

Number of output units (e.g. tokens)

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("output") - public TotalStage output(int output) { - this.output = output; - return this; - } - - /** - *

Defaults to input+output if not set

- *

Defaults to input+output if not set

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("total") - public _FinalStage total(int total) { - this.total = total; - return this; - } - - /** - *

USD total cost, defaults to input+output

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage totalCost(Double totalCost) { - this.totalCost = Optional.ofNullable(totalCost); - return this; - } - - /** - *

USD total cost, defaults to input+output

- */ - @java.lang.Override - @JsonSetter( - value = "totalCost", - nulls = Nulls.SKIP - ) - public _FinalStage totalCost(Optional totalCost) { - this.totalCost = totalCost; - return this; - } - - /** - *

USD output cost

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage outputCost(Double outputCost) { - this.outputCost = Optional.ofNullable(outputCost); - return this; - } - - /** - *

USD output cost

- */ - @java.lang.Override - @JsonSetter( - value = "outputCost", - nulls = Nulls.SKIP - ) - public _FinalStage outputCost(Optional outputCost) { - this.outputCost = outputCost; - return this; - } - - /** - *

USD input cost

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage inputCost(Double inputCost) { - this.inputCost = Optional.ofNullable(inputCost); - return this; - } - - /** - *

USD input cost

- */ - @java.lang.Override - @JsonSetter( - value = "inputCost", - nulls = Nulls.SKIP - ) - public _FinalStage inputCost(Optional inputCost) { - this.inputCost = inputCost; - return this; - } - - /** - *

Unit of measurement

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage unit(Nullable unit) { - if (unit.isNull()) { - this.unit = null; - } - else if (unit.isEmpty()) { - this.unit = Optional.empty(); - } - else { - this.unit = Optional.of(unit.get()); - } - return this; - } - - /** - *

Unit of measurement

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage unit(String unit) { - this.unit = Optional.ofNullable(unit); - return this; - } - - /** - *

Unit of measurement

- */ - @java.lang.Override - @JsonSetter( - value = "unit", - nulls = Nulls.SKIP - ) - public _FinalStage unit(Optional unit) { - this.unit = unit; - return this; - } - - @java.lang.Override - public Usage build() { - return new Usage(input, output, total, unit, inputCost, outputCost, totalCost, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/datasetrunitems/AsyncDatasetRunItemsClient.java b/src/main/java/com/langfuse/client/resources/datasetrunitems/AsyncDatasetRunItemsClient.java deleted file mode 100644 index 850de79..0000000 --- a/src/main/java/com/langfuse/client/resources/datasetrunitems/AsyncDatasetRunItemsClient.java +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasetrunitems; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import com.langfuse.client.resources.commons.types.DatasetRunItem; -import com.langfuse.client.resources.datasetrunitems.requests.ListDatasetRunItemsRequest; -import com.langfuse.client.resources.datasetrunitems.types.CreateDatasetRunItemRequest; -import com.langfuse.client.resources.datasetrunitems.types.PaginatedDatasetRunItems; - -public class AsyncDatasetRunItemsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawDatasetRunItemsClient rawClient; - - public AsyncDatasetRunItemsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawDatasetRunItemsClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawDatasetRunItemsClient withRawResponse() { - return this.rawClient; - } - - /** - * Create a dataset run item - */ - public CompletableFuture create(CreateDatasetRunItemRequest request) { - return this.rawClient.create(request).thenApply(response -> response.body()); - } - - /** - * Create a dataset run item - */ - public CompletableFuture create(CreateDatasetRunItemRequest request, - RequestOptions requestOptions) { - return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); - } - - /** - * List dataset run items - */ - public CompletableFuture list(ListDatasetRunItemsRequest request) { - return this.rawClient.list(request).thenApply(response -> response.body()); - } - - /** - * List dataset run items - */ - public CompletableFuture list(ListDatasetRunItemsRequest request, - RequestOptions requestOptions) { - return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/langfuse/client/resources/datasetrunitems/AsyncRawDatasetRunItemsClient.java b/src/main/java/com/langfuse/client/resources/datasetrunitems/AsyncRawDatasetRunItemsClient.java deleted file mode 100644 index bd6b141..0000000 --- a/src/main/java/com/langfuse/client/resources/datasetrunitems/AsyncRawDatasetRunItemsClient.java +++ /dev/null @@ -1,211 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasetrunitems; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.MediaTypes; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.DatasetRunItem; -import com.langfuse.client.resources.datasetrunitems.requests.ListDatasetRunItemsRequest; -import com.langfuse.client.resources.datasetrunitems.types.CreateDatasetRunItemRequest; -import com.langfuse.client.resources.datasetrunitems.types.PaginatedDatasetRunItems; - -public class AsyncRawDatasetRunItemsClient { - protected final ClientOptions clientOptions; - - public AsyncRawDatasetRunItemsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Create a dataset run item - */ - public CompletableFuture> create( - CreateDatasetRunItemRequest request) { - return create(request,null); - } - - /** - * Create a dataset run item - */ - public CompletableFuture> create( - CreateDatasetRunItemRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("dataset-run-items");if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - RequestBody body; - try { - body = RequestBody.create(ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } - catch(JsonProcessingException e) { - throw new LangfuseClientException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DatasetRunItem.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** - * List dataset run items - */ - public CompletableFuture> list( - ListDatasetRunItemsRequest request) { - return list(request,null); - } - - /** - * List dataset run items - */ - public CompletableFuture> list( - ListDatasetRunItemsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("dataset-run-items");QueryStringMapper.addQueryParameter(httpUrl, "datasetId", request.getDatasetId(), false); - QueryStringMapper.addQueryParameter(httpUrl, "runName", request.getRunName(), false); - if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaginatedDatasetRunItems.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - } diff --git a/src/main/java/com/langfuse/client/resources/datasetrunitems/DatasetRunItemsClient.java b/src/main/java/com/langfuse/client/resources/datasetrunitems/DatasetRunItemsClient.java deleted file mode 100644 index 59f61f5..0000000 --- a/src/main/java/com/langfuse/client/resources/datasetrunitems/DatasetRunItemsClient.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasetrunitems; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import com.langfuse.client.resources.commons.types.DatasetRunItem; -import com.langfuse.client.resources.datasetrunitems.requests.ListDatasetRunItemsRequest; -import com.langfuse.client.resources.datasetrunitems.types.CreateDatasetRunItemRequest; -import com.langfuse.client.resources.datasetrunitems.types.PaginatedDatasetRunItems; - -public class DatasetRunItemsClient { - protected final ClientOptions clientOptions; - - private final RawDatasetRunItemsClient rawClient; - - public DatasetRunItemsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawDatasetRunItemsClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawDatasetRunItemsClient withRawResponse() { - return this.rawClient; - } - - /** - * Create a dataset run item - */ - public DatasetRunItem create(CreateDatasetRunItemRequest request) { - return this.rawClient.create(request).body(); - } - - /** - * Create a dataset run item - */ - public DatasetRunItem create(CreateDatasetRunItemRequest request, RequestOptions requestOptions) { - return this.rawClient.create(request, requestOptions).body(); - } - - /** - * List dataset run items - */ - public PaginatedDatasetRunItems list(ListDatasetRunItemsRequest request) { - return this.rawClient.list(request).body(); - } - - /** - * List dataset run items - */ - public PaginatedDatasetRunItems list(ListDatasetRunItemsRequest request, - RequestOptions requestOptions) { - return this.rawClient.list(request, requestOptions).body(); - } -} diff --git a/src/main/java/com/langfuse/client/resources/datasetrunitems/RawDatasetRunItemsClient.java b/src/main/java/com/langfuse/client/resources/datasetrunitems/RawDatasetRunItemsClient.java deleted file mode 100644 index f151e88..0000000 --- a/src/main/java/com/langfuse/client/resources/datasetrunitems/RawDatasetRunItemsClient.java +++ /dev/null @@ -1,169 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasetrunitems; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.MediaTypes; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.String; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.DatasetRunItem; -import com.langfuse.client.resources.datasetrunitems.requests.ListDatasetRunItemsRequest; -import com.langfuse.client.resources.datasetrunitems.types.CreateDatasetRunItemRequest; -import com.langfuse.client.resources.datasetrunitems.types.PaginatedDatasetRunItems; - -public class RawDatasetRunItemsClient { - protected final ClientOptions clientOptions; - - public RawDatasetRunItemsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Create a dataset run item - */ - public LangfuseClientHttpResponse create(CreateDatasetRunItemRequest request) { - return create(request,null); - } - - /** - * Create a dataset run item - */ - public LangfuseClientHttpResponse create(CreateDatasetRunItemRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("dataset-run-items");if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - RequestBody body; - try { - body = RequestBody.create(ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } - catch(JsonProcessingException e) { - throw new LangfuseClientException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DatasetRunItem.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - - /** - * List dataset run items - */ - public LangfuseClientHttpResponse list( - ListDatasetRunItemsRequest request) { - return list(request,null); - } - - /** - * List dataset run items - */ - public LangfuseClientHttpResponse list( - ListDatasetRunItemsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("dataset-run-items");QueryStringMapper.addQueryParameter(httpUrl, "datasetId", request.getDatasetId(), false); - QueryStringMapper.addQueryParameter(httpUrl, "runName", request.getRunName(), false); - if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaginatedDatasetRunItems.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - } diff --git a/src/main/java/com/langfuse/client/resources/datasetrunitems/requests/ListDatasetRunItemsRequest.java b/src/main/java/com/langfuse/client/resources/datasetrunitems/requests/ListDatasetRunItemsRequest.java deleted file mode 100644 index 03190c7..0000000 --- a/src/main/java/com/langfuse/client/resources/datasetrunitems/requests/ListDatasetRunItemsRequest.java +++ /dev/null @@ -1,240 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasetrunitems.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = ListDatasetRunItemsRequest.Builder.class -) -public final class ListDatasetRunItemsRequest { - private final String datasetId; - - private final String runName; - - private final Optional page; - - private final Optional limit; - - private final Map additionalProperties; - - private ListDatasetRunItemsRequest(String datasetId, String runName, Optional page, - Optional limit, Map additionalProperties) { - this.datasetId = datasetId; - this.runName = runName; - this.page = page; - this.limit = limit; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("datasetId") - public String getDatasetId() { - return datasetId; - } - - @JsonProperty("runName") - public String getRunName() { - return runName; - } - - /** - * @return page number, starts at 1 - */ - @JsonProperty("page") - public Optional getPage() { - return page; - } - - /** - * @return limit of items per page - */ - @JsonProperty("limit") - public Optional getLimit() { - return limit; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ListDatasetRunItemsRequest && equalTo((ListDatasetRunItemsRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ListDatasetRunItemsRequest other) { - return datasetId.equals(other.datasetId) && runName.equals(other.runName) && page.equals(other.page) && limit.equals(other.limit); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.datasetId, this.runName, this.page, this.limit); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static DatasetIdStage builder() { - return new Builder(); - } - - public interface DatasetIdStage { - RunNameStage datasetId(@NotNull String datasetId); - - Builder from(ListDatasetRunItemsRequest other); - } - - public interface RunNameStage { - _FinalStage runName(@NotNull String runName); - } - - public interface _FinalStage { - ListDatasetRunItemsRequest build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

page number, starts at 1

- */ - _FinalStage page(Optional page); - - _FinalStage page(Integer page); - - /** - *

limit of items per page

- */ - _FinalStage limit(Optional limit); - - _FinalStage limit(Integer limit); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements DatasetIdStage, RunNameStage, _FinalStage { - private String datasetId; - - private String runName; - - private Optional limit = Optional.empty(); - - private Optional page = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(ListDatasetRunItemsRequest other) { - datasetId(other.getDatasetId()); - runName(other.getRunName()); - page(other.getPage()); - limit(other.getLimit()); - return this; - } - - @java.lang.Override - @JsonSetter("datasetId") - public RunNameStage datasetId(@NotNull String datasetId) { - this.datasetId = Objects.requireNonNull(datasetId, "datasetId must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("runName") - public _FinalStage runName(@NotNull String runName) { - this.runName = Objects.requireNonNull(runName, "runName must not be null"); - return this; - } - - /** - *

limit of items per page

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage limit(Integer limit) { - this.limit = Optional.ofNullable(limit); - return this; - } - - /** - *

limit of items per page

- */ - @java.lang.Override - @JsonSetter( - value = "limit", - nulls = Nulls.SKIP - ) - public _FinalStage limit(Optional limit) { - this.limit = limit; - return this; - } - - /** - *

page number, starts at 1

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage page(Integer page) { - this.page = Optional.ofNullable(page); - return this; - } - - /** - *

page number, starts at 1

- */ - @java.lang.Override - @JsonSetter( - value = "page", - nulls = Nulls.SKIP - ) - public _FinalStage page(Optional page) { - this.page = page; - return this; - } - - @java.lang.Override - public ListDatasetRunItemsRequest build() { - return new ListDatasetRunItemsRequest(datasetId, runName, page, limit, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/datasetrunitems/types/CreateDatasetRunItemRequest.java b/src/main/java/com/langfuse/client/resources/datasetrunitems/types/CreateDatasetRunItemRequest.java deleted file mode 100644 index cdcc96a..0000000 --- a/src/main/java/com/langfuse/client/resources/datasetrunitems/types/CreateDatasetRunItemRequest.java +++ /dev/null @@ -1,373 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasetrunitems.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CreateDatasetRunItemRequest.Builder.class -) -public final class CreateDatasetRunItemRequest { - private final String runName; - - private final Optional runDescription; - - private final Optional metadata; - - private final String datasetItemId; - - private final Optional observationId; - - private final Optional traceId; - - private final Optional datasetVersion; - - private final Map additionalProperties; - - private CreateDatasetRunItemRequest(String runName, Optional runDescription, - Optional metadata, String datasetItemId, Optional observationId, - Optional traceId, Optional datasetVersion, - Map additionalProperties) { - this.runName = runName; - this.runDescription = runDescription; - this.metadata = metadata; - this.datasetItemId = datasetItemId; - this.observationId = observationId; - this.traceId = traceId; - this.datasetVersion = datasetVersion; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("runName") - public String getRunName() { - return runName; - } - - /** - * @return Description of the run. If run exists, description will be updated. - */ - @JsonProperty("runDescription") - public Optional getRunDescription() { - return runDescription; - } - - /** - * @return Metadata of the dataset run, updates run if run already exists - */ - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("datasetItemId") - public String getDatasetItemId() { - return datasetItemId; - } - - @JsonProperty("observationId") - public Optional getObservationId() { - return observationId; - } - - /** - * @return traceId should always be provided. For compatibility with older SDK versions it can also be inferred from the provided observationId. - */ - @JsonProperty("traceId") - public Optional getTraceId() { - return traceId; - } - - /** - * @return ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z"). - * Specifies the dataset version to use for this experiment run. - * If provided, the experiment will use dataset items as they existed at or before this timestamp. - * If not provided, uses the latest version of dataset items. - */ - @JsonProperty("datasetVersion") - public Optional getDatasetVersion() { - return datasetVersion; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateDatasetRunItemRequest && equalTo((CreateDatasetRunItemRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateDatasetRunItemRequest other) { - return runName.equals(other.runName) && runDescription.equals(other.runDescription) && metadata.equals(other.metadata) && datasetItemId.equals(other.datasetItemId) && observationId.equals(other.observationId) && traceId.equals(other.traceId) && datasetVersion.equals(other.datasetVersion); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.runName, this.runDescription, this.metadata, this.datasetItemId, this.observationId, this.traceId, this.datasetVersion); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static RunNameStage builder() { - return new Builder(); - } - - public interface RunNameStage { - DatasetItemIdStage runName(@NotNull String runName); - - Builder from(CreateDatasetRunItemRequest other); - } - - public interface DatasetItemIdStage { - _FinalStage datasetItemId(@NotNull String datasetItemId); - } - - public interface _FinalStage { - CreateDatasetRunItemRequest build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Description of the run. If run exists, description will be updated.

- */ - _FinalStage runDescription(Optional runDescription); - - _FinalStage runDescription(String runDescription); - - /** - *

Metadata of the dataset run, updates run if run already exists

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - /** - *

traceId should always be provided. For compatibility with older SDK versions it can also be inferred from the provided observationId.

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - /** - *

ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z"). - * Specifies the dataset version to use for this experiment run. - * If provided, the experiment will use dataset items as they existed at or before this timestamp. - * If not provided, uses the latest version of dataset items.

- */ - _FinalStage datasetVersion(Optional datasetVersion); - - _FinalStage datasetVersion(OffsetDateTime datasetVersion); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements RunNameStage, DatasetItemIdStage, _FinalStage { - private String runName; - - private String datasetItemId; - - private Optional datasetVersion = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional runDescription = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(CreateDatasetRunItemRequest other) { - runName(other.getRunName()); - runDescription(other.getRunDescription()); - metadata(other.getMetadata()); - datasetItemId(other.getDatasetItemId()); - observationId(other.getObservationId()); - traceId(other.getTraceId()); - datasetVersion(other.getDatasetVersion()); - return this; - } - - @java.lang.Override - @JsonSetter("runName") - public DatasetItemIdStage runName(@NotNull String runName) { - this.runName = Objects.requireNonNull(runName, "runName must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("datasetItemId") - public _FinalStage datasetItemId(@NotNull String datasetItemId) { - this.datasetItemId = Objects.requireNonNull(datasetItemId, "datasetItemId must not be null"); - return this; - } - - /** - *

ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z"). - * Specifies the dataset version to use for this experiment run. - * If provided, the experiment will use dataset items as they existed at or before this timestamp. - * If not provided, uses the latest version of dataset items.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetVersion(OffsetDateTime datasetVersion) { - this.datasetVersion = Optional.ofNullable(datasetVersion); - return this; - } - - /** - *

ISO 8601 timestamp (RFC 3339, Section 5.6) in UTC (e.g., "2026-01-21T14:35:42Z"). - * Specifies the dataset version to use for this experiment run. - * If provided, the experiment will use dataset items as they existed at or before this timestamp. - * If not provided, uses the latest version of dataset items.

- */ - @java.lang.Override - @JsonSetter( - value = "datasetVersion", - nulls = Nulls.SKIP - ) - public _FinalStage datasetVersion(Optional datasetVersion) { - this.datasetVersion = datasetVersion; - return this; - } - - /** - *

traceId should always be provided. For compatibility with older SDK versions it can also be inferred from the provided observationId.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

traceId should always be provided. For compatibility with older SDK versions it can also be inferred from the provided observationId.

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

Metadata of the dataset run, updates run if run already exists

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Metadata of the dataset run, updates run if run already exists

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - /** - *

Description of the run. If run exists, description will be updated.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage runDescription(String runDescription) { - this.runDescription = Optional.ofNullable(runDescription); - return this; - } - - /** - *

Description of the run. If run exists, description will be updated.

- */ - @java.lang.Override - @JsonSetter( - value = "runDescription", - nulls = Nulls.SKIP - ) - public _FinalStage runDescription(Optional runDescription) { - this.runDescription = runDescription; - return this; - } - - @java.lang.Override - public CreateDatasetRunItemRequest build() { - return new CreateDatasetRunItemRequest(runName, runDescription, metadata, datasetItemId, observationId, traceId, datasetVersion, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/datasetrunitems/types/PaginatedDatasetRunItems.java b/src/main/java/com/langfuse/client/resources/datasetrunitems/types/PaginatedDatasetRunItems.java deleted file mode 100644 index af04426..0000000 --- a/src/main/java/com/langfuse/client/resources/datasetrunitems/types/PaginatedDatasetRunItems.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasetrunitems.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.DatasetRunItem; -import com.langfuse.client.resources.utils.pagination.types.MetaResponse; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = PaginatedDatasetRunItems.Builder.class -) -public final class PaginatedDatasetRunItems { - private final List data; - - private final MetaResponse meta; - - private final Map additionalProperties; - - private PaginatedDatasetRunItems(List data, MetaResponse meta, - Map additionalProperties) { - this.data = data; - this.meta = meta; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public List getData() { - return data; - } - - @JsonProperty("meta") - public MetaResponse getMeta() { - return meta; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PaginatedDatasetRunItems && equalTo((PaginatedDatasetRunItems) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(PaginatedDatasetRunItems other) { - return data.equals(other.data) && meta.equals(other.meta); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.data, this.meta); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetaStage builder() { - return new Builder(); - } - - public interface MetaStage { - _FinalStage meta(@NotNull MetaResponse meta); - - Builder from(PaginatedDatasetRunItems other); - } - - public interface _FinalStage { - PaginatedDatasetRunItems build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage data(List data); - - _FinalStage addData(DatasetRunItem data); - - _FinalStage addAllData(List data); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements MetaStage, _FinalStage { - private MetaResponse meta; - - private List data = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(PaginatedDatasetRunItems other) { - data(other.getData()); - meta(other.getMeta()); - return this; - } - - @java.lang.Override - @JsonSetter("meta") - public _FinalStage meta(@NotNull MetaResponse meta) { - this.meta = Objects.requireNonNull(meta, "meta must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllData(List data) { - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public _FinalStage addData(DatasetRunItem data) { - this.data.add(data); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "data", - nulls = Nulls.SKIP - ) - public _FinalStage data(List data) { - this.data.clear(); - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public PaginatedDatasetRunItems build() { - return new PaginatedDatasetRunItems(data, meta, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/datasets/AsyncDatasetsClient.java b/src/main/java/com/langfuse/client/resources/datasets/AsyncDatasetsClient.java index 906b549..29a73d7 100644 --- a/src/main/java/com/langfuse/client/resources/datasets/AsyncDatasetsClient.java +++ b/src/main/java/com/langfuse/client/resources/datasets/AsyncDatasetsClient.java @@ -9,12 +9,8 @@ import java.lang.String; import java.util.concurrent.CompletableFuture; import com.langfuse.client.resources.commons.types.Dataset; -import com.langfuse.client.resources.commons.types.DatasetRunWithItems; -import com.langfuse.client.resources.datasets.requests.GetDatasetRunsRequest; import com.langfuse.client.resources.datasets.requests.GetDatasetsRequest; import com.langfuse.client.resources.datasets.types.CreateDatasetRequest; -import com.langfuse.client.resources.datasets.types.DeleteDatasetRunResponse; -import com.langfuse.client.resources.datasets.types.PaginatedDatasetRuns; import com.langfuse.client.resources.datasets.types.PaginatedDatasets; public class AsyncDatasetsClient { @@ -91,65 +87,4 @@ public CompletableFuture create(CreateDatasetRequest request, RequestOptions requestOptions) { return this.rawClient.create(request, requestOptions).thenApply(response -> response.body()); } - - /** - * Get a dataset run and its items - */ - public CompletableFuture getRun(String datasetName, String runName) { - return this.rawClient.getRun(datasetName, runName).thenApply(response -> response.body()); - } - - /** - * Get a dataset run and its items - */ - public CompletableFuture getRun(String datasetName, String runName, - RequestOptions requestOptions) { - return this.rawClient.getRun(datasetName, runName, requestOptions).thenApply(response -> response.body()); - } - - /** - * Delete a dataset run and all its run items. This action is irreversible. - */ - public CompletableFuture deleteRun(String datasetName, String runName) { - return this.rawClient.deleteRun(datasetName, runName).thenApply(response -> response.body()); - } - - /** - * Delete a dataset run and all its run items. This action is irreversible. - */ - public CompletableFuture deleteRun(String datasetName, String runName, - RequestOptions requestOptions) { - return this.rawClient.deleteRun(datasetName, runName, requestOptions).thenApply(response -> response.body()); - } - - /** - * Get dataset runs - */ - public CompletableFuture getRuns(String datasetName) { - return this.rawClient.getRuns(datasetName).thenApply(response -> response.body()); - } - - /** - * Get dataset runs - */ - public CompletableFuture getRuns(String datasetName, - RequestOptions requestOptions) { - return this.rawClient.getRuns(datasetName, requestOptions).thenApply(response -> response.body()); - } - - /** - * Get dataset runs - */ - public CompletableFuture getRuns(String datasetName, - GetDatasetRunsRequest request) { - return this.rawClient.getRuns(datasetName, request).thenApply(response -> response.body()); - } - - /** - * Get dataset runs - */ - public CompletableFuture getRuns(String datasetName, - GetDatasetRunsRequest request, RequestOptions requestOptions) { - return this.rawClient.getRuns(datasetName, request, requestOptions).thenApply(response -> response.body()); - } } diff --git a/src/main/java/com/langfuse/client/resources/datasets/AsyncRawDatasetsClient.java b/src/main/java/com/langfuse/client/resources/datasets/AsyncRawDatasetsClient.java index 3268886..600cf6e 100644 --- a/src/main/java/com/langfuse/client/resources/datasets/AsyncRawDatasetsClient.java +++ b/src/main/java/com/langfuse/client/resources/datasets/AsyncRawDatasetsClient.java @@ -34,12 +34,8 @@ import com.langfuse.client.resources.commons.errors.NotFoundError; import com.langfuse.client.resources.commons.errors.UnauthorizedError; import com.langfuse.client.resources.commons.types.Dataset; -import com.langfuse.client.resources.commons.types.DatasetRunWithItems; -import com.langfuse.client.resources.datasets.requests.GetDatasetRunsRequest; import com.langfuse.client.resources.datasets.requests.GetDatasetsRequest; import com.langfuse.client.resources.datasets.types.CreateDatasetRequest; -import com.langfuse.client.resources.datasets.types.DeleteDatasetRunResponse; -import com.langfuse.client.resources.datasets.types.PaginatedDatasetRuns; import com.langfuse.client.resources.datasets.types.PaginatedDatasets; public class AsyncRawDatasetsClient { @@ -299,256 +295,4 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { }); return future; } - - /** - * Get a dataset run and its items - */ - public CompletableFuture> getRun( - String datasetName, String runName) { - return getRun(datasetName,runName,null); - } - - /** - * Get a dataset run and its items - */ - public CompletableFuture> getRun( - String datasetName, String runName, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("datasets") - .addPathSegment(datasetName) - .addPathSegments("runs") - .addPathSegment(runName);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DatasetRunWithItems.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** - * Delete a dataset run and all its run items. This action is irreversible. - */ - public CompletableFuture> deleteRun( - String datasetName, String runName) { - return deleteRun(datasetName,runName,null); - } - - /** - * Delete a dataset run and all its run items. This action is irreversible. - */ - public CompletableFuture> deleteRun( - String datasetName, String runName, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("datasets") - .addPathSegment(datasetName) - .addPathSegments("runs") - .addPathSegment(runName);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteDatasetRunResponse.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** - * Get dataset runs - */ - public CompletableFuture> getRuns( - String datasetName) { - return getRuns(datasetName,GetDatasetRunsRequest.builder().build()); - } - - /** - * Get dataset runs - */ - public CompletableFuture> getRuns( - String datasetName, RequestOptions requestOptions) { - return getRuns(datasetName,GetDatasetRunsRequest.builder().build(),requestOptions); - } - - /** - * Get dataset runs - */ - public CompletableFuture> getRuns( - String datasetName, GetDatasetRunsRequest request) { - return getRuns(datasetName,request,null); - } - - /** - * Get dataset runs - */ - public CompletableFuture> getRuns( - String datasetName, GetDatasetRunsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("datasets") - .addPathSegment(datasetName) - .addPathSegments("runs");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaginatedDatasetRuns.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } } diff --git a/src/main/java/com/langfuse/client/resources/datasets/DatasetsClient.java b/src/main/java/com/langfuse/client/resources/datasets/DatasetsClient.java index b4b18df..4642543 100644 --- a/src/main/java/com/langfuse/client/resources/datasets/DatasetsClient.java +++ b/src/main/java/com/langfuse/client/resources/datasets/DatasetsClient.java @@ -8,12 +8,8 @@ import com.langfuse.client.core.RequestOptions; import java.lang.String; import com.langfuse.client.resources.commons.types.Dataset; -import com.langfuse.client.resources.commons.types.DatasetRunWithItems; -import com.langfuse.client.resources.datasets.requests.GetDatasetRunsRequest; import com.langfuse.client.resources.datasets.requests.GetDatasetsRequest; import com.langfuse.client.resources.datasets.types.CreateDatasetRequest; -import com.langfuse.client.resources.datasets.types.DeleteDatasetRunResponse; -import com.langfuse.client.resources.datasets.types.PaginatedDatasetRuns; import com.langfuse.client.resources.datasets.types.PaginatedDatasets; public class DatasetsClient { @@ -88,63 +84,4 @@ public Dataset create(CreateDatasetRequest request) { public Dataset create(CreateDatasetRequest request, RequestOptions requestOptions) { return this.rawClient.create(request, requestOptions).body(); } - - /** - * Get a dataset run and its items - */ - public DatasetRunWithItems getRun(String datasetName, String runName) { - return this.rawClient.getRun(datasetName, runName).body(); - } - - /** - * Get a dataset run and its items - */ - public DatasetRunWithItems getRun(String datasetName, String runName, - RequestOptions requestOptions) { - return this.rawClient.getRun(datasetName, runName, requestOptions).body(); - } - - /** - * Delete a dataset run and all its run items. This action is irreversible. - */ - public DeleteDatasetRunResponse deleteRun(String datasetName, String runName) { - return this.rawClient.deleteRun(datasetName, runName).body(); - } - - /** - * Delete a dataset run and all its run items. This action is irreversible. - */ - public DeleteDatasetRunResponse deleteRun(String datasetName, String runName, - RequestOptions requestOptions) { - return this.rawClient.deleteRun(datasetName, runName, requestOptions).body(); - } - - /** - * Get dataset runs - */ - public PaginatedDatasetRuns getRuns(String datasetName) { - return this.rawClient.getRuns(datasetName).body(); - } - - /** - * Get dataset runs - */ - public PaginatedDatasetRuns getRuns(String datasetName, RequestOptions requestOptions) { - return this.rawClient.getRuns(datasetName, requestOptions).body(); - } - - /** - * Get dataset runs - */ - public PaginatedDatasetRuns getRuns(String datasetName, GetDatasetRunsRequest request) { - return this.rawClient.getRuns(datasetName, request).body(); - } - - /** - * Get dataset runs - */ - public PaginatedDatasetRuns getRuns(String datasetName, GetDatasetRunsRequest request, - RequestOptions requestOptions) { - return this.rawClient.getRuns(datasetName, request, requestOptions).body(); - } } diff --git a/src/main/java/com/langfuse/client/resources/datasets/RawDatasetsClient.java b/src/main/java/com/langfuse/client/resources/datasets/RawDatasetsClient.java index a468ed2..3e6f1ea 100644 --- a/src/main/java/com/langfuse/client/resources/datasets/RawDatasetsClient.java +++ b/src/main/java/com/langfuse/client/resources/datasets/RawDatasetsClient.java @@ -29,12 +29,8 @@ import com.langfuse.client.resources.commons.errors.NotFoundError; import com.langfuse.client.resources.commons.errors.UnauthorizedError; import com.langfuse.client.resources.commons.types.Dataset; -import com.langfuse.client.resources.commons.types.DatasetRunWithItems; -import com.langfuse.client.resources.datasets.requests.GetDatasetRunsRequest; import com.langfuse.client.resources.datasets.requests.GetDatasetsRequest; import com.langfuse.client.resources.datasets.types.CreateDatasetRequest; -import com.langfuse.client.resources.datasets.types.DeleteDatasetRunResponse; -import com.langfuse.client.resources.datasets.types.PaginatedDatasetRuns; import com.langfuse.client.resources.datasets.types.PaginatedDatasets; public class RawDatasetsClient { @@ -237,201 +233,4 @@ public LangfuseClientHttpResponse create(CreateDatasetRequest request, throw new LangfuseClientException("Network error executing HTTP request", e); } } - - /** - * Get a dataset run and its items - */ - public LangfuseClientHttpResponse getRun(String datasetName, - String runName) { - return getRun(datasetName,runName,null); - } - - /** - * Get a dataset run and its items - */ - public LangfuseClientHttpResponse getRun(String datasetName, - String runName, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("datasets") - .addPathSegment(datasetName) - .addPathSegments("runs") - .addPathSegment(runName);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DatasetRunWithItems.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - - /** - * Delete a dataset run and all its run items. This action is irreversible. - */ - public LangfuseClientHttpResponse deleteRun(String datasetName, - String runName) { - return deleteRun(datasetName,runName,null); - } - - /** - * Delete a dataset run and all its run items. This action is irreversible. - */ - public LangfuseClientHttpResponse deleteRun(String datasetName, - String runName, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("datasets") - .addPathSegment(datasetName) - .addPathSegments("runs") - .addPathSegment(runName);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteDatasetRunResponse.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - - /** - * Get dataset runs - */ - public LangfuseClientHttpResponse getRuns(String datasetName) { - return getRuns(datasetName,GetDatasetRunsRequest.builder().build()); - } - - /** - * Get dataset runs - */ - public LangfuseClientHttpResponse getRuns(String datasetName, - RequestOptions requestOptions) { - return getRuns(datasetName,GetDatasetRunsRequest.builder().build(),requestOptions); - } - - /** - * Get dataset runs - */ - public LangfuseClientHttpResponse getRuns(String datasetName, - GetDatasetRunsRequest request) { - return getRuns(datasetName,request,null); - } - - /** - * Get dataset runs - */ - public LangfuseClientHttpResponse getRuns(String datasetName, - GetDatasetRunsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("datasets") - .addPathSegment(datasetName) - .addPathSegments("runs");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaginatedDatasetRuns.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } } diff --git a/src/main/java/com/langfuse/client/resources/datasets/requests/GetDatasetRunsRequest.java b/src/main/java/com/langfuse/client/resources/datasets/requests/GetDatasetRunsRequest.java deleted file mode 100644 index cb91a47..0000000 --- a/src/main/java/com/langfuse/client/resources/datasets/requests/GetDatasetRunsRequest.java +++ /dev/null @@ -1,155 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasets.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetDatasetRunsRequest.Builder.class -) -public final class GetDatasetRunsRequest { - private final Optional page; - - private final Optional limit; - - private final Map additionalProperties; - - private GetDatasetRunsRequest(Optional page, Optional limit, - Map additionalProperties) { - this.page = page; - this.limit = limit; - this.additionalProperties = additionalProperties; - } - - /** - * @return page number, starts at 1 - */ - @JsonProperty("page") - public Optional getPage() { - return page; - } - - /** - * @return limit of items per page - */ - @JsonProperty("limit") - public Optional getLimit() { - return limit; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetDatasetRunsRequest && equalTo((GetDatasetRunsRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetDatasetRunsRequest other) { - return page.equals(other.page) && limit.equals(other.limit); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.page, this.limit); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional page = Optional.empty(); - - private Optional limit = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(GetDatasetRunsRequest other) { - page(other.getPage()); - limit(other.getLimit()); - return this; - } - - /** - *

page number, starts at 1

- */ - @JsonSetter( - value = "page", - nulls = Nulls.SKIP - ) - public Builder page(Optional page) { - this.page = page; - return this; - } - - public Builder page(Integer page) { - this.page = Optional.ofNullable(page); - return this; - } - - /** - *

limit of items per page

- */ - @JsonSetter( - value = "limit", - nulls = Nulls.SKIP - ) - public Builder limit(Optional limit) { - this.limit = limit; - return this; - } - - public Builder limit(Integer limit) { - this.limit = Optional.ofNullable(limit); - return this; - } - - public GetDatasetRunsRequest build() { - return new GetDatasetRunsRequest(page, limit, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/datasets/types/DeleteDatasetRunResponse.java b/src/main/java/com/langfuse/client/resources/datasets/types/DeleteDatasetRunResponse.java deleted file mode 100644 index 06c318f..0000000 --- a/src/main/java/com/langfuse/client/resources/datasets/types/DeleteDatasetRunResponse.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasets.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = DeleteDatasetRunResponse.Builder.class -) -public final class DeleteDatasetRunResponse { - private final String message; - - private final Map additionalProperties; - - private DeleteDatasetRunResponse(String message, Map additionalProperties) { - this.message = message; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("message") - public String getMessage() { - return message; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof DeleteDatasetRunResponse && equalTo((DeleteDatasetRunResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(DeleteDatasetRunResponse other) { - return message.equals(other.message); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.message); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MessageStage builder() { - return new Builder(); - } - - public interface MessageStage { - _FinalStage message(@NotNull String message); - - Builder from(DeleteDatasetRunResponse other); - } - - public interface _FinalStage { - DeleteDatasetRunResponse build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements MessageStage, _FinalStage { - private String message; - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(DeleteDatasetRunResponse other) { - message(other.getMessage()); - return this; - } - - @java.lang.Override - @JsonSetter("message") - public _FinalStage message(@NotNull String message) { - this.message = Objects.requireNonNull(message, "message must not be null"); - return this; - } - - @java.lang.Override - public DeleteDatasetRunResponse build() { - return new DeleteDatasetRunResponse(message, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/datasets/types/PaginatedDatasetRuns.java b/src/main/java/com/langfuse/client/resources/datasets/types/PaginatedDatasetRuns.java deleted file mode 100644 index 10aadd4..0000000 --- a/src/main/java/com/langfuse/client/resources/datasets/types/PaginatedDatasetRuns.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.datasets.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.DatasetRun; -import com.langfuse.client.resources.utils.pagination.types.MetaResponse; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = PaginatedDatasetRuns.Builder.class -) -public final class PaginatedDatasetRuns { - private final List data; - - private final MetaResponse meta; - - private final Map additionalProperties; - - private PaginatedDatasetRuns(List data, MetaResponse meta, - Map additionalProperties) { - this.data = data; - this.meta = meta; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public List getData() { - return data; - } - - @JsonProperty("meta") - public MetaResponse getMeta() { - return meta; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PaginatedDatasetRuns && equalTo((PaginatedDatasetRuns) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(PaginatedDatasetRuns other) { - return data.equals(other.data) && meta.equals(other.meta); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.data, this.meta); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetaStage builder() { - return new Builder(); - } - - public interface MetaStage { - _FinalStage meta(@NotNull MetaResponse meta); - - Builder from(PaginatedDatasetRuns other); - } - - public interface _FinalStage { - PaginatedDatasetRuns build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage data(List data); - - _FinalStage addData(DatasetRun data); - - _FinalStage addAllData(List data); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements MetaStage, _FinalStage { - private MetaResponse meta; - - private List data = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(PaginatedDatasetRuns other) { - data(other.getData()); - meta(other.getMeta()); - return this; - } - - @java.lang.Override - @JsonSetter("meta") - public _FinalStage meta(@NotNull MetaResponse meta) { - this.meta = Objects.requireNonNull(meta, "meta must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllData(List data) { - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public _FinalStage addData(DatasetRun data) { - this.data.add(data); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "data", - nulls = Nulls.SKIP - ) - public _FinalStage data(List data) { - this.data.clear(); - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public PaginatedDatasetRuns build() { - return new PaginatedDatasetRuns(data, meta, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/AsyncIngestionClient.java b/src/main/java/com/langfuse/client/resources/ingestion/AsyncIngestionClient.java deleted file mode 100644 index 35d3366..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/AsyncIngestionClient.java +++ /dev/null @@ -1,70 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import com.langfuse.client.resources.ingestion.requests.IngestionRequest; -import com.langfuse.client.resources.ingestion.types.IngestionResponse; - -public class AsyncIngestionClient { - protected final ClientOptions clientOptions; - - private final AsyncRawIngestionClient rawClient; - - public AsyncIngestionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawIngestionClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawIngestionClient withRawResponse() { - return this.rawClient; - } - - /** - * Legacy endpoint for batch ingestion for Langfuse Observability. - *

-> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry

- *

Within each batch, there can be multiple events. - * Each event has a type, an id, a timestamp, metadata and a body. - * Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. - * We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. - * The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. - * I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.

- *

Notes:

- *
    - *
  • Introduction to data model: https://langfuse.com/docs/observability/data-model
  • - *
  • Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
  • - *
  • The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
  • - *
- */ - public CompletableFuture batch(IngestionRequest request) { - return this.rawClient.batch(request).thenApply(response -> response.body()); - } - - /** - * Legacy endpoint for batch ingestion for Langfuse Observability. - *

-> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry

- *

Within each batch, there can be multiple events. - * Each event has a type, an id, a timestamp, metadata and a body. - * Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. - * We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. - * The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. - * I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.

- *

Notes:

- *
    - *
  • Introduction to data model: https://langfuse.com/docs/observability/data-model
  • - *
  • Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
  • - *
  • The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
  • - *
- */ - public CompletableFuture batch(IngestionRequest request, - RequestOptions requestOptions) { - return this.rawClient.batch(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/AsyncRawIngestionClient.java b/src/main/java/com/langfuse/client/resources/ingestion/AsyncRawIngestionClient.java deleted file mode 100644 index 9648bd6..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/AsyncRawIngestionClient.java +++ /dev/null @@ -1,152 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.MediaTypes; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.ingestion.requests.IngestionRequest; -import com.langfuse.client.resources.ingestion.types.IngestionResponse; - -public class AsyncRawIngestionClient { - protected final ClientOptions clientOptions; - - public AsyncRawIngestionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Legacy endpoint for batch ingestion for Langfuse Observability. - *

-> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry

- *

Within each batch, there can be multiple events. - * Each event has a type, an id, a timestamp, metadata and a body. - * Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. - * We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. - * The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. - * I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.

- *

Notes:

- *
    - *
  • Introduction to data model: https://langfuse.com/docs/observability/data-model
  • - *
  • Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
  • - *
  • The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
  • - *
- */ - public CompletableFuture> batch( - IngestionRequest request) { - return batch(request,null); - } - - /** - * Legacy endpoint for batch ingestion for Langfuse Observability. - *

-> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry

- *

Within each batch, there can be multiple events. - * Each event has a type, an id, a timestamp, metadata and a body. - * Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. - * We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. - * The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. - * I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.

- *

Notes:

- *
    - *
  • Introduction to data model: https://langfuse.com/docs/observability/data-model
  • - *
  • Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
  • - *
  • The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
  • - *
- */ - public CompletableFuture> batch( - IngestionRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("ingestion");if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - RequestBody body; - try { - body = RequestBody.create(ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } - catch(JsonProcessingException e) { - throw new LangfuseClientException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, IngestionResponse.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - } diff --git a/src/main/java/com/langfuse/client/resources/ingestion/IngestionClient.java b/src/main/java/com/langfuse/client/resources/ingestion/IngestionClient.java deleted file mode 100644 index 1ae0be4..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/IngestionClient.java +++ /dev/null @@ -1,68 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import com.langfuse.client.resources.ingestion.requests.IngestionRequest; -import com.langfuse.client.resources.ingestion.types.IngestionResponse; - -public class IngestionClient { - protected final ClientOptions clientOptions; - - private final RawIngestionClient rawClient; - - public IngestionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawIngestionClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawIngestionClient withRawResponse() { - return this.rawClient; - } - - /** - * Legacy endpoint for batch ingestion for Langfuse Observability. - *

-> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry

- *

Within each batch, there can be multiple events. - * Each event has a type, an id, a timestamp, metadata and a body. - * Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. - * We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. - * The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. - * I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.

- *

Notes:

- *
    - *
  • Introduction to data model: https://langfuse.com/docs/observability/data-model
  • - *
  • Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
  • - *
  • The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
  • - *
- */ - public IngestionResponse batch(IngestionRequest request) { - return this.rawClient.batch(request).body(); - } - - /** - * Legacy endpoint for batch ingestion for Langfuse Observability. - *

-> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry

- *

Within each batch, there can be multiple events. - * Each event has a type, an id, a timestamp, metadata and a body. - * Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. - * We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. - * The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. - * I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.

- *

Notes:

- *
    - *
  • Introduction to data model: https://langfuse.com/docs/observability/data-model
  • - *
  • Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
  • - *
  • The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
  • - *
- */ - public IngestionResponse batch(IngestionRequest request, RequestOptions requestOptions) { - return this.rawClient.batch(request, requestOptions).body(); - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/RawIngestionClient.java b/src/main/java/com/langfuse/client/resources/ingestion/RawIngestionClient.java deleted file mode 100644 index a9e3cc1..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/RawIngestionClient.java +++ /dev/null @@ -1,128 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.MediaTypes; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.String; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.RequestBody; -import okhttp3.Response; -import okhttp3.ResponseBody; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.ingestion.requests.IngestionRequest; -import com.langfuse.client.resources.ingestion.types.IngestionResponse; - -public class RawIngestionClient { - protected final ClientOptions clientOptions; - - public RawIngestionClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Legacy endpoint for batch ingestion for Langfuse Observability. - *

-> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry

- *

Within each batch, there can be multiple events. - * Each event has a type, an id, a timestamp, metadata and a body. - * Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. - * We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. - * The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. - * I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.

- *

Notes:

- *
    - *
  • Introduction to data model: https://langfuse.com/docs/observability/data-model
  • - *
  • Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
  • - *
  • The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
  • - *
- */ - public LangfuseClientHttpResponse batch(IngestionRequest request) { - return batch(request,null); - } - - /** - * Legacy endpoint for batch ingestion for Langfuse Observability. - *

-> Please use the OpenTelemetry endpoint (/api/public/otel/v1/traces). Learn more: https://langfuse.com/integrations/native/opentelemetry

- *

Within each batch, there can be multiple events. - * Each event has a type, an id, a timestamp, metadata and a body. - * Internally, we refer to this as the "event envelope" as it tells us something about the event but not the trace. - * We use the event id within this envelope to deduplicate messages to avoid processing the same event twice, i.e. the event id should be unique per request. - * The event.body.id is the ID of the actual trace and will be used for updates and will be visible within the Langfuse App. - * I.e. if you want to update a trace, you'd use the same body id, but separate event IDs.

- *

Notes:

- *
    - *
  • Introduction to data model: https://langfuse.com/docs/observability/data-model
  • - *
  • Batch sizes are limited to 3.5 MB in total. You need to adjust the number of events per batch accordingly.
  • - *
  • The API does not return a 4xx status code for input errors. Instead, it responds with a 207 status code, which includes a list of the encountered errors.
  • - *
- */ - public LangfuseClientHttpResponse batch(IngestionRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("ingestion");if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - RequestBody body; - try { - body = RequestBody.create(ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } - catch(JsonProcessingException e) { - throw new LangfuseClientException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("POST", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, IngestionResponse.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - } diff --git a/src/main/java/com/langfuse/client/resources/ingestion/requests/IngestionRequest.java b/src/main/java/com/langfuse/client/resources/ingestion/requests/IngestionRequest.java deleted file mode 100644 index 975f5aa..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/requests/IngestionRequest.java +++ /dev/null @@ -1,167 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import com.langfuse.client.resources.ingestion.types.IngestionEvent; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = IngestionRequest.Builder.class -) -public final class IngestionRequest { - private final List batch; - - private final Optional metadata; - - private final Map additionalProperties; - - private IngestionRequest(List batch, Optional metadata, - Map additionalProperties) { - this.batch = batch; - this.metadata = metadata; - this.additionalProperties = additionalProperties; - } - - /** - * @return Batch of tracing events to be ingested. Discriminated by attribute type. - */ - @JsonProperty("batch") - public List getBatch() { - return batch; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof IngestionRequest && equalTo((IngestionRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(IngestionRequest other) { - return batch.equals(other.batch) && metadata.equals(other.metadata); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.batch, this.metadata); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private List batch = new ArrayList<>(); - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(IngestionRequest other) { - batch(other.getBatch()); - metadata(other.getMetadata()); - return this; - } - - /** - *

Batch of tracing events to be ingested. Discriminated by attribute type.

- */ - @JsonSetter( - value = "batch", - nulls = Nulls.SKIP - ) - public Builder batch(List batch) { - this.batch.clear(); - if (batch != null) { - this.batch.addAll(batch); - } - return this; - } - - public Builder addBatch(IngestionEvent batch) { - this.batch.add(batch); - return this; - } - - public Builder addAllBatch(List batch) { - if (batch != null) { - this.batch.addAll(batch); - } - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - public IngestionRequest build() { - return new IngestionRequest(batch, metadata, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/BaseEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/BaseEvent.java deleted file mode 100644 index 9c56db1..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/BaseEvent.java +++ /dev/null @@ -1,220 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = BaseEvent.Builder.class -) -public final class BaseEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final Map additionalProperties; - - private BaseEvent(String id, String timestamp, Optional metadata, - Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BaseEvent && equalTo((BaseEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(BaseEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(BaseEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - _FinalStage timestamp(@NotNull String timestamp); - } - - public interface _FinalStage { - BaseEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, _FinalStage { - private String id; - - private String timestamp; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(BaseEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public _FinalStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public BaseEvent build() { - return new BaseEvent(id, timestamp, metadata, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateEventBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/CreateEventBody.java deleted file mode 100644 index 2328755..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateEventBody.java +++ /dev/null @@ -1,409 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CreateEventBody.Builder.class -) -public final class CreateEventBody implements ICreateEventBody, IOptionalObservationBody { - private final Optional id; - - private final Optional traceId; - - private final Optional name; - - private final Optional startTime; - - private final Optional metadata; - - private final Optional input; - - private final Optional output; - - private final Optional level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional version; - - private final Optional environment; - - private final Map additionalProperties; - - private CreateEventBody(Optional id, Optional traceId, Optional name, - Optional startTime, Optional metadata, Optional input, - Optional output, Optional level, Optional statusMessage, - Optional parentObservationId, Optional version, Optional environment, - Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.name = name; - this.startTime = startTime; - this.metadata = metadata; - this.input = input; - this.output = output; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.version = version; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public Optional getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public Optional getName() { - return name; - } - - @JsonProperty("startTime") - @java.lang.Override - public Optional getStartTime() { - return startTime; - } - - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - @JsonProperty("level") - @java.lang.Override - public Optional getLevel() { - return level; - } - - @JsonProperty("statusMessage") - @java.lang.Override - public Optional getStatusMessage() { - return statusMessage; - } - - @JsonProperty("parentObservationId") - @java.lang.Override - public Optional getParentObservationId() { - return parentObservationId; - } - - @JsonProperty("version") - @java.lang.Override - public Optional getVersion() { - return version; - } - - @JsonProperty("environment") - @java.lang.Override - public Optional getEnvironment() { - return environment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateEventBody && equalTo((CreateEventBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateEventBody other) { - return id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && startTime.equals(other.startTime) && metadata.equals(other.metadata) && input.equals(other.input) && output.equals(other.output) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && version.equals(other.version) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.name, this.startTime, this.metadata, this.input, this.output, this.level, this.statusMessage, this.parentObservationId, this.version, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional id = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional startTime = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional environment = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(CreateEventBody other) { - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - startTime(other.getStartTime()); - metadata(other.getMetadata()); - input(other.getInput()); - output(other.getOutput()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - version(other.getVersion()); - environment(other.getEnvironment()); - return this; - } - - @JsonSetter( - value = "id", - nulls = Nulls.SKIP - ) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public Builder traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - public Builder traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter( - value = "startTime", - nulls = Nulls.SKIP - ) - public Builder startTime(Optional startTime) { - this.startTime = startTime; - return this; - } - - public Builder startTime(OffsetDateTime startTime) { - this.startTime = Optional.ofNullable(startTime); - return this; - } - - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public Builder input(Optional input) { - this.input = input; - return this; - } - - public Builder input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public Builder output(Optional output) { - this.output = output; - return this; - } - - public Builder output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public Builder level(Optional level) { - this.level = level; - return this; - } - - public Builder level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public Builder statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - public Builder statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public Builder parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - public Builder parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional environment) { - this.environment = environment; - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - public CreateEventBody build() { - return new CreateEventBody(id, traceId, name, startTime, metadata, input, output, level, statusMessage, parentObservationId, version, environment, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateEventEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/CreateEventEvent.java deleted file mode 100644 index 90f15fd..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateEventEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CreateEventEvent.Builder.class -) -public final class CreateEventEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final CreateEventBody body; - - private final Map additionalProperties; - - private CreateEventEvent(String id, String timestamp, Optional metadata, - CreateEventBody body, Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public CreateEventBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateEventEvent && equalTo((CreateEventEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateEventEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(CreateEventEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull CreateEventBody body); - } - - public interface _FinalStage { - CreateEventEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private CreateEventBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(CreateEventEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull CreateEventBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public CreateEventEvent build() { - return new CreateEventEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateGenerationBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/CreateGenerationBody.java deleted file mode 100644 index 1f06423..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateGenerationBody.java +++ /dev/null @@ -1,643 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Double; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import com.langfuse.client.resources.commons.types.MapValue; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CreateGenerationBody.Builder.class -) -public final class CreateGenerationBody implements ICreateSpanBody, ICreateEventBody, IOptionalObservationBody { - private final Optional endTime; - - private final Optional id; - - private final Optional traceId; - - private final Optional name; - - private final Optional startTime; - - private final Optional metadata; - - private final Optional input; - - private final Optional output; - - private final Optional level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional version; - - private final Optional environment; - - private final Optional completionStartTime; - - private final Optional model; - - private final Optional> modelParameters; - - private final Optional usage; - - private final Optional usageDetails; - - private final Optional> costDetails; - - private final Optional promptName; - - private final Optional promptVersion; - - private final Map additionalProperties; - - private CreateGenerationBody(Optional endTime, Optional id, - Optional traceId, Optional name, Optional startTime, - Optional metadata, Optional input, Optional output, - Optional level, Optional statusMessage, - Optional parentObservationId, Optional version, Optional environment, - Optional completionStartTime, Optional model, - Optional> modelParameters, Optional usage, - Optional usageDetails, Optional> costDetails, - Optional promptName, Optional promptVersion, - Map additionalProperties) { - this.endTime = endTime; - this.id = id; - this.traceId = traceId; - this.name = name; - this.startTime = startTime; - this.metadata = metadata; - this.input = input; - this.output = output; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.version = version; - this.environment = environment; - this.completionStartTime = completionStartTime; - this.model = model; - this.modelParameters = modelParameters; - this.usage = usage; - this.usageDetails = usageDetails; - this.costDetails = costDetails; - this.promptName = promptName; - this.promptVersion = promptVersion; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("endTime") - @java.lang.Override - public Optional getEndTime() { - return endTime; - } - - @JsonProperty("id") - @java.lang.Override - public Optional getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public Optional getName() { - return name; - } - - @JsonProperty("startTime") - @java.lang.Override - public Optional getStartTime() { - return startTime; - } - - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - @JsonProperty("level") - @java.lang.Override - public Optional getLevel() { - return level; - } - - @JsonProperty("statusMessage") - @java.lang.Override - public Optional getStatusMessage() { - return statusMessage; - } - - @JsonProperty("parentObservationId") - @java.lang.Override - public Optional getParentObservationId() { - return parentObservationId; - } - - @JsonProperty("version") - @java.lang.Override - public Optional getVersion() { - return version; - } - - @JsonProperty("environment") - @java.lang.Override - public Optional getEnvironment() { - return environment; - } - - @JsonProperty("completionStartTime") - public Optional getCompletionStartTime() { - return completionStartTime; - } - - @JsonProperty("model") - public Optional getModel() { - return model; - } - - @JsonProperty("modelParameters") - public Optional> getModelParameters() { - return modelParameters; - } - - @JsonProperty("usage") - public Optional getUsage() { - return usage; - } - - @JsonProperty("usageDetails") - public Optional getUsageDetails() { - return usageDetails; - } - - @JsonProperty("costDetails") - public Optional> getCostDetails() { - return costDetails; - } - - @JsonProperty("promptName") - public Optional getPromptName() { - return promptName; - } - - @JsonProperty("promptVersion") - public Optional getPromptVersion() { - return promptVersion; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateGenerationBody && equalTo((CreateGenerationBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateGenerationBody other) { - return endTime.equals(other.endTime) && id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && startTime.equals(other.startTime) && metadata.equals(other.metadata) && input.equals(other.input) && output.equals(other.output) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && version.equals(other.version) && environment.equals(other.environment) && completionStartTime.equals(other.completionStartTime) && model.equals(other.model) && modelParameters.equals(other.modelParameters) && usage.equals(other.usage) && usageDetails.equals(other.usageDetails) && costDetails.equals(other.costDetails) && promptName.equals(other.promptName) && promptVersion.equals(other.promptVersion); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.endTime, this.id, this.traceId, this.name, this.startTime, this.metadata, this.input, this.output, this.level, this.statusMessage, this.parentObservationId, this.version, this.environment, this.completionStartTime, this.model, this.modelParameters, this.usage, this.usageDetails, this.costDetails, this.promptName, this.promptVersion); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional endTime = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional startTime = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional environment = Optional.empty(); - - private Optional completionStartTime = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional> modelParameters = Optional.empty(); - - private Optional usage = Optional.empty(); - - private Optional usageDetails = Optional.empty(); - - private Optional> costDetails = Optional.empty(); - - private Optional promptName = Optional.empty(); - - private Optional promptVersion = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(CreateGenerationBody other) { - endTime(other.getEndTime()); - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - startTime(other.getStartTime()); - metadata(other.getMetadata()); - input(other.getInput()); - output(other.getOutput()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - version(other.getVersion()); - environment(other.getEnvironment()); - completionStartTime(other.getCompletionStartTime()); - model(other.getModel()); - modelParameters(other.getModelParameters()); - usage(other.getUsage()); - usageDetails(other.getUsageDetails()); - costDetails(other.getCostDetails()); - promptName(other.getPromptName()); - promptVersion(other.getPromptVersion()); - return this; - } - - @JsonSetter( - value = "endTime", - nulls = Nulls.SKIP - ) - public Builder endTime(Optional endTime) { - this.endTime = endTime; - return this; - } - - public Builder endTime(OffsetDateTime endTime) { - this.endTime = Optional.ofNullable(endTime); - return this; - } - - @JsonSetter( - value = "id", - nulls = Nulls.SKIP - ) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public Builder traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - public Builder traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter( - value = "startTime", - nulls = Nulls.SKIP - ) - public Builder startTime(Optional startTime) { - this.startTime = startTime; - return this; - } - - public Builder startTime(OffsetDateTime startTime) { - this.startTime = Optional.ofNullable(startTime); - return this; - } - - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public Builder input(Optional input) { - this.input = input; - return this; - } - - public Builder input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public Builder output(Optional output) { - this.output = output; - return this; - } - - public Builder output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public Builder level(Optional level) { - this.level = level; - return this; - } - - public Builder level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public Builder statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - public Builder statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public Builder parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - public Builder parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional environment) { - this.environment = environment; - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - @JsonSetter( - value = "completionStartTime", - nulls = Nulls.SKIP - ) - public Builder completionStartTime(Optional completionStartTime) { - this.completionStartTime = completionStartTime; - return this; - } - - public Builder completionStartTime(OffsetDateTime completionStartTime) { - this.completionStartTime = Optional.ofNullable(completionStartTime); - return this; - } - - @JsonSetter( - value = "model", - nulls = Nulls.SKIP - ) - public Builder model(Optional model) { - this.model = model; - return this; - } - - public Builder model(String model) { - this.model = Optional.ofNullable(model); - return this; - } - - @JsonSetter( - value = "modelParameters", - nulls = Nulls.SKIP - ) - public Builder modelParameters(Optional> modelParameters) { - this.modelParameters = modelParameters; - return this; - } - - public Builder modelParameters(Map modelParameters) { - this.modelParameters = Optional.ofNullable(modelParameters); - return this; - } - - @JsonSetter( - value = "usage", - nulls = Nulls.SKIP - ) - public Builder usage(Optional usage) { - this.usage = usage; - return this; - } - - public Builder usage(IngestionUsage usage) { - this.usage = Optional.ofNullable(usage); - return this; - } - - @JsonSetter( - value = "usageDetails", - nulls = Nulls.SKIP - ) - public Builder usageDetails(Optional usageDetails) { - this.usageDetails = usageDetails; - return this; - } - - public Builder usageDetails(UsageDetails usageDetails) { - this.usageDetails = Optional.ofNullable(usageDetails); - return this; - } - - @JsonSetter( - value = "costDetails", - nulls = Nulls.SKIP - ) - public Builder costDetails(Optional> costDetails) { - this.costDetails = costDetails; - return this; - } - - public Builder costDetails(Map costDetails) { - this.costDetails = Optional.ofNullable(costDetails); - return this; - } - - @JsonSetter( - value = "promptName", - nulls = Nulls.SKIP - ) - public Builder promptName(Optional promptName) { - this.promptName = promptName; - return this; - } - - public Builder promptName(String promptName) { - this.promptName = Optional.ofNullable(promptName); - return this; - } - - @JsonSetter( - value = "promptVersion", - nulls = Nulls.SKIP - ) - public Builder promptVersion(Optional promptVersion) { - this.promptVersion = promptVersion; - return this; - } - - public Builder promptVersion(Integer promptVersion) { - this.promptVersion = Optional.ofNullable(promptVersion); - return this; - } - - public CreateGenerationBody build() { - return new CreateGenerationBody(endTime, id, traceId, name, startTime, metadata, input, output, level, statusMessage, parentObservationId, version, environment, completionStartTime, model, modelParameters, usage, usageDetails, costDetails, promptName, promptVersion, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateGenerationEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/CreateGenerationEvent.java deleted file mode 100644 index 6e406ca..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateGenerationEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CreateGenerationEvent.Builder.class -) -public final class CreateGenerationEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final CreateGenerationBody body; - - private final Map additionalProperties; - - private CreateGenerationEvent(String id, String timestamp, Optional metadata, - CreateGenerationBody body, Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public CreateGenerationBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateGenerationEvent && equalTo((CreateGenerationEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateGenerationEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(CreateGenerationEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull CreateGenerationBody body); - } - - public interface _FinalStage { - CreateGenerationEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private CreateGenerationBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(CreateGenerationEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull CreateGenerationBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public CreateGenerationEvent build() { - return new CreateGenerationEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateObservationEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/CreateObservationEvent.java deleted file mode 100644 index 3303700..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateObservationEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CreateObservationEvent.Builder.class -) -public final class CreateObservationEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final ObservationBody body; - - private final Map additionalProperties; - - private CreateObservationEvent(String id, String timestamp, Optional metadata, - ObservationBody body, Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public ObservationBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateObservationEvent && equalTo((CreateObservationEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateObservationEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(CreateObservationEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull ObservationBody body); - } - - public interface _FinalStage { - CreateObservationEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private ObservationBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(CreateObservationEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull ObservationBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public CreateObservationEvent build() { - return new CreateObservationEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateSpanBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/CreateSpanBody.java deleted file mode 100644 index ee967ce..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateSpanBody.java +++ /dev/null @@ -1,436 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CreateSpanBody.Builder.class -) -public final class CreateSpanBody implements ICreateSpanBody, ICreateEventBody, IOptionalObservationBody { - private final Optional endTime; - - private final Optional id; - - private final Optional traceId; - - private final Optional name; - - private final Optional startTime; - - private final Optional metadata; - - private final Optional input; - - private final Optional output; - - private final Optional level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional version; - - private final Optional environment; - - private final Map additionalProperties; - - private CreateSpanBody(Optional endTime, Optional id, - Optional traceId, Optional name, Optional startTime, - Optional metadata, Optional input, Optional output, - Optional level, Optional statusMessage, - Optional parentObservationId, Optional version, Optional environment, - Map additionalProperties) { - this.endTime = endTime; - this.id = id; - this.traceId = traceId; - this.name = name; - this.startTime = startTime; - this.metadata = metadata; - this.input = input; - this.output = output; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.version = version; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("endTime") - @java.lang.Override - public Optional getEndTime() { - return endTime; - } - - @JsonProperty("id") - @java.lang.Override - public Optional getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public Optional getName() { - return name; - } - - @JsonProperty("startTime") - @java.lang.Override - public Optional getStartTime() { - return startTime; - } - - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - @JsonProperty("level") - @java.lang.Override - public Optional getLevel() { - return level; - } - - @JsonProperty("statusMessage") - @java.lang.Override - public Optional getStatusMessage() { - return statusMessage; - } - - @JsonProperty("parentObservationId") - @java.lang.Override - public Optional getParentObservationId() { - return parentObservationId; - } - - @JsonProperty("version") - @java.lang.Override - public Optional getVersion() { - return version; - } - - @JsonProperty("environment") - @java.lang.Override - public Optional getEnvironment() { - return environment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateSpanBody && equalTo((CreateSpanBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateSpanBody other) { - return endTime.equals(other.endTime) && id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && startTime.equals(other.startTime) && metadata.equals(other.metadata) && input.equals(other.input) && output.equals(other.output) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && version.equals(other.version) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.endTime, this.id, this.traceId, this.name, this.startTime, this.metadata, this.input, this.output, this.level, this.statusMessage, this.parentObservationId, this.version, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional endTime = Optional.empty(); - - private Optional id = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional startTime = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional environment = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(CreateSpanBody other) { - endTime(other.getEndTime()); - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - startTime(other.getStartTime()); - metadata(other.getMetadata()); - input(other.getInput()); - output(other.getOutput()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - version(other.getVersion()); - environment(other.getEnvironment()); - return this; - } - - @JsonSetter( - value = "endTime", - nulls = Nulls.SKIP - ) - public Builder endTime(Optional endTime) { - this.endTime = endTime; - return this; - } - - public Builder endTime(OffsetDateTime endTime) { - this.endTime = Optional.ofNullable(endTime); - return this; - } - - @JsonSetter( - value = "id", - nulls = Nulls.SKIP - ) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public Builder traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - public Builder traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter( - value = "startTime", - nulls = Nulls.SKIP - ) - public Builder startTime(Optional startTime) { - this.startTime = startTime; - return this; - } - - public Builder startTime(OffsetDateTime startTime) { - this.startTime = Optional.ofNullable(startTime); - return this; - } - - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public Builder input(Optional input) { - this.input = input; - return this; - } - - public Builder input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public Builder output(Optional output) { - this.output = output; - return this; - } - - public Builder output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public Builder level(Optional level) { - this.level = level; - return this; - } - - public Builder level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public Builder statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - public Builder statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public Builder parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - public Builder parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional environment) { - this.environment = environment; - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - public CreateSpanBody build() { - return new CreateSpanBody(endTime, id, traceId, name, startTime, metadata, input, output, level, statusMessage, parentObservationId, version, environment, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateSpanEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/CreateSpanEvent.java deleted file mode 100644 index cbf5989..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/CreateSpanEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = CreateSpanEvent.Builder.class -) -public final class CreateSpanEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final CreateSpanBody body; - - private final Map additionalProperties; - - private CreateSpanEvent(String id, String timestamp, Optional metadata, - CreateSpanBody body, Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public CreateSpanBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CreateSpanEvent && equalTo((CreateSpanEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(CreateSpanEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(CreateSpanEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull CreateSpanBody body); - } - - public interface _FinalStage { - CreateSpanEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private CreateSpanBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(CreateSpanEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull CreateSpanBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public CreateSpanEvent build() { - return new CreateSpanEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IBaseEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IBaseEvent.java deleted file mode 100644 index 0150b72..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IBaseEvent.java +++ /dev/null @@ -1,17 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import java.lang.Object; -import java.lang.String; -import java.util.Optional; - -public interface IBaseEvent { - String getId(); - - String getTimestamp(); - - Optional getMetadata(); -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/ICreateEventBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/ICreateEventBody.java deleted file mode 100644 index 5c8bc0a..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/ICreateEventBody.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import java.lang.String; -import java.util.Optional; - -public interface ICreateEventBody extends IOptionalObservationBody { - Optional getId(); -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/ICreateSpanBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/ICreateSpanBody.java deleted file mode 100644 index 0a76180..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/ICreateSpanBody.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import java.time.OffsetDateTime; -import java.util.Optional; - -public interface ICreateSpanBody extends ICreateEventBody { - Optional getEndTime(); -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IOptionalObservationBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IOptionalObservationBody.java deleted file mode 100644 index bbbed68..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IOptionalObservationBody.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Optional; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -public interface IOptionalObservationBody { - Optional getTraceId(); - - Optional getName(); - - Optional getStartTime(); - - Optional getMetadata(); - - Optional getInput(); - - Optional getOutput(); - - Optional getLevel(); - - Optional getStatusMessage(); - - Optional getParentObservationId(); - - Optional getVersion(); - - Optional getEnvironment(); -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IUpdateEventBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IUpdateEventBody.java deleted file mode 100644 index 3dee668..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IUpdateEventBody.java +++ /dev/null @@ -1,11 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import java.lang.String; - -public interface IUpdateEventBody extends IOptionalObservationBody { - String getId(); -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IUpdateSpanBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IUpdateSpanBody.java deleted file mode 100644 index 22bb948..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IUpdateSpanBody.java +++ /dev/null @@ -1,12 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import java.time.OffsetDateTime; -import java.util.Optional; - -public interface IUpdateSpanBody extends IUpdateEventBody { - Optional getEndTime(); -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionError.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionError.java deleted file mode 100644 index b6f8093..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionError.java +++ /dev/null @@ -1,213 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = IngestionError.Builder.class -) -public final class IngestionError { - private final String id; - - private final int status; - - private final Optional message; - - private final Optional error; - - private final Map additionalProperties; - - private IngestionError(String id, int status, Optional message, Optional error, - Map additionalProperties) { - this.id = id; - this.status = status; - this.message = message; - this.error = error; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("status") - public int getStatus() { - return status; - } - - @JsonProperty("message") - public Optional getMessage() { - return message; - } - - @JsonProperty("error") - public Optional getError() { - return error; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof IngestionError && equalTo((IngestionError) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(IngestionError other) { - return id.equals(other.id) && status == other.status && message.equals(other.message) && error.equals(other.error); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.status, this.message, this.error); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - StatusStage id(@NotNull String id); - - Builder from(IngestionError other); - } - - public interface StatusStage { - _FinalStage status(int status); - } - - public interface _FinalStage { - IngestionError build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage message(Optional message); - - _FinalStage message(String message); - - _FinalStage error(Optional error); - - _FinalStage error(Object error); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, StatusStage, _FinalStage { - private String id; - - private int status; - - private Optional error = Optional.empty(); - - private Optional message = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(IngestionError other) { - id(other.getId()); - status(other.getStatus()); - message(other.getMessage()); - error(other.getError()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public StatusStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("status") - public _FinalStage status(int status) { - this.status = status; - return this; - } - - @java.lang.Override - public _FinalStage error(Object error) { - this.error = Optional.ofNullable(error); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "error", - nulls = Nulls.SKIP - ) - public _FinalStage error(Optional error) { - this.error = error; - return this; - } - - @java.lang.Override - public _FinalStage message(String message) { - this.message = Optional.ofNullable(message); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "message", - nulls = Nulls.SKIP - ) - public _FinalStage message(Optional message) { - this.message = message; - return this; - } - - @java.lang.Override - public IngestionError build() { - return new IngestionError(id, status, message, error, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionEvent.java deleted file mode 100644 index 4b61cfc..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionEvent.java +++ /dev/null @@ -1,707 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.annotation.JsonValue; -import java.lang.Object; -import java.lang.String; -import java.util.Objects; -import java.util.Optional; - -public final class IngestionEvent { - private final Value value; - - @JsonCreator( - mode = JsonCreator.Mode.DELEGATING - ) - private IngestionEvent(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static IngestionEvent traceCreate(TraceEvent value) { - return new IngestionEvent(new TraceCreateValue(value)); - } - - public static IngestionEvent scoreCreate(ScoreEvent value) { - return new IngestionEvent(new ScoreCreateValue(value)); - } - - public static IngestionEvent spanCreate(CreateSpanEvent value) { - return new IngestionEvent(new SpanCreateValue(value)); - } - - public static IngestionEvent spanUpdate(UpdateSpanEvent value) { - return new IngestionEvent(new SpanUpdateValue(value)); - } - - public static IngestionEvent generationCreate(CreateGenerationEvent value) { - return new IngestionEvent(new GenerationCreateValue(value)); - } - - public static IngestionEvent generationUpdate(UpdateGenerationEvent value) { - return new IngestionEvent(new GenerationUpdateValue(value)); - } - - public static IngestionEvent eventCreate(CreateEventEvent value) { - return new IngestionEvent(new EventCreateValue(value)); - } - - public static IngestionEvent sdkLog(SdkLogEvent value) { - return new IngestionEvent(new SdkLogValue(value)); - } - - public static IngestionEvent observationCreate(CreateObservationEvent value) { - return new IngestionEvent(new ObservationCreateValue(value)); - } - - public static IngestionEvent observationUpdate(UpdateObservationEvent value) { - return new IngestionEvent(new ObservationUpdateValue(value)); - } - - public boolean isTraceCreate() { - return value instanceof TraceCreateValue; - } - - public boolean isScoreCreate() { - return value instanceof ScoreCreateValue; - } - - public boolean isSpanCreate() { - return value instanceof SpanCreateValue; - } - - public boolean isSpanUpdate() { - return value instanceof SpanUpdateValue; - } - - public boolean isGenerationCreate() { - return value instanceof GenerationCreateValue; - } - - public boolean isGenerationUpdate() { - return value instanceof GenerationUpdateValue; - } - - public boolean isEventCreate() { - return value instanceof EventCreateValue; - } - - public boolean isSdkLog() { - return value instanceof SdkLogValue; - } - - public boolean isObservationCreate() { - return value instanceof ObservationCreateValue; - } - - public boolean isObservationUpdate() { - return value instanceof ObservationUpdateValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getTraceCreate() { - if (isTraceCreate()) { - return Optional.of(((TraceCreateValue) value).value); - } - return Optional.empty(); - } - - public Optional getScoreCreate() { - if (isScoreCreate()) { - return Optional.of(((ScoreCreateValue) value).value); - } - return Optional.empty(); - } - - public Optional getSpanCreate() { - if (isSpanCreate()) { - return Optional.of(((SpanCreateValue) value).value); - } - return Optional.empty(); - } - - public Optional getSpanUpdate() { - if (isSpanUpdate()) { - return Optional.of(((SpanUpdateValue) value).value); - } - return Optional.empty(); - } - - public Optional getGenerationCreate() { - if (isGenerationCreate()) { - return Optional.of(((GenerationCreateValue) value).value); - } - return Optional.empty(); - } - - public Optional getGenerationUpdate() { - if (isGenerationUpdate()) { - return Optional.of(((GenerationUpdateValue) value).value); - } - return Optional.empty(); - } - - public Optional getEventCreate() { - if (isEventCreate()) { - return Optional.of(((EventCreateValue) value).value); - } - return Optional.empty(); - } - - public Optional getSdkLog() { - if (isSdkLog()) { - return Optional.of(((SdkLogValue) value).value); - } - return Optional.empty(); - } - - public Optional getObservationCreate() { - if (isObservationCreate()) { - return Optional.of(((ObservationCreateValue) value).value); - } - return Optional.empty(); - } - - public Optional getObservationUpdate() { - if (isObservationUpdate()) { - return Optional.of(((ObservationUpdateValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitTraceCreate(TraceEvent traceCreate); - - T visitScoreCreate(ScoreEvent scoreCreate); - - T visitSpanCreate(CreateSpanEvent spanCreate); - - T visitSpanUpdate(UpdateSpanEvent spanUpdate); - - T visitGenerationCreate(CreateGenerationEvent generationCreate); - - T visitGenerationUpdate(UpdateGenerationEvent generationUpdate); - - T visitEventCreate(CreateEventEvent eventCreate); - - T visitSdkLog(SdkLogEvent sdkLog); - - T visitObservationCreate(CreateObservationEvent observationCreate); - - T visitObservationUpdate(UpdateObservationEvent observationUpdate); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "type", - visible = true, - defaultImpl = _UnknownValue.class - ) - @JsonSubTypes({ - @JsonSubTypes.Type(TraceCreateValue.class), - @JsonSubTypes.Type(ScoreCreateValue.class), - @JsonSubTypes.Type(SpanCreateValue.class), - @JsonSubTypes.Type(SpanUpdateValue.class), - @JsonSubTypes.Type(GenerationCreateValue.class), - @JsonSubTypes.Type(GenerationUpdateValue.class), - @JsonSubTypes.Type(EventCreateValue.class), - @JsonSubTypes.Type(SdkLogValue.class), - @JsonSubTypes.Type(ObservationCreateValue.class), - @JsonSubTypes.Type(ObservationUpdateValue.class) - }) - @JsonIgnoreProperties( - ignoreUnknown = true - ) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("trace-create") - @JsonIgnoreProperties("type") - private static final class TraceCreateValue implements Value { - @JsonUnwrapped - private TraceEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private TraceCreateValue() { - } - - private TraceCreateValue(TraceEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitTraceCreate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TraceCreateValue && equalTo((TraceCreateValue) other); - } - - private boolean equalTo(TraceCreateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("score-create") - @JsonIgnoreProperties("type") - private static final class ScoreCreateValue implements Value { - @JsonUnwrapped - private ScoreEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private ScoreCreateValue() { - } - - private ScoreCreateValue(ScoreEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitScoreCreate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScoreCreateValue && equalTo((ScoreCreateValue) other); - } - - private boolean equalTo(ScoreCreateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("span-create") - @JsonIgnoreProperties("type") - private static final class SpanCreateValue implements Value { - @JsonUnwrapped - private CreateSpanEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private SpanCreateValue() { - } - - private SpanCreateValue(CreateSpanEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitSpanCreate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpanCreateValue && equalTo((SpanCreateValue) other); - } - - private boolean equalTo(SpanCreateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("span-update") - @JsonIgnoreProperties("type") - private static final class SpanUpdateValue implements Value { - @JsonUnwrapped - private UpdateSpanEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private SpanUpdateValue() { - } - - private SpanUpdateValue(UpdateSpanEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitSpanUpdate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SpanUpdateValue && equalTo((SpanUpdateValue) other); - } - - private boolean equalTo(SpanUpdateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("generation-create") - @JsonIgnoreProperties("type") - private static final class GenerationCreateValue implements Value { - @JsonUnwrapped - private CreateGenerationEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private GenerationCreateValue() { - } - - private GenerationCreateValue(CreateGenerationEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitGenerationCreate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GenerationCreateValue && equalTo((GenerationCreateValue) other); - } - - private boolean equalTo(GenerationCreateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("generation-update") - @JsonIgnoreProperties("type") - private static final class GenerationUpdateValue implements Value { - @JsonUnwrapped - private UpdateGenerationEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private GenerationUpdateValue() { - } - - private GenerationUpdateValue(UpdateGenerationEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitGenerationUpdate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GenerationUpdateValue && equalTo((GenerationUpdateValue) other); - } - - private boolean equalTo(GenerationUpdateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("event-create") - @JsonIgnoreProperties("type") - private static final class EventCreateValue implements Value { - @JsonUnwrapped - private CreateEventEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private EventCreateValue() { - } - - private EventCreateValue(CreateEventEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitEventCreate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof EventCreateValue && equalTo((EventCreateValue) other); - } - - private boolean equalTo(EventCreateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("sdk-log") - @JsonIgnoreProperties("type") - private static final class SdkLogValue implements Value { - @JsonUnwrapped - private SdkLogEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private SdkLogValue() { - } - - private SdkLogValue(SdkLogEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitSdkLog(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SdkLogValue && equalTo((SdkLogValue) other); - } - - private boolean equalTo(SdkLogValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("observation-create") - @JsonIgnoreProperties("type") - private static final class ObservationCreateValue implements Value { - @JsonUnwrapped - private CreateObservationEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private ObservationCreateValue() { - } - - private ObservationCreateValue(CreateObservationEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitObservationCreate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ObservationCreateValue && equalTo((ObservationCreateValue) other); - } - - private boolean equalTo(ObservationCreateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonTypeName("observation-update") - @JsonIgnoreProperties("type") - private static final class ObservationUpdateValue implements Value { - @JsonUnwrapped - private UpdateObservationEvent value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private ObservationUpdateValue() { - } - - private ObservationUpdateValue(UpdateObservationEvent value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitObservationUpdate(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ObservationUpdateValue && equalTo((ObservationUpdateValue) other); - } - - private boolean equalTo(ObservationUpdateValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "value: " + value + "}"; - } - } - - @JsonIgnoreProperties("type") - private static final class _UnknownValue implements Value { - private String type; - - @JsonValue - private Object value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private _UnknownValue(@JsonProperty("value") Object value) { - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } - - @java.lang.Override - public String toString() { - return "IngestionEvent{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionResponse.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionResponse.java deleted file mode 100644 index f02749d..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionResponse.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = IngestionResponse.Builder.class -) -public final class IngestionResponse { - private final List successes; - - private final List errors; - - private final Map additionalProperties; - - private IngestionResponse(List successes, List errors, - Map additionalProperties) { - this.successes = successes; - this.errors = errors; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("successes") - public List getSuccesses() { - return successes; - } - - @JsonProperty("errors") - public List getErrors() { - return errors; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof IngestionResponse && equalTo((IngestionResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(IngestionResponse other) { - return successes.equals(other.successes) && errors.equals(other.errors); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.successes, this.errors); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private List successes = new ArrayList<>(); - - private List errors = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(IngestionResponse other) { - successes(other.getSuccesses()); - errors(other.getErrors()); - return this; - } - - @JsonSetter( - value = "successes", - nulls = Nulls.SKIP - ) - public Builder successes(List successes) { - this.successes.clear(); - if (successes != null) { - this.successes.addAll(successes); - } - return this; - } - - public Builder addSuccesses(IngestionSuccess successes) { - this.successes.add(successes); - return this; - } - - public Builder addAllSuccesses(List successes) { - if (successes != null) { - this.successes.addAll(successes); - } - return this; - } - - @JsonSetter( - value = "errors", - nulls = Nulls.SKIP - ) - public Builder errors(List errors) { - this.errors.clear(); - if (errors != null) { - this.errors.addAll(errors); - } - return this; - } - - public Builder addErrors(IngestionError errors) { - this.errors.add(errors); - return this; - } - - public Builder addAllErrors(List errors) { - if (errors != null) { - this.errors.addAll(errors); - } - return this; - } - - public IngestionResponse build() { - return new IngestionResponse(successes, errors, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionSuccess.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionSuccess.java deleted file mode 100644 index 47883bf..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionSuccess.java +++ /dev/null @@ -1,148 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = IngestionSuccess.Builder.class -) -public final class IngestionSuccess { - private final String id; - - private final int status; - - private final Map additionalProperties; - - private IngestionSuccess(String id, int status, Map additionalProperties) { - this.id = id; - this.status = status; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @JsonProperty("status") - public int getStatus() { - return status; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof IngestionSuccess && equalTo((IngestionSuccess) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(IngestionSuccess other) { - return id.equals(other.id) && status == other.status; - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.status); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - StatusStage id(@NotNull String id); - - Builder from(IngestionSuccess other); - } - - public interface StatusStage { - _FinalStage status(int status); - } - - public interface _FinalStage { - IngestionSuccess build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, StatusStage, _FinalStage { - private String id; - - private int status; - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(IngestionSuccess other) { - id(other.getId()); - status(other.getStatus()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public StatusStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("status") - public _FinalStage status(int status) { - this.status = status; - return this; - } - - @java.lang.Override - public IngestionSuccess build() { - return new IngestionSuccess(id, status, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionUsage.java b/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionUsage.java deleted file mode 100644 index 98673a1..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/IngestionUsage.java +++ /dev/null @@ -1,105 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.langfuse.client.core.ObjectMappers; -import java.io.IOException; -import java.lang.IllegalStateException; -import java.lang.Object; -import java.lang.RuntimeException; -import java.lang.String; -import java.lang.SuppressWarnings; -import java.util.Objects; -import com.langfuse.client.resources.commons.types.Usage; - -@JsonDeserialize( - using = IngestionUsage.Deserializer.class -) -public final class IngestionUsage { - private final Object value; - - private final int type; - - private IngestionUsage(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if(this.type == 0) { - return visitor.visit((Usage) this.value); - } else if(this.type == 1) { - return visitor.visit((OpenAiUsage) this.value); - } - throw new IllegalStateException("Failed to visit value. This should never happen."); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof IngestionUsage && equalTo((IngestionUsage) other); - } - - private boolean equalTo(IngestionUsage other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return this.value.toString(); - } - - public static IngestionUsage of(Usage value) { - return new IngestionUsage(value, 0); - } - - public static IngestionUsage of(OpenAiUsage value) { - return new IngestionUsage(value, 1); - } - - public interface Visitor { - T visit(Usage value); - - T visit(OpenAiUsage value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(IngestionUsage.class); - } - - @java.lang.Override - public IngestionUsage deserialize(JsonParser p, DeserializationContext context) throws - IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, Usage.class)); - } catch(RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, OpenAiUsage.class)); - } catch(RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/ObservationBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/ObservationBody.java deleted file mode 100644 index c24874b..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/ObservationBody.java +++ /dev/null @@ -1,666 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.MapValue; -import com.langfuse.client.resources.commons.types.ObservationLevel; -import com.langfuse.client.resources.commons.types.Usage; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = ObservationBody.Builder.class -) -public final class ObservationBody { - private final Optional id; - - private final Optional traceId; - - private final ObservationType type; - - private final Optional name; - - private final Optional startTime; - - private final Optional endTime; - - private final Optional completionStartTime; - - private final Optional model; - - private final Optional> modelParameters; - - private final Optional input; - - private final Optional version; - - private final Optional metadata; - - private final Optional output; - - private final Optional usage; - - private final Optional level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional environment; - - private final Map additionalProperties; - - private ObservationBody(Optional id, Optional traceId, ObservationType type, - Optional name, Optional startTime, Optional endTime, - Optional completionStartTime, Optional model, - Optional> modelParameters, Optional input, - Optional version, Optional metadata, Optional output, - Optional usage, Optional level, Optional statusMessage, - Optional parentObservationId, Optional environment, - Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.type = type; - this.name = name; - this.startTime = startTime; - this.endTime = endTime; - this.completionStartTime = completionStartTime; - this.model = model; - this.modelParameters = modelParameters; - this.input = input; - this.version = version; - this.metadata = metadata; - this.output = output; - this.usage = usage; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - public Optional getId() { - return id; - } - - @JsonProperty("traceId") - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("type") - public ObservationType getType() { - return type; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("startTime") - public Optional getStartTime() { - return startTime; - } - - @JsonProperty("endTime") - public Optional getEndTime() { - return endTime; - } - - @JsonProperty("completionStartTime") - public Optional getCompletionStartTime() { - return completionStartTime; - } - - @JsonProperty("model") - public Optional getModel() { - return model; - } - - @JsonProperty("modelParameters") - public Optional> getModelParameters() { - return modelParameters; - } - - @JsonProperty("input") - public Optional getInput() { - return input; - } - - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("output") - public Optional getOutput() { - return output; - } - - @JsonProperty("usage") - public Optional getUsage() { - return usage; - } - - @JsonProperty("level") - public Optional getLevel() { - return level; - } - - @JsonProperty("statusMessage") - public Optional getStatusMessage() { - return statusMessage; - } - - @JsonProperty("parentObservationId") - public Optional getParentObservationId() { - return parentObservationId; - } - - @JsonProperty("environment") - public Optional getEnvironment() { - return environment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ObservationBody && equalTo((ObservationBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ObservationBody other) { - return id.equals(other.id) && traceId.equals(other.traceId) && type.equals(other.type) && name.equals(other.name) && startTime.equals(other.startTime) && endTime.equals(other.endTime) && completionStartTime.equals(other.completionStartTime) && model.equals(other.model) && modelParameters.equals(other.modelParameters) && input.equals(other.input) && version.equals(other.version) && metadata.equals(other.metadata) && output.equals(other.output) && usage.equals(other.usage) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.type, this.name, this.startTime, this.endTime, this.completionStartTime, this.model, this.modelParameters, this.input, this.version, this.metadata, this.output, this.usage, this.level, this.statusMessage, this.parentObservationId, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static TypeStage builder() { - return new Builder(); - } - - public interface TypeStage { - _FinalStage type(@NotNull ObservationType type); - - Builder from(ObservationBody other); - } - - public interface _FinalStage { - ObservationBody build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage id(Optional id); - - _FinalStage id(String id); - - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage startTime(Optional startTime); - - _FinalStage startTime(OffsetDateTime startTime); - - _FinalStage endTime(Optional endTime); - - _FinalStage endTime(OffsetDateTime endTime); - - _FinalStage completionStartTime(Optional completionStartTime); - - _FinalStage completionStartTime(OffsetDateTime completionStartTime); - - _FinalStage model(Optional model); - - _FinalStage model(String model); - - _FinalStage modelParameters(Optional> modelParameters); - - _FinalStage modelParameters(Map modelParameters); - - _FinalStage input(Optional input); - - _FinalStage input(Object input); - - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - _FinalStage output(Optional output); - - _FinalStage output(Object output); - - _FinalStage usage(Optional usage); - - _FinalStage usage(Usage usage); - - _FinalStage level(Optional level); - - _FinalStage level(ObservationLevel level); - - _FinalStage statusMessage(Optional statusMessage); - - _FinalStage statusMessage(String statusMessage); - - _FinalStage parentObservationId(Optional parentObservationId); - - _FinalStage parentObservationId(String parentObservationId); - - _FinalStage environment(Optional environment); - - _FinalStage environment(String environment); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements TypeStage, _FinalStage { - private ObservationType type; - - private Optional environment = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional usage = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional> modelParameters = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional completionStartTime = Optional.empty(); - - private Optional endTime = Optional.empty(); - - private Optional startTime = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional id = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(ObservationBody other) { - id(other.getId()); - traceId(other.getTraceId()); - type(other.getType()); - name(other.getName()); - startTime(other.getStartTime()); - endTime(other.getEndTime()); - completionStartTime(other.getCompletionStartTime()); - model(other.getModel()); - modelParameters(other.getModelParameters()); - input(other.getInput()); - version(other.getVersion()); - metadata(other.getMetadata()); - output(other.getOutput()); - usage(other.getUsage()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - environment(other.getEnvironment()); - return this; - } - - @java.lang.Override - @JsonSetter("type") - public _FinalStage type(@NotNull ObservationType type) { - this.type = Objects.requireNonNull(type, "type must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public _FinalStage environment(Optional environment) { - this.environment = environment; - return this; - } - - @java.lang.Override - public _FinalStage parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public _FinalStage parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - @java.lang.Override - public _FinalStage statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public _FinalStage statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - @java.lang.Override - public _FinalStage level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public _FinalStage level(Optional level) { - this.level = level; - return this; - } - - @java.lang.Override - public _FinalStage usage(Usage usage) { - this.usage = Optional.ofNullable(usage); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "usage", - nulls = Nulls.SKIP - ) - public _FinalStage usage(Optional usage) { - this.usage = usage; - return this; - } - - @java.lang.Override - public _FinalStage output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public _FinalStage output(Optional output) { - this.output = output; - return this; - } - - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public _FinalStage input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public _FinalStage input(Optional input) { - this.input = input; - return this; - } - - @java.lang.Override - public _FinalStage modelParameters(Map modelParameters) { - this.modelParameters = Optional.ofNullable(modelParameters); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "modelParameters", - nulls = Nulls.SKIP - ) - public _FinalStage modelParameters(Optional> modelParameters) { - this.modelParameters = modelParameters; - return this; - } - - @java.lang.Override - public _FinalStage model(String model) { - this.model = Optional.ofNullable(model); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "model", - nulls = Nulls.SKIP - ) - public _FinalStage model(Optional model) { - this.model = model; - return this; - } - - @java.lang.Override - public _FinalStage completionStartTime(OffsetDateTime completionStartTime) { - this.completionStartTime = Optional.ofNullable(completionStartTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "completionStartTime", - nulls = Nulls.SKIP - ) - public _FinalStage completionStartTime(Optional completionStartTime) { - this.completionStartTime = completionStartTime; - return this; - } - - @java.lang.Override - public _FinalStage endTime(OffsetDateTime endTime) { - this.endTime = Optional.ofNullable(endTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "endTime", - nulls = Nulls.SKIP - ) - public _FinalStage endTime(Optional endTime) { - this.endTime = endTime; - return this; - } - - @java.lang.Override - public _FinalStage startTime(OffsetDateTime startTime) { - this.startTime = Optional.ofNullable(startTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "startTime", - nulls = Nulls.SKIP - ) - public _FinalStage startTime(Optional startTime) { - this.startTime = startTime; - return this; - } - - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public _FinalStage id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "id", - nulls = Nulls.SKIP - ) - public _FinalStage id(Optional id) { - this.id = id; - return this; - } - - @java.lang.Override - public ObservationBody build() { - return new ObservationBody(id, traceId, type, name, startTime, endTime, completionStartTime, model, modelParameters, input, version, metadata, output, usage, level, statusMessage, parentObservationId, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/ObservationType.java b/src/main/java/com/langfuse/client/resources/ingestion/types/ObservationType.java deleted file mode 100644 index 4294989..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/ObservationType.java +++ /dev/null @@ -1,168 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonValue; -import java.lang.Object; -import java.lang.String; - -public final class ObservationType { - public static final ObservationType AGENT = new ObservationType(Value.AGENT, "AGENT"); - - public static final ObservationType TOOL = new ObservationType(Value.TOOL, "TOOL"); - - public static final ObservationType CHAIN = new ObservationType(Value.CHAIN, "CHAIN"); - - public static final ObservationType EVALUATOR = new ObservationType(Value.EVALUATOR, "EVALUATOR"); - - public static final ObservationType SPAN = new ObservationType(Value.SPAN, "SPAN"); - - public static final ObservationType GENERATION = new ObservationType(Value.GENERATION, "GENERATION"); - - public static final ObservationType GUARDRAIL = new ObservationType(Value.GUARDRAIL, "GUARDRAIL"); - - public static final ObservationType EVENT = new ObservationType(Value.EVENT, "EVENT"); - - public static final ObservationType EMBEDDING = new ObservationType(Value.EMBEDDING, "EMBEDDING"); - - public static final ObservationType RETRIEVER = new ObservationType(Value.RETRIEVER, "RETRIEVER"); - - private final Value value; - - private final String string; - - ObservationType(Value value, String string) { - this.value = value; - this.string = string; - } - - public Value getEnumValue() { - return value; - } - - @java.lang.Override - @JsonValue - public String toString() { - return this.string; - } - - @java.lang.Override - public boolean equals(Object other) { - return (this == other) - || (other instanceof ObservationType && this.string.equals(((ObservationType) other).string)); - } - - @java.lang.Override - public int hashCode() { - return this.string.hashCode(); - } - - public T visit(Visitor visitor) { - switch (value) { - case AGENT: - return visitor.visitAgent(); - case TOOL: - return visitor.visitTool(); - case CHAIN: - return visitor.visitChain(); - case EVALUATOR: - return visitor.visitEvaluator(); - case SPAN: - return visitor.visitSpan(); - case GENERATION: - return visitor.visitGeneration(); - case GUARDRAIL: - return visitor.visitGuardrail(); - case EVENT: - return visitor.visitEvent(); - case EMBEDDING: - return visitor.visitEmbedding(); - case RETRIEVER: - return visitor.visitRetriever(); - case UNKNOWN: - default: - return visitor.visitUnknown(string); - } - } - - @JsonCreator( - mode = JsonCreator.Mode.DELEGATING - ) - public static ObservationType valueOf(String value) { - switch (value) { - case "AGENT": - return AGENT; - case "TOOL": - return TOOL; - case "CHAIN": - return CHAIN; - case "EVALUATOR": - return EVALUATOR; - case "SPAN": - return SPAN; - case "GENERATION": - return GENERATION; - case "GUARDRAIL": - return GUARDRAIL; - case "EVENT": - return EVENT; - case "EMBEDDING": - return EMBEDDING; - case "RETRIEVER": - return RETRIEVER; - default: - return new ObservationType(Value.UNKNOWN, value); - } - } - - public enum Value { - SPAN, - - GENERATION, - - EVENT, - - AGENT, - - TOOL, - - CHAIN, - - RETRIEVER, - - EVALUATOR, - - EMBEDDING, - - GUARDRAIL, - - UNKNOWN - } - - public interface Visitor { - T visitSpan(); - - T visitGeneration(); - - T visitEvent(); - - T visitAgent(); - - T visitTool(); - - T visitChain(); - - T visitRetriever(); - - T visitEvaluator(); - - T visitEmbedding(); - - T visitGuardrail(); - - T visitUnknown(String unknownType); - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiCompletionUsageSchema.java b/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiCompletionUsageSchema.java deleted file mode 100644 index faf875d..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiCompletionUsageSchema.java +++ /dev/null @@ -1,241 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = OpenAiCompletionUsageSchema.Builder.class -) -public final class OpenAiCompletionUsageSchema { - private final int promptTokens; - - private final int completionTokens; - - private final int totalTokens; - - private final Optional>> promptTokensDetails; - - private final Optional>> completionTokensDetails; - - private final Map additionalProperties; - - private OpenAiCompletionUsageSchema(int promptTokens, int completionTokens, int totalTokens, - Optional>> promptTokensDetails, - Optional>> completionTokensDetails, - Map additionalProperties) { - this.promptTokens = promptTokens; - this.completionTokens = completionTokens; - this.totalTokens = totalTokens; - this.promptTokensDetails = promptTokensDetails; - this.completionTokensDetails = completionTokensDetails; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("prompt_tokens") - public int getPromptTokens() { - return promptTokens; - } - - @JsonProperty("completion_tokens") - public int getCompletionTokens() { - return completionTokens; - } - - @JsonProperty("total_tokens") - public int getTotalTokens() { - return totalTokens; - } - - @JsonProperty("prompt_tokens_details") - public Optional>> getPromptTokensDetails() { - return promptTokensDetails; - } - - @JsonProperty("completion_tokens_details") - public Optional>> getCompletionTokensDetails() { - return completionTokensDetails; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenAiCompletionUsageSchema && equalTo((OpenAiCompletionUsageSchema) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OpenAiCompletionUsageSchema other) { - return promptTokens == other.promptTokens && completionTokens == other.completionTokens && totalTokens == other.totalTokens && promptTokensDetails.equals(other.promptTokensDetails) && completionTokensDetails.equals(other.completionTokensDetails); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.promptTokens, this.completionTokens, this.totalTokens, this.promptTokensDetails, this.completionTokensDetails); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static PromptTokensStage builder() { - return new Builder(); - } - - public interface PromptTokensStage { - CompletionTokensStage promptTokens(int promptTokens); - - Builder from(OpenAiCompletionUsageSchema other); - } - - public interface CompletionTokensStage { - TotalTokensStage completionTokens(int completionTokens); - } - - public interface TotalTokensStage { - _FinalStage totalTokens(int totalTokens); - } - - public interface _FinalStage { - OpenAiCompletionUsageSchema build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage promptTokensDetails(Optional>> promptTokensDetails); - - _FinalStage promptTokensDetails(Map> promptTokensDetails); - - _FinalStage completionTokensDetails( - Optional>> completionTokensDetails); - - _FinalStage completionTokensDetails(Map> completionTokensDetails); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements PromptTokensStage, CompletionTokensStage, TotalTokensStage, _FinalStage { - private int promptTokens; - - private int completionTokens; - - private int totalTokens; - - private Optional>> completionTokensDetails = Optional.empty(); - - private Optional>> promptTokensDetails = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(OpenAiCompletionUsageSchema other) { - promptTokens(other.getPromptTokens()); - completionTokens(other.getCompletionTokens()); - totalTokens(other.getTotalTokens()); - promptTokensDetails(other.getPromptTokensDetails()); - completionTokensDetails(other.getCompletionTokensDetails()); - return this; - } - - @java.lang.Override - @JsonSetter("prompt_tokens") - public CompletionTokensStage promptTokens(int promptTokens) { - this.promptTokens = promptTokens; - return this; - } - - @java.lang.Override - @JsonSetter("completion_tokens") - public TotalTokensStage completionTokens(int completionTokens) { - this.completionTokens = completionTokens; - return this; - } - - @java.lang.Override - @JsonSetter("total_tokens") - public _FinalStage totalTokens(int totalTokens) { - this.totalTokens = totalTokens; - return this; - } - - @java.lang.Override - public _FinalStage completionTokensDetails( - Map> completionTokensDetails) { - this.completionTokensDetails = Optional.ofNullable(completionTokensDetails); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "completion_tokens_details", - nulls = Nulls.SKIP - ) - public _FinalStage completionTokensDetails( - Optional>> completionTokensDetails) { - this.completionTokensDetails = completionTokensDetails; - return this; - } - - @java.lang.Override - public _FinalStage promptTokensDetails(Map> promptTokensDetails) { - this.promptTokensDetails = Optional.ofNullable(promptTokensDetails); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "prompt_tokens_details", - nulls = Nulls.SKIP - ) - public _FinalStage promptTokensDetails( - Optional>> promptTokensDetails) { - this.promptTokensDetails = promptTokensDetails; - return this; - } - - @java.lang.Override - public OpenAiCompletionUsageSchema build() { - return new OpenAiCompletionUsageSchema(promptTokens, completionTokens, totalTokens, promptTokensDetails, completionTokensDetails, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiResponseUsageSchema.java b/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiResponseUsageSchema.java deleted file mode 100644 index 0c4c774..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiResponseUsageSchema.java +++ /dev/null @@ -1,239 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = OpenAiResponseUsageSchema.Builder.class -) -public final class OpenAiResponseUsageSchema { - private final int inputTokens; - - private final int outputTokens; - - private final int totalTokens; - - private final Optional>> inputTokensDetails; - - private final Optional>> outputTokensDetails; - - private final Map additionalProperties; - - private OpenAiResponseUsageSchema(int inputTokens, int outputTokens, int totalTokens, - Optional>> inputTokensDetails, - Optional>> outputTokensDetails, - Map additionalProperties) { - this.inputTokens = inputTokens; - this.outputTokens = outputTokens; - this.totalTokens = totalTokens; - this.inputTokensDetails = inputTokensDetails; - this.outputTokensDetails = outputTokensDetails; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("input_tokens") - public int getInputTokens() { - return inputTokens; - } - - @JsonProperty("output_tokens") - public int getOutputTokens() { - return outputTokens; - } - - @JsonProperty("total_tokens") - public int getTotalTokens() { - return totalTokens; - } - - @JsonProperty("input_tokens_details") - public Optional>> getInputTokensDetails() { - return inputTokensDetails; - } - - @JsonProperty("output_tokens_details") - public Optional>> getOutputTokensDetails() { - return outputTokensDetails; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenAiResponseUsageSchema && equalTo((OpenAiResponseUsageSchema) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OpenAiResponseUsageSchema other) { - return inputTokens == other.inputTokens && outputTokens == other.outputTokens && totalTokens == other.totalTokens && inputTokensDetails.equals(other.inputTokensDetails) && outputTokensDetails.equals(other.outputTokensDetails); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.inputTokens, this.outputTokens, this.totalTokens, this.inputTokensDetails, this.outputTokensDetails); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static InputTokensStage builder() { - return new Builder(); - } - - public interface InputTokensStage { - OutputTokensStage inputTokens(int inputTokens); - - Builder from(OpenAiResponseUsageSchema other); - } - - public interface OutputTokensStage { - TotalTokensStage outputTokens(int outputTokens); - } - - public interface TotalTokensStage { - _FinalStage totalTokens(int totalTokens); - } - - public interface _FinalStage { - OpenAiResponseUsageSchema build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage inputTokensDetails(Optional>> inputTokensDetails); - - _FinalStage inputTokensDetails(Map> inputTokensDetails); - - _FinalStage outputTokensDetails(Optional>> outputTokensDetails); - - _FinalStage outputTokensDetails(Map> outputTokensDetails); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements InputTokensStage, OutputTokensStage, TotalTokensStage, _FinalStage { - private int inputTokens; - - private int outputTokens; - - private int totalTokens; - - private Optional>> outputTokensDetails = Optional.empty(); - - private Optional>> inputTokensDetails = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(OpenAiResponseUsageSchema other) { - inputTokens(other.getInputTokens()); - outputTokens(other.getOutputTokens()); - totalTokens(other.getTotalTokens()); - inputTokensDetails(other.getInputTokensDetails()); - outputTokensDetails(other.getOutputTokensDetails()); - return this; - } - - @java.lang.Override - @JsonSetter("input_tokens") - public OutputTokensStage inputTokens(int inputTokens) { - this.inputTokens = inputTokens; - return this; - } - - @java.lang.Override - @JsonSetter("output_tokens") - public TotalTokensStage outputTokens(int outputTokens) { - this.outputTokens = outputTokens; - return this; - } - - @java.lang.Override - @JsonSetter("total_tokens") - public _FinalStage totalTokens(int totalTokens) { - this.totalTokens = totalTokens; - return this; - } - - @java.lang.Override - public _FinalStage outputTokensDetails(Map> outputTokensDetails) { - this.outputTokensDetails = Optional.ofNullable(outputTokensDetails); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "output_tokens_details", - nulls = Nulls.SKIP - ) - public _FinalStage outputTokensDetails( - Optional>> outputTokensDetails) { - this.outputTokensDetails = outputTokensDetails; - return this; - } - - @java.lang.Override - public _FinalStage inputTokensDetails(Map> inputTokensDetails) { - this.inputTokensDetails = Optional.ofNullable(inputTokensDetails); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "input_tokens_details", - nulls = Nulls.SKIP - ) - public _FinalStage inputTokensDetails( - Optional>> inputTokensDetails) { - this.inputTokensDetails = inputTokensDetails; - return this; - } - - @java.lang.Override - public OpenAiResponseUsageSchema build() { - return new OpenAiResponseUsageSchema(inputTokens, outputTokens, totalTokens, inputTokensDetails, outputTokensDetails, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiUsage.java b/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiUsage.java deleted file mode 100644 index 9610d68..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/OpenAiUsage.java +++ /dev/null @@ -1,168 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = OpenAiUsage.Builder.class -) -public final class OpenAiUsage { - private final Optional promptTokens; - - private final Optional completionTokens; - - private final Optional totalTokens; - - private final Map additionalProperties; - - private OpenAiUsage(Optional promptTokens, Optional completionTokens, - Optional totalTokens, Map additionalProperties) { - this.promptTokens = promptTokens; - this.completionTokens = completionTokens; - this.totalTokens = totalTokens; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("promptTokens") - public Optional getPromptTokens() { - return promptTokens; - } - - @JsonProperty("completionTokens") - public Optional getCompletionTokens() { - return completionTokens; - } - - @JsonProperty("totalTokens") - public Optional getTotalTokens() { - return totalTokens; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OpenAiUsage && equalTo((OpenAiUsage) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OpenAiUsage other) { - return promptTokens.equals(other.promptTokens) && completionTokens.equals(other.completionTokens) && totalTokens.equals(other.totalTokens); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.promptTokens, this.completionTokens, this.totalTokens); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional promptTokens = Optional.empty(); - - private Optional completionTokens = Optional.empty(); - - private Optional totalTokens = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(OpenAiUsage other) { - promptTokens(other.getPromptTokens()); - completionTokens(other.getCompletionTokens()); - totalTokens(other.getTotalTokens()); - return this; - } - - @JsonSetter( - value = "promptTokens", - nulls = Nulls.SKIP - ) - public Builder promptTokens(Optional promptTokens) { - this.promptTokens = promptTokens; - return this; - } - - public Builder promptTokens(Integer promptTokens) { - this.promptTokens = Optional.ofNullable(promptTokens); - return this; - } - - @JsonSetter( - value = "completionTokens", - nulls = Nulls.SKIP - ) - public Builder completionTokens(Optional completionTokens) { - this.completionTokens = completionTokens; - return this; - } - - public Builder completionTokens(Integer completionTokens) { - this.completionTokens = Optional.ofNullable(completionTokens); - return this; - } - - @JsonSetter( - value = "totalTokens", - nulls = Nulls.SKIP - ) - public Builder totalTokens(Optional totalTokens) { - this.totalTokens = totalTokens; - return this; - } - - public Builder totalTokens(Integer totalTokens) { - this.totalTokens = Optional.ofNullable(totalTokens); - return this; - } - - public OpenAiUsage build() { - return new OpenAiUsage(promptTokens, completionTokens, totalTokens, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/OptionalObservationBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/OptionalObservationBody.java deleted file mode 100644 index 595b5fd..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/OptionalObservationBody.java +++ /dev/null @@ -1,383 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = OptionalObservationBody.Builder.class -) -public final class OptionalObservationBody implements IOptionalObservationBody { - private final Optional traceId; - - private final Optional name; - - private final Optional startTime; - - private final Optional metadata; - - private final Optional input; - - private final Optional output; - - private final Optional level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional version; - - private final Optional environment; - - private final Map additionalProperties; - - private OptionalObservationBody(Optional traceId, Optional name, - Optional startTime, Optional metadata, Optional input, - Optional output, Optional level, Optional statusMessage, - Optional parentObservationId, Optional version, Optional environment, - Map additionalProperties) { - this.traceId = traceId; - this.name = name; - this.startTime = startTime; - this.metadata = metadata; - this.input = input; - this.output = output; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.version = version; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("traceId") - @java.lang.Override - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public Optional getName() { - return name; - } - - @JsonProperty("startTime") - @java.lang.Override - public Optional getStartTime() { - return startTime; - } - - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - @JsonProperty("level") - @java.lang.Override - public Optional getLevel() { - return level; - } - - @JsonProperty("statusMessage") - @java.lang.Override - public Optional getStatusMessage() { - return statusMessage; - } - - @JsonProperty("parentObservationId") - @java.lang.Override - public Optional getParentObservationId() { - return parentObservationId; - } - - @JsonProperty("version") - @java.lang.Override - public Optional getVersion() { - return version; - } - - @JsonProperty("environment") - @java.lang.Override - public Optional getEnvironment() { - return environment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof OptionalObservationBody && equalTo((OptionalObservationBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(OptionalObservationBody other) { - return traceId.equals(other.traceId) && name.equals(other.name) && startTime.equals(other.startTime) && metadata.equals(other.metadata) && input.equals(other.input) && output.equals(other.output) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && version.equals(other.version) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.traceId, this.name, this.startTime, this.metadata, this.input, this.output, this.level, this.statusMessage, this.parentObservationId, this.version, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional traceId = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional startTime = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional environment = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(OptionalObservationBody other) { - traceId(other.getTraceId()); - name(other.getName()); - startTime(other.getStartTime()); - metadata(other.getMetadata()); - input(other.getInput()); - output(other.getOutput()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - version(other.getVersion()); - environment(other.getEnvironment()); - return this; - } - - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public Builder traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - public Builder traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter( - value = "startTime", - nulls = Nulls.SKIP - ) - public Builder startTime(Optional startTime) { - this.startTime = startTime; - return this; - } - - public Builder startTime(OffsetDateTime startTime) { - this.startTime = Optional.ofNullable(startTime); - return this; - } - - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public Builder input(Optional input) { - this.input = input; - return this; - } - - public Builder input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public Builder output(Optional output) { - this.output = output; - return this; - } - - public Builder output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public Builder level(Optional level) { - this.level = level; - return this; - } - - public Builder level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public Builder statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - public Builder statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public Builder parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - public Builder parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional environment) { - this.environment = environment; - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - public OptionalObservationBody build() { - return new OptionalObservationBody(traceId, name, startTime, metadata, input, output, level, statusMessage, parentObservationId, version, environment, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/ScoreBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/ScoreBody.java deleted file mode 100644 index e5df9aa..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/ScoreBody.java +++ /dev/null @@ -1,558 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.CreateScoreValue; -import com.langfuse.client.resources.commons.types.ScoreDataType; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = ScoreBody.Builder.class -) -public final class ScoreBody { - private final Optional id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final Optional environment; - - private final Optional queueId; - - private final CreateScoreValue value; - - private final Optional comment; - - private final Optional metadata; - - private final Optional dataType; - - private final Optional configId; - - private final Map additionalProperties; - - private ScoreBody(Optional id, Optional traceId, Optional sessionId, - Optional observationId, Optional datasetRunId, String name, - Optional environment, Optional queueId, CreateScoreValue value, - Optional comment, Optional metadata, Optional dataType, - Optional configId, Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.environment = environment; - this.queueId = queueId; - this.value = value; - this.comment = comment; - this.metadata = metadata; - this.dataType = dataType; - this.configId = configId; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - public Optional getId() { - return id; - } - - @JsonProperty("traceId") - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("sessionId") - public Optional getSessionId() { - return sessionId; - } - - @JsonProperty("observationId") - public Optional getObservationId() { - return observationId; - } - - @JsonProperty("datasetRunId") - public Optional getDatasetRunId() { - return datasetRunId; - } - - /** - * @return The name of the score. Always overrides "output" for correction scores. - */ - @JsonProperty("name") - public String getName() { - return name; - } - - @JsonProperty("environment") - public Optional getEnvironment() { - return environment; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonProperty("queueId") - public Optional getQueueId() { - return queueId; - } - - /** - * @return The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false) - */ - @JsonProperty("value") - public CreateScoreValue getValue() { - return value; - } - - @JsonProperty("comment") - public Optional getComment() { - return comment; - } - - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - /** - * @return When set, must match the score value's type. If not set, will be inferred from the score value or config - */ - @JsonProperty("dataType") - public Optional getDataType() { - return dataType; - } - - /** - * @return Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values - */ - @JsonProperty("configId") - public Optional getConfigId() { - return configId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScoreBody && equalTo((ScoreBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ScoreBody other) { - return id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && environment.equals(other.environment) && queueId.equals(other.queueId) && value.equals(other.value) && comment.equals(other.comment) && metadata.equals(other.metadata) && dataType.equals(other.dataType) && configId.equals(other.configId); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.environment, this.queueId, this.value, this.comment, this.metadata, this.dataType, this.configId); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static NameStage builder() { - return new Builder(); - } - - public interface NameStage { - /** - *

The name of the score. Always overrides "output" for correction scores.

- */ - ValueStage name(@NotNull String name); - - Builder from(ScoreBody other); - } - - public interface ValueStage { - /** - *

The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false)

- */ - _FinalStage value(@NotNull CreateScoreValue value); - } - - public interface _FinalStage { - ScoreBody build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage id(Optional id); - - _FinalStage id(String id); - - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage environment(Optional environment); - - _FinalStage environment(String environment); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - /** - *

When set, must match the score value's type. If not set, will be inferred from the score value or config

- */ - _FinalStage dataType(Optional dataType); - - _FinalStage dataType(ScoreDataType dataType); - - /** - *

Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements NameStage, ValueStage, _FinalStage { - private String name; - - private CreateScoreValue value; - - private Optional configId = Optional.empty(); - - private Optional dataType = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional queueId = Optional.empty(); - - private Optional environment = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional id = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(ScoreBody other) { - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - environment(other.getEnvironment()); - queueId(other.getQueueId()); - value(other.getValue()); - comment(other.getComment()); - metadata(other.getMetadata()); - dataType(other.getDataType()); - configId(other.getConfigId()); - return this; - } - - /** - *

The name of the score. Always overrides "output" for correction scores.

- *

The name of the score. Always overrides "output" for correction scores.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("name") - public ValueStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - /** - *

The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false)

- *

The value of the score. Must be passed as string for categorical scores, and numeric for boolean and numeric scores. Boolean score values must equal either 1 or 0 (true or false)

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public _FinalStage value(@NotNull CreateScoreValue value) { - this.value = Objects.requireNonNull(value, "value must not be null"); - return this; - } - - /** - *

Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, the score name must equal the config name and scores must comply with the config's range and data type. For categorical scores, the value must map to a config category. Numeric scores might be constrained by the score config's max and min values

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

When set, must match the score value's type. If not set, will be inferred from the score value or config

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage dataType(ScoreDataType dataType) { - this.dataType = Optional.ofNullable(dataType); - return this; - } - - /** - *

When set, must match the score value's type. If not set, will be inferred from the score value or config

- */ - @java.lang.Override - @JsonSetter( - value = "dataType", - nulls = Nulls.SKIP - ) - public _FinalStage dataType(Optional dataType) { - this.dataType = dataType; - return this; - } - - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - @java.lang.Override - public _FinalStage environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public _FinalStage environment(Optional environment) { - this.environment = environment; - return this; - } - - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public _FinalStage id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "id", - nulls = Nulls.SKIP - ) - public _FinalStage id(Optional id) { - this.id = id; - return this; - } - - @java.lang.Override - public ScoreBody build() { - return new ScoreBody(id, traceId, sessionId, observationId, datasetRunId, name, environment, queueId, value, comment, metadata, dataType, configId, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/ScoreEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/ScoreEvent.java deleted file mode 100644 index 9ebbfe5..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/ScoreEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = ScoreEvent.Builder.class -) -public final class ScoreEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final ScoreBody body; - - private final Map additionalProperties; - - private ScoreEvent(String id, String timestamp, Optional metadata, ScoreBody body, - Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public ScoreBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ScoreEvent && equalTo((ScoreEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ScoreEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(ScoreEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull ScoreBody body); - } - - public interface _FinalStage { - ScoreEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private ScoreBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(ScoreEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull ScoreBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public ScoreEvent build() { - return new ScoreEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/SdkLogBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/SdkLogBody.java deleted file mode 100644 index ec20420..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/SdkLogBody.java +++ /dev/null @@ -1,125 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = SdkLogBody.Builder.class -) -public final class SdkLogBody { - private final Object log; - - private final Map additionalProperties; - - private SdkLogBody(Object log, Map additionalProperties) { - this.log = log; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("log") - public Object getLog() { - return log; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SdkLogBody && equalTo((SdkLogBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SdkLogBody other) { - return log.equals(other.log); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.log); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static LogStage builder() { - return new Builder(); - } - - public interface LogStage { - _FinalStage log(Object log); - - Builder from(SdkLogBody other); - } - - public interface _FinalStage { - SdkLogBody build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements LogStage, _FinalStage { - private Object log; - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(SdkLogBody other) { - log(other.getLog()); - return this; - } - - @java.lang.Override - @JsonSetter("log") - public _FinalStage log(Object log) { - this.log = log; - return this; - } - - @java.lang.Override - public SdkLogBody build() { - return new SdkLogBody(log, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/SdkLogEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/SdkLogEvent.java deleted file mode 100644 index 8e97046..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/SdkLogEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = SdkLogEvent.Builder.class -) -public final class SdkLogEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final SdkLogBody body; - - private final Map additionalProperties; - - private SdkLogEvent(String id, String timestamp, Optional metadata, SdkLogBody body, - Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public SdkLogBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof SdkLogEvent && equalTo((SdkLogEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(SdkLogEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(SdkLogEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull SdkLogBody body); - } - - public interface _FinalStage { - SdkLogEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private SdkLogBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(SdkLogEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull SdkLogBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public SdkLogEvent build() { - return new SdkLogEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/TraceBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/TraceBody.java deleted file mode 100644 index c4d1edb..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/TraceBody.java +++ /dev/null @@ -1,429 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Boolean; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = TraceBody.Builder.class -) -public final class TraceBody { - private final Optional id; - - private final Optional timestamp; - - private final Optional name; - - private final Optional userId; - - private final Optional input; - - private final Optional output; - - private final Optional sessionId; - - private final Optional release; - - private final Optional version; - - private final Optional metadata; - - private final Optional> tags; - - private final Optional environment; - - private final Optional public_; - - private final Map additionalProperties; - - private TraceBody(Optional id, Optional timestamp, Optional name, - Optional userId, Optional input, Optional output, - Optional sessionId, Optional release, Optional version, - Optional metadata, Optional> tags, Optional environment, - Optional public_, Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.name = name; - this.userId = userId; - this.input = input; - this.output = output; - this.sessionId = sessionId; - this.release = release; - this.version = version; - this.metadata = metadata; - this.tags = tags; - this.environment = environment; - this.public_ = public_; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - public Optional getId() { - return id; - } - - @JsonProperty("timestamp") - public Optional getTimestamp() { - return timestamp; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("userId") - public Optional getUserId() { - return userId; - } - - @JsonProperty("input") - public Optional getInput() { - return input; - } - - @JsonProperty("output") - public Optional getOutput() { - return output; - } - - @JsonProperty("sessionId") - public Optional getSessionId() { - return sessionId; - } - - @JsonProperty("release") - public Optional getRelease() { - return release; - } - - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - @JsonProperty("metadata") - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - @JsonProperty("environment") - public Optional getEnvironment() { - return environment; - } - - /** - * @return Make trace publicly accessible via url - */ - @JsonProperty("public") - public Optional getPublic() { - return public_; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TraceBody && equalTo((TraceBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(TraceBody other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && name.equals(other.name) && userId.equals(other.userId) && input.equals(other.input) && output.equals(other.output) && sessionId.equals(other.sessionId) && release.equals(other.release) && version.equals(other.version) && metadata.equals(other.metadata) && tags.equals(other.tags) && environment.equals(other.environment) && public_.equals(other.public_); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.name, this.userId, this.input, this.output, this.sessionId, this.release, this.version, this.metadata, this.tags, this.environment, this.public_); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional id = Optional.empty(); - - private Optional timestamp = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional userId = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional release = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional environment = Optional.empty(); - - private Optional public_ = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(TraceBody other) { - id(other.getId()); - timestamp(other.getTimestamp()); - name(other.getName()); - userId(other.getUserId()); - input(other.getInput()); - output(other.getOutput()); - sessionId(other.getSessionId()); - release(other.getRelease()); - version(other.getVersion()); - metadata(other.getMetadata()); - tags(other.getTags()); - environment(other.getEnvironment()); - public_(other.getPublic()); - return this; - } - - @JsonSetter( - value = "id", - nulls = Nulls.SKIP - ) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - @JsonSetter( - value = "timestamp", - nulls = Nulls.SKIP - ) - public Builder timestamp(Optional timestamp) { - this.timestamp = timestamp; - return this; - } - - public Builder timestamp(OffsetDateTime timestamp) { - this.timestamp = Optional.ofNullable(timestamp); - return this; - } - - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter( - value = "userId", - nulls = Nulls.SKIP - ) - public Builder userId(Optional userId) { - this.userId = userId; - return this; - } - - public Builder userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public Builder input(Optional input) { - this.input = input; - return this; - } - - public Builder input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public Builder output(Optional output) { - this.output = output; - return this; - } - - public Builder output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public Builder sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - public Builder sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - @JsonSetter( - value = "release", - nulls = Nulls.SKIP - ) - public Builder release(Optional release) { - this.release = release; - return this; - } - - public Builder release(String release) { - this.release = Optional.ofNullable(release); - return this; - } - - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public Builder metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - public Builder metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @JsonSetter( - value = "tags", - nulls = Nulls.SKIP - ) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional environment) { - this.environment = environment; - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - /** - *

Make trace publicly accessible via url

- */ - @JsonSetter( - value = "public", - nulls = Nulls.SKIP - ) - public Builder public_(Optional public_) { - this.public_ = public_; - return this; - } - - public Builder public_(Boolean public_) { - this.public_ = Optional.ofNullable(public_); - return this; - } - - public TraceBody build() { - return new TraceBody(id, timestamp, name, userId, input, output, sessionId, release, version, metadata, tags, environment, public_, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/TraceEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/TraceEvent.java deleted file mode 100644 index 7afe632..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/TraceEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = TraceEvent.Builder.class -) -public final class TraceEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final TraceBody body; - - private final Map additionalProperties; - - private TraceEvent(String id, String timestamp, Optional metadata, TraceBody body, - Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public TraceBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof TraceEvent && equalTo((TraceEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(TraceEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(TraceEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull TraceBody body); - } - - public interface _FinalStage { - TraceEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private TraceBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(TraceEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull TraceBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public TraceEvent build() { - return new TraceEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateEventBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateEventBody.java deleted file mode 100644 index 609cf41..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateEventBody.java +++ /dev/null @@ -1,487 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = UpdateEventBody.Builder.class -) -public final class UpdateEventBody implements IUpdateEventBody, IOptionalObservationBody { - private final String id; - - private final Optional traceId; - - private final Optional name; - - private final Optional startTime; - - private final Optional metadata; - - private final Optional input; - - private final Optional output; - - private final Optional level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional version; - - private final Optional environment; - - private final Map additionalProperties; - - private UpdateEventBody(String id, Optional traceId, Optional name, - Optional startTime, Optional metadata, Optional input, - Optional output, Optional level, Optional statusMessage, - Optional parentObservationId, Optional version, Optional environment, - Map additionalProperties) { - this.id = id; - this.traceId = traceId; - this.name = name; - this.startTime = startTime; - this.metadata = metadata; - this.input = input; - this.output = output; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.version = version; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public Optional getName() { - return name; - } - - @JsonProperty("startTime") - @java.lang.Override - public Optional getStartTime() { - return startTime; - } - - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - @JsonProperty("level") - @java.lang.Override - public Optional getLevel() { - return level; - } - - @JsonProperty("statusMessage") - @java.lang.Override - public Optional getStatusMessage() { - return statusMessage; - } - - @JsonProperty("parentObservationId") - @java.lang.Override - public Optional getParentObservationId() { - return parentObservationId; - } - - @JsonProperty("version") - @java.lang.Override - public Optional getVersion() { - return version; - } - - @JsonProperty("environment") - @java.lang.Override - public Optional getEnvironment() { - return environment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateEventBody && equalTo((UpdateEventBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateEventBody other) { - return id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && startTime.equals(other.startTime) && metadata.equals(other.metadata) && input.equals(other.input) && output.equals(other.output) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && version.equals(other.version) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.traceId, this.name, this.startTime, this.metadata, this.input, this.output, this.level, this.statusMessage, this.parentObservationId, this.version, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - _FinalStage id(@NotNull String id); - - Builder from(UpdateEventBody other); - } - - public interface _FinalStage { - UpdateEventBody build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage startTime(Optional startTime); - - _FinalStage startTime(OffsetDateTime startTime); - - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - _FinalStage input(Optional input); - - _FinalStage input(Object input); - - _FinalStage output(Optional output); - - _FinalStage output(Object output); - - _FinalStage level(Optional level); - - _FinalStage level(ObservationLevel level); - - _FinalStage statusMessage(Optional statusMessage); - - _FinalStage statusMessage(String statusMessage); - - _FinalStage parentObservationId(Optional parentObservationId); - - _FinalStage parentObservationId(String parentObservationId); - - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage environment(Optional environment); - - _FinalStage environment(String environment); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, _FinalStage { - private String id; - - private Optional environment = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional startTime = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(UpdateEventBody other) { - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - startTime(other.getStartTime()); - metadata(other.getMetadata()); - input(other.getInput()); - output(other.getOutput()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - version(other.getVersion()); - environment(other.getEnvironment()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public _FinalStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public _FinalStage environment(Optional environment) { - this.environment = environment; - return this; - } - - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public _FinalStage parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public _FinalStage parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - @java.lang.Override - public _FinalStage statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public _FinalStage statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - @java.lang.Override - public _FinalStage level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public _FinalStage level(Optional level) { - this.level = level; - return this; - } - - @java.lang.Override - public _FinalStage output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public _FinalStage output(Optional output) { - this.output = output; - return this; - } - - @java.lang.Override - public _FinalStage input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public _FinalStage input(Optional input) { - this.input = input; - return this; - } - - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public _FinalStage startTime(OffsetDateTime startTime) { - this.startTime = Optional.ofNullable(startTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "startTime", - nulls = Nulls.SKIP - ) - public _FinalStage startTime(Optional startTime) { - this.startTime = startTime; - return this; - } - - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public UpdateEventBody build() { - return new UpdateEventBody(id, traceId, name, startTime, metadata, input, output, level, statusMessage, parentObservationId, version, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateGenerationBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateGenerationBody.java deleted file mode 100644 index afbffd4..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateGenerationBody.java +++ /dev/null @@ -1,775 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Double; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.MapValue; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = UpdateGenerationBody.Builder.class -) -public final class UpdateGenerationBody implements IUpdateSpanBody, IUpdateEventBody, IOptionalObservationBody { - private final Optional endTime; - - private final String id; - - private final Optional traceId; - - private final Optional name; - - private final Optional startTime; - - private final Optional metadata; - - private final Optional input; - - private final Optional output; - - private final Optional level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional version; - - private final Optional environment; - - private final Optional completionStartTime; - - private final Optional model; - - private final Optional> modelParameters; - - private final Optional usage; - - private final Optional promptName; - - private final Optional usageDetails; - - private final Optional> costDetails; - - private final Optional promptVersion; - - private final Map additionalProperties; - - private UpdateGenerationBody(Optional endTime, String id, - Optional traceId, Optional name, Optional startTime, - Optional metadata, Optional input, Optional output, - Optional level, Optional statusMessage, - Optional parentObservationId, Optional version, Optional environment, - Optional completionStartTime, Optional model, - Optional> modelParameters, Optional usage, - Optional promptName, Optional usageDetails, - Optional> costDetails, Optional promptVersion, - Map additionalProperties) { - this.endTime = endTime; - this.id = id; - this.traceId = traceId; - this.name = name; - this.startTime = startTime; - this.metadata = metadata; - this.input = input; - this.output = output; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.version = version; - this.environment = environment; - this.completionStartTime = completionStartTime; - this.model = model; - this.modelParameters = modelParameters; - this.usage = usage; - this.promptName = promptName; - this.usageDetails = usageDetails; - this.costDetails = costDetails; - this.promptVersion = promptVersion; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("endTime") - @java.lang.Override - public Optional getEndTime() { - return endTime; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public Optional getName() { - return name; - } - - @JsonProperty("startTime") - @java.lang.Override - public Optional getStartTime() { - return startTime; - } - - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - @JsonProperty("level") - @java.lang.Override - public Optional getLevel() { - return level; - } - - @JsonProperty("statusMessage") - @java.lang.Override - public Optional getStatusMessage() { - return statusMessage; - } - - @JsonProperty("parentObservationId") - @java.lang.Override - public Optional getParentObservationId() { - return parentObservationId; - } - - @JsonProperty("version") - @java.lang.Override - public Optional getVersion() { - return version; - } - - @JsonProperty("environment") - @java.lang.Override - public Optional getEnvironment() { - return environment; - } - - @JsonProperty("completionStartTime") - public Optional getCompletionStartTime() { - return completionStartTime; - } - - @JsonProperty("model") - public Optional getModel() { - return model; - } - - @JsonProperty("modelParameters") - public Optional> getModelParameters() { - return modelParameters; - } - - @JsonProperty("usage") - public Optional getUsage() { - return usage; - } - - @JsonProperty("promptName") - public Optional getPromptName() { - return promptName; - } - - @JsonProperty("usageDetails") - public Optional getUsageDetails() { - return usageDetails; - } - - @JsonProperty("costDetails") - public Optional> getCostDetails() { - return costDetails; - } - - @JsonProperty("promptVersion") - public Optional getPromptVersion() { - return promptVersion; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateGenerationBody && equalTo((UpdateGenerationBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateGenerationBody other) { - return endTime.equals(other.endTime) && id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && startTime.equals(other.startTime) && metadata.equals(other.metadata) && input.equals(other.input) && output.equals(other.output) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && version.equals(other.version) && environment.equals(other.environment) && completionStartTime.equals(other.completionStartTime) && model.equals(other.model) && modelParameters.equals(other.modelParameters) && usage.equals(other.usage) && promptName.equals(other.promptName) && usageDetails.equals(other.usageDetails) && costDetails.equals(other.costDetails) && promptVersion.equals(other.promptVersion); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.endTime, this.id, this.traceId, this.name, this.startTime, this.metadata, this.input, this.output, this.level, this.statusMessage, this.parentObservationId, this.version, this.environment, this.completionStartTime, this.model, this.modelParameters, this.usage, this.promptName, this.usageDetails, this.costDetails, this.promptVersion); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - _FinalStage id(@NotNull String id); - - Builder from(UpdateGenerationBody other); - } - - public interface _FinalStage { - UpdateGenerationBody build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage endTime(Optional endTime); - - _FinalStage endTime(OffsetDateTime endTime); - - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage startTime(Optional startTime); - - _FinalStage startTime(OffsetDateTime startTime); - - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - _FinalStage input(Optional input); - - _FinalStage input(Object input); - - _FinalStage output(Optional output); - - _FinalStage output(Object output); - - _FinalStage level(Optional level); - - _FinalStage level(ObservationLevel level); - - _FinalStage statusMessage(Optional statusMessage); - - _FinalStage statusMessage(String statusMessage); - - _FinalStage parentObservationId(Optional parentObservationId); - - _FinalStage parentObservationId(String parentObservationId); - - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage environment(Optional environment); - - _FinalStage environment(String environment); - - _FinalStage completionStartTime(Optional completionStartTime); - - _FinalStage completionStartTime(OffsetDateTime completionStartTime); - - _FinalStage model(Optional model); - - _FinalStage model(String model); - - _FinalStage modelParameters(Optional> modelParameters); - - _FinalStage modelParameters(Map modelParameters); - - _FinalStage usage(Optional usage); - - _FinalStage usage(IngestionUsage usage); - - _FinalStage promptName(Optional promptName); - - _FinalStage promptName(String promptName); - - _FinalStage usageDetails(Optional usageDetails); - - _FinalStage usageDetails(UsageDetails usageDetails); - - _FinalStage costDetails(Optional> costDetails); - - _FinalStage costDetails(Map costDetails); - - _FinalStage promptVersion(Optional promptVersion); - - _FinalStage promptVersion(Integer promptVersion); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, _FinalStage { - private String id; - - private Optional promptVersion = Optional.empty(); - - private Optional> costDetails = Optional.empty(); - - private Optional usageDetails = Optional.empty(); - - private Optional promptName = Optional.empty(); - - private Optional usage = Optional.empty(); - - private Optional> modelParameters = Optional.empty(); - - private Optional model = Optional.empty(); - - private Optional completionStartTime = Optional.empty(); - - private Optional environment = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional startTime = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional endTime = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(UpdateGenerationBody other) { - endTime(other.getEndTime()); - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - startTime(other.getStartTime()); - metadata(other.getMetadata()); - input(other.getInput()); - output(other.getOutput()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - version(other.getVersion()); - environment(other.getEnvironment()); - completionStartTime(other.getCompletionStartTime()); - model(other.getModel()); - modelParameters(other.getModelParameters()); - usage(other.getUsage()); - promptName(other.getPromptName()); - usageDetails(other.getUsageDetails()); - costDetails(other.getCostDetails()); - promptVersion(other.getPromptVersion()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public _FinalStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage promptVersion(Integer promptVersion) { - this.promptVersion = Optional.ofNullable(promptVersion); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "promptVersion", - nulls = Nulls.SKIP - ) - public _FinalStage promptVersion(Optional promptVersion) { - this.promptVersion = promptVersion; - return this; - } - - @java.lang.Override - public _FinalStage costDetails(Map costDetails) { - this.costDetails = Optional.ofNullable(costDetails); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "costDetails", - nulls = Nulls.SKIP - ) - public _FinalStage costDetails(Optional> costDetails) { - this.costDetails = costDetails; - return this; - } - - @java.lang.Override - public _FinalStage usageDetails(UsageDetails usageDetails) { - this.usageDetails = Optional.ofNullable(usageDetails); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "usageDetails", - nulls = Nulls.SKIP - ) - public _FinalStage usageDetails(Optional usageDetails) { - this.usageDetails = usageDetails; - return this; - } - - @java.lang.Override - public _FinalStage promptName(String promptName) { - this.promptName = Optional.ofNullable(promptName); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "promptName", - nulls = Nulls.SKIP - ) - public _FinalStage promptName(Optional promptName) { - this.promptName = promptName; - return this; - } - - @java.lang.Override - public _FinalStage usage(IngestionUsage usage) { - this.usage = Optional.ofNullable(usage); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "usage", - nulls = Nulls.SKIP - ) - public _FinalStage usage(Optional usage) { - this.usage = usage; - return this; - } - - @java.lang.Override - public _FinalStage modelParameters(Map modelParameters) { - this.modelParameters = Optional.ofNullable(modelParameters); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "modelParameters", - nulls = Nulls.SKIP - ) - public _FinalStage modelParameters(Optional> modelParameters) { - this.modelParameters = modelParameters; - return this; - } - - @java.lang.Override - public _FinalStage model(String model) { - this.model = Optional.ofNullable(model); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "model", - nulls = Nulls.SKIP - ) - public _FinalStage model(Optional model) { - this.model = model; - return this; - } - - @java.lang.Override - public _FinalStage completionStartTime(OffsetDateTime completionStartTime) { - this.completionStartTime = Optional.ofNullable(completionStartTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "completionStartTime", - nulls = Nulls.SKIP - ) - public _FinalStage completionStartTime(Optional completionStartTime) { - this.completionStartTime = completionStartTime; - return this; - } - - @java.lang.Override - public _FinalStage environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public _FinalStage environment(Optional environment) { - this.environment = environment; - return this; - } - - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public _FinalStage parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public _FinalStage parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - @java.lang.Override - public _FinalStage statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public _FinalStage statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - @java.lang.Override - public _FinalStage level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public _FinalStage level(Optional level) { - this.level = level; - return this; - } - - @java.lang.Override - public _FinalStage output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public _FinalStage output(Optional output) { - this.output = output; - return this; - } - - @java.lang.Override - public _FinalStage input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public _FinalStage input(Optional input) { - this.input = input; - return this; - } - - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public _FinalStage startTime(OffsetDateTime startTime) { - this.startTime = Optional.ofNullable(startTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "startTime", - nulls = Nulls.SKIP - ) - public _FinalStage startTime(Optional startTime) { - this.startTime = startTime; - return this; - } - - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public _FinalStage endTime(OffsetDateTime endTime) { - this.endTime = Optional.ofNullable(endTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "endTime", - nulls = Nulls.SKIP - ) - public _FinalStage endTime(Optional endTime) { - this.endTime = endTime; - return this; - } - - @java.lang.Override - public UpdateGenerationBody build() { - return new UpdateGenerationBody(endTime, id, traceId, name, startTime, metadata, input, output, level, statusMessage, parentObservationId, version, environment, completionStartTime, model, modelParameters, usage, promptName, usageDetails, costDetails, promptVersion, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateGenerationEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateGenerationEvent.java deleted file mode 100644 index e00c8b4..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateGenerationEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = UpdateGenerationEvent.Builder.class -) -public final class UpdateGenerationEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final UpdateGenerationBody body; - - private final Map additionalProperties; - - private UpdateGenerationEvent(String id, String timestamp, Optional metadata, - UpdateGenerationBody body, Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public UpdateGenerationBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateGenerationEvent && equalTo((UpdateGenerationEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateGenerationEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(UpdateGenerationEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull UpdateGenerationBody body); - } - - public interface _FinalStage { - UpdateGenerationEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private UpdateGenerationBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(UpdateGenerationEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull UpdateGenerationBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public UpdateGenerationEvent build() { - return new UpdateGenerationEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateObservationEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateObservationEvent.java deleted file mode 100644 index 4d4cefe..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateObservationEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = UpdateObservationEvent.Builder.class -) -public final class UpdateObservationEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final ObservationBody body; - - private final Map additionalProperties; - - private UpdateObservationEvent(String id, String timestamp, Optional metadata, - ObservationBody body, Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public ObservationBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateObservationEvent && equalTo((UpdateObservationEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateObservationEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(UpdateObservationEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull ObservationBody body); - } - - public interface _FinalStage { - UpdateObservationEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private ObservationBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(UpdateObservationEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull ObservationBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public UpdateObservationEvent build() { - return new UpdateObservationEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateSpanBody.java b/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateSpanBody.java deleted file mode 100644 index 8947fa7..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateSpanBody.java +++ /dev/null @@ -1,520 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = UpdateSpanBody.Builder.class -) -public final class UpdateSpanBody implements IUpdateSpanBody, IUpdateEventBody, IOptionalObservationBody { - private final Optional endTime; - - private final String id; - - private final Optional traceId; - - private final Optional name; - - private final Optional startTime; - - private final Optional metadata; - - private final Optional input; - - private final Optional output; - - private final Optional level; - - private final Optional statusMessage; - - private final Optional parentObservationId; - - private final Optional version; - - private final Optional environment; - - private final Map additionalProperties; - - private UpdateSpanBody(Optional endTime, String id, Optional traceId, - Optional name, Optional startTime, Optional metadata, - Optional input, Optional output, Optional level, - Optional statusMessage, Optional parentObservationId, - Optional version, Optional environment, - Map additionalProperties) { - this.endTime = endTime; - this.id = id; - this.traceId = traceId; - this.name = name; - this.startTime = startTime; - this.metadata = metadata; - this.input = input; - this.output = output; - this.level = level; - this.statusMessage = statusMessage; - this.parentObservationId = parentObservationId; - this.version = version; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("endTime") - @java.lang.Override - public Optional getEndTime() { - return endTime; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - @JsonProperty("traceId") - @java.lang.Override - public Optional getTraceId() { - return traceId; - } - - @JsonProperty("name") - @java.lang.Override - public Optional getName() { - return name; - } - - @JsonProperty("startTime") - @java.lang.Override - public Optional getStartTime() { - return startTime; - } - - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("input") - @java.lang.Override - public Optional getInput() { - return input; - } - - @JsonProperty("output") - @java.lang.Override - public Optional getOutput() { - return output; - } - - @JsonProperty("level") - @java.lang.Override - public Optional getLevel() { - return level; - } - - @JsonProperty("statusMessage") - @java.lang.Override - public Optional getStatusMessage() { - return statusMessage; - } - - @JsonProperty("parentObservationId") - @java.lang.Override - public Optional getParentObservationId() { - return parentObservationId; - } - - @JsonProperty("version") - @java.lang.Override - public Optional getVersion() { - return version; - } - - @JsonProperty("environment") - @java.lang.Override - public Optional getEnvironment() { - return environment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateSpanBody && equalTo((UpdateSpanBody) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateSpanBody other) { - return endTime.equals(other.endTime) && id.equals(other.id) && traceId.equals(other.traceId) && name.equals(other.name) && startTime.equals(other.startTime) && metadata.equals(other.metadata) && input.equals(other.input) && output.equals(other.output) && level.equals(other.level) && statusMessage.equals(other.statusMessage) && parentObservationId.equals(other.parentObservationId) && version.equals(other.version) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.endTime, this.id, this.traceId, this.name, this.startTime, this.metadata, this.input, this.output, this.level, this.statusMessage, this.parentObservationId, this.version, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - _FinalStage id(@NotNull String id); - - Builder from(UpdateSpanBody other); - } - - public interface _FinalStage { - UpdateSpanBody build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage endTime(Optional endTime); - - _FinalStage endTime(OffsetDateTime endTime); - - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage name(Optional name); - - _FinalStage name(String name); - - _FinalStage startTime(Optional startTime); - - _FinalStage startTime(OffsetDateTime startTime); - - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - - _FinalStage input(Optional input); - - _FinalStage input(Object input); - - _FinalStage output(Optional output); - - _FinalStage output(Object output); - - _FinalStage level(Optional level); - - _FinalStage level(ObservationLevel level); - - _FinalStage statusMessage(Optional statusMessage); - - _FinalStage statusMessage(String statusMessage); - - _FinalStage parentObservationId(Optional parentObservationId); - - _FinalStage parentObservationId(String parentObservationId); - - _FinalStage version(Optional version); - - _FinalStage version(String version); - - _FinalStage environment(Optional environment); - - _FinalStage environment(String environment); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, _FinalStage { - private String id; - - private Optional environment = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional statusMessage = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional output = Optional.empty(); - - private Optional input = Optional.empty(); - - private Optional metadata = Optional.empty(); - - private Optional startTime = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional endTime = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(UpdateSpanBody other) { - endTime(other.getEndTime()); - id(other.getId()); - traceId(other.getTraceId()); - name(other.getName()); - startTime(other.getStartTime()); - metadata(other.getMetadata()); - input(other.getInput()); - output(other.getOutput()); - level(other.getLevel()); - statusMessage(other.getStatusMessage()); - parentObservationId(other.getParentObservationId()); - version(other.getVersion()); - environment(other.getEnvironment()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public _FinalStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public _FinalStage environment(Optional environment) { - this.environment = environment; - return this; - } - - @java.lang.Override - public _FinalStage version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public _FinalStage version(Optional version) { - this.version = version; - return this; - } - - @java.lang.Override - public _FinalStage parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public _FinalStage parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - @java.lang.Override - public _FinalStage statusMessage(String statusMessage) { - this.statusMessage = Optional.ofNullable(statusMessage); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "statusMessage", - nulls = Nulls.SKIP - ) - public _FinalStage statusMessage(Optional statusMessage) { - this.statusMessage = statusMessage; - return this; - } - - @java.lang.Override - public _FinalStage level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public _FinalStage level(Optional level) { - this.level = level; - return this; - } - - @java.lang.Override - public _FinalStage output(Object output) { - this.output = Optional.ofNullable(output); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "output", - nulls = Nulls.SKIP - ) - public _FinalStage output(Optional output) { - this.output = output; - return this; - } - - @java.lang.Override - public _FinalStage input(Object input) { - this.input = Optional.ofNullable(input); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "input", - nulls = Nulls.SKIP - ) - public _FinalStage input(Optional input) { - this.input = input; - return this; - } - - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public _FinalStage startTime(OffsetDateTime startTime) { - this.startTime = Optional.ofNullable(startTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "startTime", - nulls = Nulls.SKIP - ) - public _FinalStage startTime(Optional startTime) { - this.startTime = startTime; - return this; - } - - @java.lang.Override - public _FinalStage name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public _FinalStage name(Optional name) { - this.name = name; - return this; - } - - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public _FinalStage endTime(OffsetDateTime endTime) { - this.endTime = Optional.ofNullable(endTime); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "endTime", - nulls = Nulls.SKIP - ) - public _FinalStage endTime(Optional endTime) { - this.endTime = endTime; - return this; - } - - @java.lang.Override - public UpdateSpanBody build() { - return new UpdateSpanBody(endTime, id, traceId, name, startTime, metadata, input, output, level, statusMessage, parentObservationId, version, environment, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateSpanEvent.java b/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateSpanEvent.java deleted file mode 100644 index 8315d78..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/UpdateSpanEvent.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = UpdateSpanEvent.Builder.class -) -public final class UpdateSpanEvent implements IBaseEvent { - private final String id; - - private final String timestamp; - - private final Optional metadata; - - private final UpdateSpanBody body; - - private final Map additionalProperties; - - private UpdateSpanEvent(String id, String timestamp, Optional metadata, - UpdateSpanBody body, Map additionalProperties) { - this.id = id; - this.timestamp = timestamp; - this.metadata = metadata; - this.body = body; - this.additionalProperties = additionalProperties; - } - - /** - * @return UUID v4 that identifies the event - */ - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal). - */ - @JsonProperty("timestamp") - @java.lang.Override - public String getTimestamp() { - return timestamp; - } - - /** - * @return Optional. Metadata field used by the Langfuse SDKs for debugging. - */ - @JsonProperty("metadata") - @java.lang.Override - public Optional getMetadata() { - return metadata; - } - - @JsonProperty("body") - public UpdateSpanBody getBody() { - return body; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UpdateSpanEvent && equalTo((UpdateSpanEvent) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(UpdateSpanEvent other) { - return id.equals(other.id) && timestamp.equals(other.timestamp) && metadata.equals(other.metadata) && body.equals(other.body); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id, this.timestamp, this.metadata, this.body); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - /** - *

UUID v4 that identifies the event

- */ - TimestampStage id(@NotNull String id); - - Builder from(UpdateSpanEvent other); - } - - public interface TimestampStage { - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- */ - BodyStage timestamp(@NotNull String timestamp); - } - - public interface BodyStage { - _FinalStage body(@NotNull UpdateSpanBody body); - } - - public interface _FinalStage { - UpdateSpanEvent build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - _FinalStage metadata(Optional metadata); - - _FinalStage metadata(Object metadata); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, TimestampStage, BodyStage, _FinalStage { - private String id; - - private String timestamp; - - private UpdateSpanBody body; - - private Optional metadata = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(UpdateSpanEvent other) { - id(other.getId()); - timestamp(other.getTimestamp()); - metadata(other.getMetadata()); - body(other.getBody()); - return this; - } - - /** - *

UUID v4 that identifies the event

- *

UUID v4 that identifies the event

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("id") - public TimestampStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - /** - *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- *

Datetime (ISO 8601) of event creation in client. Should be as close to actual event creation in client as possible, this timestamp will be used for ordering of events in future release. Resolution: milliseconds (required), microseconds (optimal).

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("timestamp") - public BodyStage timestamp(@NotNull String timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("body") - public _FinalStage body(@NotNull UpdateSpanBody body) { - this.body = Objects.requireNonNull(body, "body must not be null"); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage metadata(Object metadata) { - this.metadata = Optional.ofNullable(metadata); - return this; - } - - /** - *

Optional. Metadata field used by the Langfuse SDKs for debugging.

- */ - @java.lang.Override - @JsonSetter( - value = "metadata", - nulls = Nulls.SKIP - ) - public _FinalStage metadata(Optional metadata) { - this.metadata = metadata; - return this; - } - - @java.lang.Override - public UpdateSpanEvent build() { - return new UpdateSpanEvent(id, timestamp, metadata, body, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/ingestion/types/UsageDetails.java b/src/main/java/com/langfuse/client/resources/ingestion/types/UsageDetails.java deleted file mode 100644 index c37b734..0000000 --- a/src/main/java/com/langfuse/client/resources/ingestion/types/UsageDetails.java +++ /dev/null @@ -1,119 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.ingestion.types; - -import com.fasterxml.jackson.annotation.JsonValue; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.std.StdDeserializer; -import com.langfuse.client.core.ObjectMappers; -import java.io.IOException; -import java.lang.IllegalStateException; -import java.lang.Integer; -import java.lang.Object; -import java.lang.RuntimeException; -import java.lang.String; -import java.lang.SuppressWarnings; -import java.util.Map; -import java.util.Objects; - -@JsonDeserialize( - using = UsageDetails.Deserializer.class -) -public final class UsageDetails { - private final Object value; - - private final int type; - - private UsageDetails(Object value, int type) { - this.value = value; - this.type = type; - } - - @JsonValue - public Object get() { - return this.value; - } - - @SuppressWarnings("unchecked") - public T visit(Visitor visitor) { - if(this.type == 0) { - return visitor.visit((Map) this.value); - } else if(this.type == 1) { - return visitor.visit((OpenAiCompletionUsageSchema) this.value); - } else if(this.type == 2) { - return visitor.visit((OpenAiResponseUsageSchema) this.value); - } - throw new IllegalStateException("Failed to visit value. This should never happen."); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof UsageDetails && equalTo((UsageDetails) other); - } - - private boolean equalTo(UsageDetails other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return this.value.toString(); - } - - public static UsageDetails of(Map value) { - return new UsageDetails(value, 0); - } - - public static UsageDetails of(OpenAiCompletionUsageSchema value) { - return new UsageDetails(value, 1); - } - - public static UsageDetails of(OpenAiResponseUsageSchema value) { - return new UsageDetails(value, 2); - } - - public interface Visitor { - T visit(Map value); - - T visit(OpenAiCompletionUsageSchema value); - - T visit(OpenAiResponseUsageSchema value); - } - - static final class Deserializer extends StdDeserializer { - Deserializer() { - super(UsageDetails.class); - } - - @java.lang.Override - public UsageDetails deserialize(JsonParser p, DeserializationContext context) throws - IOException { - Object value = p.readValueAs(Object.class); - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, new TypeReference>() {})); - } catch(RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, OpenAiCompletionUsageSchema.class)); - } catch(RuntimeException e) { - } - try { - return of(ObjectMappers.JSON_MAPPER.convertValue(value, OpenAiResponseUsageSchema.class)); - } catch(RuntimeException e) { - } - throw new JsonParseException(p, "Failed to deserialize"); - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/metrics/AsyncMetricsClient.java b/src/main/java/com/langfuse/client/resources/metrics/AsyncMetricsClient.java deleted file mode 100644 index 865b5e4..0000000 --- a/src/main/java/com/langfuse/client/resources/metrics/AsyncMetricsClient.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.metrics; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.util.concurrent.CompletableFuture; -import com.langfuse.client.resources.metrics.requests.GetMetricsRequest; -import com.langfuse.client.resources.metrics.types.MetricsResponse; - -public class AsyncMetricsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawMetricsClient rawClient; - - public AsyncMetricsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawMetricsClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawMetricsClient withRawResponse() { - return this.rawClient; - } - - /** - * Get metrics from the Langfuse project using a query object. - *

Consider using the v2 metrics endpoint for better performance.

- *

For more details, see the Metrics API documentation.

- */ - public CompletableFuture metrics(GetMetricsRequest request) { - return this.rawClient.metrics(request).thenApply(response -> response.body()); - } - - /** - * Get metrics from the Langfuse project using a query object. - *

Consider using the v2 metrics endpoint for better performance.

- *

For more details, see the Metrics API documentation.

- */ - public CompletableFuture metrics(GetMetricsRequest request, - RequestOptions requestOptions) { - return this.rawClient.metrics(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/langfuse/client/resources/metrics/AsyncRawMetricsClient.java b/src/main/java/com/langfuse/client/resources/metrics/AsyncRawMetricsClient.java deleted file mode 100644 index dd55236..0000000 --- a/src/main/java/com/langfuse/client/resources/metrics/AsyncRawMetricsClient.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.metrics; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.metrics.requests.GetMetricsRequest; -import com.langfuse.client.resources.metrics.types.MetricsResponse; - -public class AsyncRawMetricsClient { - protected final ClientOptions clientOptions; - - public AsyncRawMetricsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Get metrics from the Langfuse project using a query object. - *

Consider using the v2 metrics endpoint for better performance.

- *

For more details, see the Metrics API documentation.

- */ - public CompletableFuture> metrics( - GetMetricsRequest request) { - return metrics(request,null); - } - - /** - * Get metrics from the Langfuse project using a query object. - *

Consider using the v2 metrics endpoint for better performance.

- *

For more details, see the Metrics API documentation.

- */ - public CompletableFuture> metrics( - GetMetricsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("metrics");QueryStringMapper.addQueryParameter(httpUrl, "query", request.getQuery(), false); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MetricsResponse.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - } diff --git a/src/main/java/com/langfuse/client/resources/metrics/MetricsClient.java b/src/main/java/com/langfuse/client/resources/metrics/MetricsClient.java deleted file mode 100644 index 1185730..0000000 --- a/src/main/java/com/langfuse/client/resources/metrics/MetricsClient.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.metrics; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import com.langfuse.client.resources.metrics.requests.GetMetricsRequest; -import com.langfuse.client.resources.metrics.types.MetricsResponse; - -public class MetricsClient { - protected final ClientOptions clientOptions; - - private final RawMetricsClient rawClient; - - public MetricsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawMetricsClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawMetricsClient withRawResponse() { - return this.rawClient; - } - - /** - * Get metrics from the Langfuse project using a query object. - *

Consider using the v2 metrics endpoint for better performance.

- *

For more details, see the Metrics API documentation.

- */ - public MetricsResponse metrics(GetMetricsRequest request) { - return this.rawClient.metrics(request).body(); - } - - /** - * Get metrics from the Langfuse project using a query object. - *

Consider using the v2 metrics endpoint for better performance.

- *

For more details, see the Metrics API documentation.

- */ - public MetricsResponse metrics(GetMetricsRequest request, RequestOptions requestOptions) { - return this.rawClient.metrics(request, requestOptions).body(); - } -} diff --git a/src/main/java/com/langfuse/client/resources/metrics/RawMetricsClient.java b/src/main/java/com/langfuse/client/resources/metrics/RawMetricsClient.java deleted file mode 100644 index 17d5230..0000000 --- a/src/main/java/com/langfuse/client/resources/metrics/RawMetricsClient.java +++ /dev/null @@ -1,98 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.metrics; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.String; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.metrics.requests.GetMetricsRequest; -import com.langfuse.client.resources.metrics.types.MetricsResponse; - -public class RawMetricsClient { - protected final ClientOptions clientOptions; - - public RawMetricsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Get metrics from the Langfuse project using a query object. - *

Consider using the v2 metrics endpoint for better performance.

- *

For more details, see the Metrics API documentation.

- */ - public LangfuseClientHttpResponse metrics(GetMetricsRequest request) { - return metrics(request,null); - } - - /** - * Get metrics from the Langfuse project using a query object. - *

Consider using the v2 metrics endpoint for better performance.

- *

For more details, see the Metrics API documentation.

- */ - public LangfuseClientHttpResponse metrics(GetMetricsRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("metrics");QueryStringMapper.addQueryParameter(httpUrl, "query", request.getQuery(), false); - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, MetricsResponse.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - } diff --git a/src/main/java/com/langfuse/client/resources/metrics/requests/GetMetricsRequest.java b/src/main/java/com/langfuse/client/resources/metrics/requests/GetMetricsRequest.java deleted file mode 100644 index f00252c..0000000 --- a/src/main/java/com/langfuse/client/resources/metrics/requests/GetMetricsRequest.java +++ /dev/null @@ -1,293 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.metrics.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetMetricsRequest.Builder.class -) -public final class GetMetricsRequest { - private final String query; - - private final Map additionalProperties; - - private GetMetricsRequest(String query, Map additionalProperties) { - this.query = query; - this.additionalProperties = additionalProperties; - } - - /** - * @return JSON string containing the query parameters with the following structure: - *
{
-   *   "view": string,           // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"
-   *   "dimensions": [           // Optional. Default: []
-   *     {
-   *       "field": string       // Field to group by, e.g. "name", "userId", "sessionId"
-   *     }
-   *   ],
-   *   "metrics": [              // Required. At least one metric must be provided
-   *     {
-   *       "measure": string,    // What to measure, e.g. "count", "latency", "value"
-   *       "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
-   *     }
-   *   ],
-   *   "filters": [              // Optional. Default: []
-   *     {
-   *       "column": string,     // Column to filter on
-   *       "operator": string,   // Operator, e.g. "=", ">", "<", "contains"
-   *       "value": any,         // Value to compare against
-   *       "type": string,       // Data type, e.g. "string", "number", "stringObject"
-   *       "key": string         // Required only when filtering on metadata
-   *     }
-   *   ],
-   *   "timeDimension": {        // Optional. Default: null. If provided, results will be grouped by time
-   *     "granularity": string   // One of "minute", "hour", "day", "week", "month", "auto"
-   *   },
-   *   "fromTimestamp": string,  // Required. ISO datetime string for start of time range
-   *   "toTimestamp": string,    // Required. ISO datetime string for end of time range
-   *   "orderBy": [              // Optional. Default: null
-   *     {
-   *       "field": string,      // Field to order by
-   *       "direction": string   // "asc" or "desc"
-   *     }
-   *   ],
-   *   "config": {               // Optional. Query-specific configuration
-   *     "bins": number,         // Optional. Number of bins for histogram (1-100), default: 10
-   *     "row_limit": number     // Optional. Row limit for results (1-1000)
-   *   }
-   * }
-   * 
- */ - @JsonProperty("query") - public String getQuery() { - return query; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetMetricsRequest && equalTo((GetMetricsRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetMetricsRequest other) { - return query.equals(other.query); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.query); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static QueryStage builder() { - return new Builder(); - } - - public interface QueryStage { - /** - *

JSON string containing the query parameters with the following structure:

- *
{
-     *   "view": string,           // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"
-     *   "dimensions": [           // Optional. Default: []
-     *     {
-     *       "field": string       // Field to group by, e.g. "name", "userId", "sessionId"
-     *     }
-     *   ],
-     *   "metrics": [              // Required. At least one metric must be provided
-     *     {
-     *       "measure": string,    // What to measure, e.g. "count", "latency", "value"
-     *       "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
-     *     }
-     *   ],
-     *   "filters": [              // Optional. Default: []
-     *     {
-     *       "column": string,     // Column to filter on
-     *       "operator": string,   // Operator, e.g. "=", ">", "<", "contains"
-     *       "value": any,         // Value to compare against
-     *       "type": string,       // Data type, e.g. "string", "number", "stringObject"
-     *       "key": string         // Required only when filtering on metadata
-     *     }
-     *   ],
-     *   "timeDimension": {        // Optional. Default: null. If provided, results will be grouped by time
-     *     "granularity": string   // One of "minute", "hour", "day", "week", "month", "auto"
-     *   },
-     *   "fromTimestamp": string,  // Required. ISO datetime string for start of time range
-     *   "toTimestamp": string,    // Required. ISO datetime string for end of time range
-     *   "orderBy": [              // Optional. Default: null
-     *     {
-     *       "field": string,      // Field to order by
-     *       "direction": string   // "asc" or "desc"
-     *     }
-     *   ],
-     *   "config": {               // Optional. Query-specific configuration
-     *     "bins": number,         // Optional. Number of bins for histogram (1-100), default: 10
-     *     "row_limit": number     // Optional. Row limit for results (1-1000)
-     *   }
-     * }
-     * 
- */ - _FinalStage query(@NotNull String query); - - Builder from(GetMetricsRequest other); - } - - public interface _FinalStage { - GetMetricsRequest build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements QueryStage, _FinalStage { - private String query; - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(GetMetricsRequest other) { - query(other.getQuery()); - return this; - } - - /** - *

JSON string containing the query parameters with the following structure:

- *
{
-     *   "view": string,           // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"
-     *   "dimensions": [           // Optional. Default: []
-     *     {
-     *       "field": string       // Field to group by, e.g. "name", "userId", "sessionId"
-     *     }
-     *   ],
-     *   "metrics": [              // Required. At least one metric must be provided
-     *     {
-     *       "measure": string,    // What to measure, e.g. "count", "latency", "value"
-     *       "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
-     *     }
-     *   ],
-     *   "filters": [              // Optional. Default: []
-     *     {
-     *       "column": string,     // Column to filter on
-     *       "operator": string,   // Operator, e.g. "=", ">", "<", "contains"
-     *       "value": any,         // Value to compare against
-     *       "type": string,       // Data type, e.g. "string", "number", "stringObject"
-     *       "key": string         // Required only when filtering on metadata
-     *     }
-     *   ],
-     *   "timeDimension": {        // Optional. Default: null. If provided, results will be grouped by time
-     *     "granularity": string   // One of "minute", "hour", "day", "week", "month", "auto"
-     *   },
-     *   "fromTimestamp": string,  // Required. ISO datetime string for start of time range
-     *   "toTimestamp": string,    // Required. ISO datetime string for end of time range
-     *   "orderBy": [              // Optional. Default: null
-     *     {
-     *       "field": string,      // Field to order by
-     *       "direction": string   // "asc" or "desc"
-     *     }
-     *   ],
-     *   "config": {               // Optional. Query-specific configuration
-     *     "bins": number,         // Optional. Number of bins for histogram (1-100), default: 10
-     *     "row_limit": number     // Optional. Row limit for results (1-1000)
-     *   }
-     * }
-     * 
- *

JSON string containing the query parameters with the following structure:

- *
{
-     *   "view": string,           // Required. One of "traces", "observations", "scores-numeric", "scores-categorical"
-     *   "dimensions": [           // Optional. Default: []
-     *     {
-     *       "field": string       // Field to group by, e.g. "name", "userId", "sessionId"
-     *     }
-     *   ],
-     *   "metrics": [              // Required. At least one metric must be provided
-     *     {
-     *       "measure": string,    // What to measure, e.g. "count", "latency", "value"
-     *       "aggregation": string // How to aggregate, e.g. "count", "sum", "avg", "p95", "histogram"
-     *     }
-     *   ],
-     *   "filters": [              // Optional. Default: []
-     *     {
-     *       "column": string,     // Column to filter on
-     *       "operator": string,   // Operator, e.g. "=", ">", "<", "contains"
-     *       "value": any,         // Value to compare against
-     *       "type": string,       // Data type, e.g. "string", "number", "stringObject"
-     *       "key": string         // Required only when filtering on metadata
-     *     }
-     *   ],
-     *   "timeDimension": {        // Optional. Default: null. If provided, results will be grouped by time
-     *     "granularity": string   // One of "minute", "hour", "day", "week", "month", "auto"
-     *   },
-     *   "fromTimestamp": string,  // Required. ISO datetime string for start of time range
-     *   "toTimestamp": string,    // Required. ISO datetime string for end of time range
-     *   "orderBy": [              // Optional. Default: null
-     *     {
-     *       "field": string,      // Field to order by
-     *       "direction": string   // "asc" or "desc"
-     *     }
-     *   ],
-     *   "config": {               // Optional. Query-specific configuration
-     *     "bins": number,         // Optional. Number of bins for histogram (1-100), default: 10
-     *     "row_limit": number     // Optional. Row limit for results (1-1000)
-     *   }
-     * }
-     * 
- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("query") - public _FinalStage query(@NotNull String query) { - this.query = Objects.requireNonNull(query, "query must not be null"); - return this; - } - - @java.lang.Override - public GetMetricsRequest build() { - return new GetMetricsRequest(query, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/metrics/types/MetricsResponse.java b/src/main/java/com/langfuse/client/resources/metrics/types/MetricsResponse.java deleted file mode 100644 index 8276aa9..0000000 --- a/src/main/java/com/langfuse/client/resources/metrics/types/MetricsResponse.java +++ /dev/null @@ -1,138 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.metrics.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = MetricsResponse.Builder.class -) -public final class MetricsResponse { - private final List> data; - - private final Map additionalProperties; - - private MetricsResponse(List> data, - Map additionalProperties) { - this.data = data; - this.additionalProperties = additionalProperties; - } - - /** - * @return The metrics data. Each item in the list contains the metric values and dimensions requested in the query. - * Format varies based on the query parameters. - * Histograms will return an array with [lower, upper, height] tuples. - */ - @JsonProperty("data") - public List> getData() { - return data; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof MetricsResponse && equalTo((MetricsResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(MetricsResponse other) { - return data.equals(other.data); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.data); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private List> data = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(MetricsResponse other) { - data(other.getData()); - return this; - } - - /** - *

The metrics data. Each item in the list contains the metric values and dimensions requested in the query. - * Format varies based on the query parameters. - * Histograms will return an array with [lower, upper, height] tuples.

- */ - @JsonSetter( - value = "data", - nulls = Nulls.SKIP - ) - public Builder data(List> data) { - this.data.clear(); - if (data != null) { - this.data.addAll(data); - } - return this; - } - - public Builder addData(Map data) { - this.data.add(data); - return this; - } - - public Builder addAllData(List> data) { - if (data != null) { - this.data.addAll(data); - } - return this; - } - - public MetricsResponse build() { - return new MetricsResponse(data, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/observations/AsyncObservationsClient.java b/src/main/java/com/langfuse/client/resources/observations/AsyncObservationsClient.java deleted file mode 100644 index 730ddc7..0000000 --- a/src/main/java/com/langfuse/client/resources/observations/AsyncObservationsClient.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.observations; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import com.langfuse.client.resources.commons.types.ObservationsView; -import com.langfuse.client.resources.observations.requests.GetObservationsRequest; -import com.langfuse.client.resources.observations.types.ObservationsViews; - -public class AsyncObservationsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawObservationsClient rawClient; - - public AsyncObservationsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawObservationsClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawObservationsClient withRawResponse() { - return this.rawClient; - } - - /** - * Get a observation - */ - public CompletableFuture get(String observationId) { - return this.rawClient.get(observationId).thenApply(response -> response.body()); - } - - /** - * Get a observation - */ - public CompletableFuture get(String observationId, - RequestOptions requestOptions) { - return this.rawClient.get(observationId, requestOptions).thenApply(response -> response.body()); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public CompletableFuture getMany() { - return this.rawClient.getMany().thenApply(response -> response.body()); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public CompletableFuture getMany(RequestOptions requestOptions) { - return this.rawClient.getMany(requestOptions).thenApply(response -> response.body()); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public CompletableFuture getMany(GetObservationsRequest request) { - return this.rawClient.getMany(request).thenApply(response -> response.body()); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public CompletableFuture getMany(GetObservationsRequest request, - RequestOptions requestOptions) { - return this.rawClient.getMany(request, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/langfuse/client/resources/observations/AsyncRawObservationsClient.java b/src/main/java/com/langfuse/client/resources/observations/AsyncRawObservationsClient.java deleted file mode 100644 index 83ff355..0000000 --- a/src/main/java/com/langfuse/client/resources/observations/AsyncRawObservationsClient.java +++ /dev/null @@ -1,250 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.observations; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.ObservationsView; -import com.langfuse.client.resources.observations.requests.GetObservationsRequest; -import com.langfuse.client.resources.observations.types.ObservationsViews; - -public class AsyncRawObservationsClient { - protected final ClientOptions clientOptions; - - public AsyncRawObservationsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Get a observation - */ - public CompletableFuture> get(String observationId) { - return get(observationId,null); - } - - /** - * Get a observation - */ - public CompletableFuture> get(String observationId, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("observations") - .addPathSegment(observationId);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ObservationsView.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public CompletableFuture> getMany() { - return getMany(GetObservationsRequest.builder().build()); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public CompletableFuture> getMany( - RequestOptions requestOptions) { - return getMany(GetObservationsRequest.builder().build(),requestOptions); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public CompletableFuture> getMany( - GetObservationsRequest request) { - return getMany(request,null); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public CompletableFuture> getMany( - GetObservationsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("observations");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getName().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "name", request.getName().get(), false); - } - if (request.getUserId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "userId", request.getUserId().get(), false); - } - if (request.getType().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "type", request.getType().get(), false); - } - if (request.getTraceId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "traceId", request.getTraceId().get(), false); - } - if (request.getLevel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "level", request.getLevel().get(), false); - } - if (request.getParentObservationId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "parentObservationId", request.getParentObservationId().get(), false); - } - if (request.getFromStartTime().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fromStartTime", request.getFromStartTime().get(), false); - } - if (request.getToStartTime().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "toStartTime", request.getToStartTime().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (request.getFilter().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "filter", request.getFilter().get(), false); - } - if (request.getEnvironment().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "environment", request.getEnvironment().get(), true); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ObservationsViews.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - } diff --git a/src/main/java/com/langfuse/client/resources/observations/ObservationsClient.java b/src/main/java/com/langfuse/client/resources/observations/ObservationsClient.java deleted file mode 100644 index c9ef464..0000000 --- a/src/main/java/com/langfuse/client/resources/observations/ObservationsClient.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.observations; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.lang.String; -import com.langfuse.client.resources.commons.types.ObservationsView; -import com.langfuse.client.resources.observations.requests.GetObservationsRequest; -import com.langfuse.client.resources.observations.types.ObservationsViews; - -public class ObservationsClient { - protected final ClientOptions clientOptions; - - private final RawObservationsClient rawClient; - - public ObservationsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawObservationsClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawObservationsClient withRawResponse() { - return this.rawClient; - } - - /** - * Get a observation - */ - public ObservationsView get(String observationId) { - return this.rawClient.get(observationId).body(); - } - - /** - * Get a observation - */ - public ObservationsView get(String observationId, RequestOptions requestOptions) { - return this.rawClient.get(observationId, requestOptions).body(); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public ObservationsViews getMany() { - return this.rawClient.getMany().body(); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public ObservationsViews getMany(RequestOptions requestOptions) { - return this.rawClient.getMany(requestOptions).body(); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public ObservationsViews getMany(GetObservationsRequest request) { - return this.rawClient.getMany(request).body(); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public ObservationsViews getMany(GetObservationsRequest request, RequestOptions requestOptions) { - return this.rawClient.getMany(request, requestOptions).body(); - } -} diff --git a/src/main/java/com/langfuse/client/resources/observations/RawObservationsClient.java b/src/main/java/com/langfuse/client/resources/observations/RawObservationsClient.java deleted file mode 100644 index be5c0bc..0000000 --- a/src/main/java/com/langfuse/client/resources/observations/RawObservationsClient.java +++ /dev/null @@ -1,207 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.observations; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.String; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.ObservationsView; -import com.langfuse.client.resources.observations.requests.GetObservationsRequest; -import com.langfuse.client.resources.observations.types.ObservationsViews; - -public class RawObservationsClient { - protected final ClientOptions clientOptions; - - public RawObservationsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Get a observation - */ - public LangfuseClientHttpResponse get(String observationId) { - return get(observationId,null); - } - - /** - * Get a observation - */ - public LangfuseClientHttpResponse get(String observationId, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("observations") - .addPathSegment(observationId);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ObservationsView.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public LangfuseClientHttpResponse getMany() { - return getMany(GetObservationsRequest.builder().build()); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public LangfuseClientHttpResponse getMany(RequestOptions requestOptions) { - return getMany(GetObservationsRequest.builder().build(),requestOptions); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public LangfuseClientHttpResponse getMany(GetObservationsRequest request) { - return getMany(request,null); - } - - /** - * Get a list of observations. - *

Consider using the v2 observations endpoint for cursor-based pagination and field selection.

- */ - public LangfuseClientHttpResponse getMany(GetObservationsRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("observations");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getName().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "name", request.getName().get(), false); - } - if (request.getUserId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "userId", request.getUserId().get(), false); - } - if (request.getType().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "type", request.getType().get(), false); - } - if (request.getTraceId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "traceId", request.getTraceId().get(), false); - } - if (request.getLevel().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "level", request.getLevel().get(), false); - } - if (request.getParentObservationId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "parentObservationId", request.getParentObservationId().get(), false); - } - if (request.getFromStartTime().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fromStartTime", request.getFromStartTime().get(), false); - } - if (request.getToStartTime().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "toStartTime", request.getToStartTime().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (request.getFilter().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "filter", request.getFilter().get(), false); - } - if (request.getEnvironment().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "environment", request.getEnvironment().get(), true); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, ObservationsViews.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - } diff --git a/src/main/java/com/langfuse/client/resources/observations/requests/GetObservationsRequest.java b/src/main/java/com/langfuse/client/resources/observations/requests/GetObservationsRequest.java deleted file mode 100644 index 5775e9d..0000000 --- a/src/main/java/com/langfuse/client/resources/observations/requests/GetObservationsRequest.java +++ /dev/null @@ -1,476 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.observations.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import com.langfuse.client.resources.commons.types.ObservationLevel; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetObservationsRequest.Builder.class -) -public final class GetObservationsRequest { - private final Optional> environment; - - private final Optional page; - - private final Optional limit; - - private final Optional name; - - private final Optional userId; - - private final Optional type; - - private final Optional traceId; - - private final Optional level; - - private final Optional parentObservationId; - - private final Optional fromStartTime; - - private final Optional toStartTime; - - private final Optional version; - - private final Optional filter; - - private final Map additionalProperties; - - private GetObservationsRequest(Optional> environment, Optional page, - Optional limit, Optional name, Optional userId, - Optional type, Optional traceId, Optional level, - Optional parentObservationId, Optional fromStartTime, - Optional toStartTime, Optional version, Optional filter, - Map additionalProperties) { - this.environment = environment; - this.page = page; - this.limit = limit; - this.name = name; - this.userId = userId; - this.type = type; - this.traceId = traceId; - this.level = level; - this.parentObservationId = parentObservationId; - this.fromStartTime = fromStartTime; - this.toStartTime = toStartTime; - this.version = version; - this.filter = filter; - this.additionalProperties = additionalProperties; - } - - /** - * @return Optional filter for observations where the environment is one of the provided values. - */ - @JsonProperty("environment") - public Optional> getEnvironment() { - return environment; - } - - /** - * @return Page number, starts at 1. - */ - @JsonProperty("page") - public Optional getPage() { - return page; - } - - /** - * @return Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit. - */ - @JsonProperty("limit") - public Optional getLimit() { - return limit; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("userId") - public Optional getUserId() { - return userId; - } - - @JsonProperty("type") - public Optional getType() { - return type; - } - - @JsonProperty("traceId") - public Optional getTraceId() { - return traceId; - } - - /** - * @return Optional filter for observations with a specific level (e.g. "DEBUG", "DEFAULT", "WARNING", "ERROR"). - */ - @JsonProperty("level") - public Optional getLevel() { - return level; - } - - @JsonProperty("parentObservationId") - public Optional getParentObservationId() { - return parentObservationId; - } - - /** - * @return Retrieve only observations with a start_time on or after this datetime (ISO 8601). - */ - @JsonProperty("fromStartTime") - public Optional getFromStartTime() { - return fromStartTime; - } - - /** - * @return Retrieve only observations with a start_time before this datetime (ISO 8601). - */ - @JsonProperty("toStartTime") - public Optional getToStartTime() { - return toStartTime; - } - - /** - * @return Optional filter to only include observations with a certain version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return JSON string containing an array of filter conditions. When provided, this takes precedence over query parameter filters (userId, name, type, level, environment, fromStartTime, ...). - */ - @JsonProperty("filter") - public Optional getFilter() { - return filter; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetObservationsRequest && equalTo((GetObservationsRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetObservationsRequest other) { - return environment.equals(other.environment) && page.equals(other.page) && limit.equals(other.limit) && name.equals(other.name) && userId.equals(other.userId) && type.equals(other.type) && traceId.equals(other.traceId) && level.equals(other.level) && parentObservationId.equals(other.parentObservationId) && fromStartTime.equals(other.fromStartTime) && toStartTime.equals(other.toStartTime) && version.equals(other.version) && filter.equals(other.filter); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.environment, this.page, this.limit, this.name, this.userId, this.type, this.traceId, this.level, this.parentObservationId, this.fromStartTime, this.toStartTime, this.version, this.filter); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional> environment = Optional.empty(); - - private Optional page = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional userId = Optional.empty(); - - private Optional type = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional level = Optional.empty(); - - private Optional parentObservationId = Optional.empty(); - - private Optional fromStartTime = Optional.empty(); - - private Optional toStartTime = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional filter = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(GetObservationsRequest other) { - environment(other.getEnvironment()); - page(other.getPage()); - limit(other.getLimit()); - name(other.getName()); - userId(other.getUserId()); - type(other.getType()); - traceId(other.getTraceId()); - level(other.getLevel()); - parentObservationId(other.getParentObservationId()); - fromStartTime(other.getFromStartTime()); - toStartTime(other.getToStartTime()); - version(other.getVersion()); - filter(other.getFilter()); - return this; - } - - /** - *

Optional filter for observations where the environment is one of the provided values.

- */ - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional> environment) { - this.environment = environment; - return this; - } - - public Builder environment(List environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.of(Collections.singletonList(environment)); - return this; - } - - /** - *

Page number, starts at 1.

- */ - @JsonSetter( - value = "page", - nulls = Nulls.SKIP - ) - public Builder page(Optional page) { - this.page = page; - return this; - } - - public Builder page(Integer page) { - this.page = Optional.ofNullable(page); - return this; - } - - /** - *

Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.

- */ - @JsonSetter( - value = "limit", - nulls = Nulls.SKIP - ) - public Builder limit(Optional limit) { - this.limit = limit; - return this; - } - - public Builder limit(Integer limit) { - this.limit = Optional.ofNullable(limit); - return this; - } - - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter( - value = "userId", - nulls = Nulls.SKIP - ) - public Builder userId(Optional userId) { - this.userId = userId; - return this; - } - - public Builder userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - @JsonSetter( - value = "type", - nulls = Nulls.SKIP - ) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(String type) { - this.type = Optional.ofNullable(type); - return this; - } - - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public Builder traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - public Builder traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

Optional filter for observations with a specific level (e.g. "DEBUG", "DEFAULT", "WARNING", "ERROR").

- */ - @JsonSetter( - value = "level", - nulls = Nulls.SKIP - ) - public Builder level(Optional level) { - this.level = level; - return this; - } - - public Builder level(ObservationLevel level) { - this.level = Optional.ofNullable(level); - return this; - } - - @JsonSetter( - value = "parentObservationId", - nulls = Nulls.SKIP - ) - public Builder parentObservationId(Optional parentObservationId) { - this.parentObservationId = parentObservationId; - return this; - } - - public Builder parentObservationId(String parentObservationId) { - this.parentObservationId = Optional.ofNullable(parentObservationId); - return this; - } - - /** - *

Retrieve only observations with a start_time on or after this datetime (ISO 8601).

- */ - @JsonSetter( - value = "fromStartTime", - nulls = Nulls.SKIP - ) - public Builder fromStartTime(Optional fromStartTime) { - this.fromStartTime = fromStartTime; - return this; - } - - public Builder fromStartTime(OffsetDateTime fromStartTime) { - this.fromStartTime = Optional.ofNullable(fromStartTime); - return this; - } - - /** - *

Retrieve only observations with a start_time before this datetime (ISO 8601).

- */ - @JsonSetter( - value = "toStartTime", - nulls = Nulls.SKIP - ) - public Builder toStartTime(Optional toStartTime) { - this.toStartTime = toStartTime; - return this; - } - - public Builder toStartTime(OffsetDateTime toStartTime) { - this.toStartTime = Optional.ofNullable(toStartTime); - return this; - } - - /** - *

Optional filter to only include observations with a certain version.

- */ - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - @JsonSetter( - value = "filter", - nulls = Nulls.SKIP - ) - public Builder filter(Optional filter) { - this.filter = filter; - return this; - } - - public Builder filter(String filter) { - this.filter = Optional.ofNullable(filter); - return this; - } - - public GetObservationsRequest build() { - return new GetObservationsRequest(environment, page, limit, name, userId, type, traceId, level, parentObservationId, fromStartTime, toStartTime, version, filter, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/observations/types/Observations.java b/src/main/java/com/langfuse/client/resources/observations/types/Observations.java deleted file mode 100644 index fb12855..0000000 --- a/src/main/java/com/langfuse/client/resources/observations/types/Observations.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.observations.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.Observation; -import com.langfuse.client.resources.utils.pagination.types.MetaResponse; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = Observations.Builder.class -) -public final class Observations { - private final List data; - - private final MetaResponse meta; - - private final Map additionalProperties; - - private Observations(List data, MetaResponse meta, - Map additionalProperties) { - this.data = data; - this.meta = meta; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public List getData() { - return data; - } - - @JsonProperty("meta") - public MetaResponse getMeta() { - return meta; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Observations && equalTo((Observations) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Observations other) { - return data.equals(other.data) && meta.equals(other.meta); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.data, this.meta); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetaStage builder() { - return new Builder(); - } - - public interface MetaStage { - _FinalStage meta(@NotNull MetaResponse meta); - - Builder from(Observations other); - } - - public interface _FinalStage { - Observations build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage data(List data); - - _FinalStage addData(Observation data); - - _FinalStage addAllData(List data); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements MetaStage, _FinalStage { - private MetaResponse meta; - - private List data = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(Observations other) { - data(other.getData()); - meta(other.getMeta()); - return this; - } - - @java.lang.Override - @JsonSetter("meta") - public _FinalStage meta(@NotNull MetaResponse meta) { - this.meta = Objects.requireNonNull(meta, "meta must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllData(List data) { - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public _FinalStage addData(Observation data) { - this.data.add(data); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "data", - nulls = Nulls.SKIP - ) - public _FinalStage data(List data) { - this.data.clear(); - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public Observations build() { - return new Observations(data, meta, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/observations/types/ObservationsViews.java b/src/main/java/com/langfuse/client/resources/observations/types/ObservationsViews.java deleted file mode 100644 index 19f0edc..0000000 --- a/src/main/java/com/langfuse/client/resources/observations/types/ObservationsViews.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.observations.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.ObservationsView; -import com.langfuse.client.resources.utils.pagination.types.MetaResponse; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = ObservationsViews.Builder.class -) -public final class ObservationsViews { - private final List data; - - private final MetaResponse meta; - - private final Map additionalProperties; - - private ObservationsViews(List data, MetaResponse meta, - Map additionalProperties) { - this.data = data; - this.meta = meta; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public List getData() { - return data; - } - - @JsonProperty("meta") - public MetaResponse getMeta() { - return meta; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof ObservationsViews && equalTo((ObservationsViews) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(ObservationsViews other) { - return data.equals(other.data) && meta.equals(other.meta); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.data, this.meta); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetaStage builder() { - return new Builder(); - } - - public interface MetaStage { - _FinalStage meta(@NotNull MetaResponse meta); - - Builder from(ObservationsViews other); - } - - public interface _FinalStage { - ObservationsViews build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage data(List data); - - _FinalStage addData(ObservationsView data); - - _FinalStage addAllData(List data); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements MetaStage, _FinalStage { - private MetaResponse meta; - - private List data = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(ObservationsViews other) { - data(other.getData()); - meta(other.getMeta()); - return this; - } - - @java.lang.Override - @JsonSetter("meta") - public _FinalStage meta(@NotNull MetaResponse meta) { - this.meta = Objects.requireNonNull(meta, "meta must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllData(List data) { - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public _FinalStage addData(ObservationsView data) { - this.data.add(data); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "data", - nulls = Nulls.SKIP - ) - public _FinalStage data(List data) { - this.data.clear(); - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public ObservationsViews build() { - return new ObservationsViews(data, meta, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/AsyncRawScoreV2Client.java b/src/main/java/com/langfuse/client/resources/scorev2/AsyncRawScoreV2Client.java deleted file mode 100644 index 32f329b..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/AsyncRawScoreV2Client.java +++ /dev/null @@ -1,270 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.Score; -import com.langfuse.client.resources.scorev2.requests.GetScoresRequest; -import com.langfuse.client.resources.scorev2.types.GetScoresResponse; - -public class AsyncRawScoreV2Client { - protected final ClientOptions clientOptions; - - public AsyncRawScoreV2Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public CompletableFuture> get() { - return get(GetScoresRequest.builder().build()); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public CompletableFuture> get( - RequestOptions requestOptions) { - return get(GetScoresRequest.builder().build(),requestOptions); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public CompletableFuture> get( - GetScoresRequest request) { - return get(request,null); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public CompletableFuture> get( - GetScoresRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public/v2") - .addPathSegments("scores");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getUserId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "userId", request.getUserId().get(), false); - } - if (request.getName().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "name", request.getName().get(), false); - } - if (request.getFromTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fromTimestamp", request.getFromTimestamp().get(), false); - } - if (request.getToTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "toTimestamp", request.getToTimestamp().get(), false); - } - if (request.getSource().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "source", request.getSource().get(), false); - } - if (request.getOperator().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "operator", request.getOperator().get(), false); - } - if (request.getValue().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "value", request.getValue().get(), false); - } - if (request.getScoreIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "scoreIds", request.getScoreIds().get(), false); - } - if (request.getConfigId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "configId", request.getConfigId().get(), false); - } - if (request.getSessionId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "sessionId", request.getSessionId().get(), false); - } - if (request.getDatasetRunId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "datasetRunId", request.getDatasetRunId().get(), false); - } - if (request.getTraceId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "traceId", request.getTraceId().get(), false); - } - if (request.getObservationId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "observationId", request.getObservationId().get(), false); - } - if (request.getQueueId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "queueId", request.getQueueId().get(), false); - } - if (request.getDataType().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "dataType", request.getDataType().get(), false); - } - if (request.getFields().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fields", request.getFields().get(), false); - } - if (request.getFilter().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "filter", request.getFilter().get(), false); - } - if (request.getEnvironment().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "environment", request.getEnvironment().get(), true); - } - if (request.getTraceTags().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "traceTags", request.getTraceTags().get(), true); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetScoresResponse.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** - * Get a score (supports both trace and session scores) - */ - public CompletableFuture> getById(String scoreId) { - return getById(scoreId,null); - } - - /** - * Get a score (supports both trace and session scores) - */ - public CompletableFuture> getById(String scoreId, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public/v2") - .addPathSegments("scores") - .addPathSegment(scoreId);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Score.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - } diff --git a/src/main/java/com/langfuse/client/resources/scorev2/AsyncScoreV2Client.java b/src/main/java/com/langfuse/client/resources/scorev2/AsyncScoreV2Client.java deleted file mode 100644 index 5ea5380..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/AsyncScoreV2Client.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import com.langfuse.client.resources.commons.types.Score; -import com.langfuse.client.resources.scorev2.requests.GetScoresRequest; -import com.langfuse.client.resources.scorev2.types.GetScoresResponse; - -public class AsyncScoreV2Client { - protected final ClientOptions clientOptions; - - private final AsyncRawScoreV2Client rawClient; - - public AsyncScoreV2Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawScoreV2Client(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawScoreV2Client withRawResponse() { - return this.rawClient; - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public CompletableFuture get() { - return this.rawClient.get().thenApply(response -> response.body()); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public CompletableFuture get(RequestOptions requestOptions) { - return this.rawClient.get(requestOptions).thenApply(response -> response.body()); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public CompletableFuture get(GetScoresRequest request) { - return this.rawClient.get(request).thenApply(response -> response.body()); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public CompletableFuture get(GetScoresRequest request, - RequestOptions requestOptions) { - return this.rawClient.get(request, requestOptions).thenApply(response -> response.body()); - } - - /** - * Get a score (supports both trace and session scores) - */ - public CompletableFuture getById(String scoreId) { - return this.rawClient.getById(scoreId).thenApply(response -> response.body()); - } - - /** - * Get a score (supports both trace and session scores) - */ - public CompletableFuture getById(String scoreId, RequestOptions requestOptions) { - return this.rawClient.getById(scoreId, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/RawScoreV2Client.java b/src/main/java/com/langfuse/client/resources/scorev2/RawScoreV2Client.java deleted file mode 100644 index ead2999..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/RawScoreV2Client.java +++ /dev/null @@ -1,227 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.String; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.Score; -import com.langfuse.client.resources.scorev2.requests.GetScoresRequest; -import com.langfuse.client.resources.scorev2.types.GetScoresResponse; - -public class RawScoreV2Client { - protected final ClientOptions clientOptions; - - public RawScoreV2Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public LangfuseClientHttpResponse get() { - return get(GetScoresRequest.builder().build()); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public LangfuseClientHttpResponse get(RequestOptions requestOptions) { - return get(GetScoresRequest.builder().build(),requestOptions); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public LangfuseClientHttpResponse get(GetScoresRequest request) { - return get(request,null); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public LangfuseClientHttpResponse get(GetScoresRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public/v2") - .addPathSegments("scores");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getUserId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "userId", request.getUserId().get(), false); - } - if (request.getName().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "name", request.getName().get(), false); - } - if (request.getFromTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fromTimestamp", request.getFromTimestamp().get(), false); - } - if (request.getToTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "toTimestamp", request.getToTimestamp().get(), false); - } - if (request.getSource().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "source", request.getSource().get(), false); - } - if (request.getOperator().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "operator", request.getOperator().get(), false); - } - if (request.getValue().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "value", request.getValue().get(), false); - } - if (request.getScoreIds().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "scoreIds", request.getScoreIds().get(), false); - } - if (request.getConfigId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "configId", request.getConfigId().get(), false); - } - if (request.getSessionId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "sessionId", request.getSessionId().get(), false); - } - if (request.getDatasetRunId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "datasetRunId", request.getDatasetRunId().get(), false); - } - if (request.getTraceId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "traceId", request.getTraceId().get(), false); - } - if (request.getObservationId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "observationId", request.getObservationId().get(), false); - } - if (request.getQueueId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "queueId", request.getQueueId().get(), false); - } - if (request.getDataType().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "dataType", request.getDataType().get(), false); - } - if (request.getFields().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fields", request.getFields().get(), false); - } - if (request.getFilter().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "filter", request.getFilter().get(), false); - } - if (request.getEnvironment().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "environment", request.getEnvironment().get(), true); - } - if (request.getTraceTags().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "traceTags", request.getTraceTags().get(), true); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, GetScoresResponse.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - - /** - * Get a score (supports both trace and session scores) - */ - public LangfuseClientHttpResponse getById(String scoreId) { - return getById(scoreId,null); - } - - /** - * Get a score (supports both trace and session scores) - */ - public LangfuseClientHttpResponse getById(String scoreId, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public/v2") - .addPathSegments("scores") - .addPathSegment(scoreId);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Score.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - } diff --git a/src/main/java/com/langfuse/client/resources/scorev2/ScoreV2Client.java b/src/main/java/com/langfuse/client/resources/scorev2/ScoreV2Client.java deleted file mode 100644 index 1ac5d44..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/ScoreV2Client.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.lang.String; -import com.langfuse.client.resources.commons.types.Score; -import com.langfuse.client.resources.scorev2.requests.GetScoresRequest; -import com.langfuse.client.resources.scorev2.types.GetScoresResponse; - -public class ScoreV2Client { - protected final ClientOptions clientOptions; - - private final RawScoreV2Client rawClient; - - public ScoreV2Client(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawScoreV2Client(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawScoreV2Client withRawResponse() { - return this.rawClient; - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public GetScoresResponse get() { - return this.rawClient.get().body(); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public GetScoresResponse get(RequestOptions requestOptions) { - return this.rawClient.get(requestOptions).body(); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public GetScoresResponse get(GetScoresRequest request) { - return this.rawClient.get(request).body(); - } - - /** - * Get a list of scores (supports both trace and session scores) - */ - public GetScoresResponse get(GetScoresRequest request, RequestOptions requestOptions) { - return this.rawClient.get(request, requestOptions).body(); - } - - /** - * Get a score (supports both trace and session scores) - */ - public Score getById(String scoreId) { - return this.rawClient.getById(scoreId).body(); - } - - /** - * Get a score (supports both trace and session scores) - */ - public Score getById(String scoreId, RequestOptions requestOptions) { - return this.rawClient.getById(scoreId, requestOptions).body(); - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/requests/GetScoresRequest.java b/src/main/java/com/langfuse/client/resources/scorev2/requests/GetScoresRequest.java deleted file mode 100644 index 7b9c1e2..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/requests/GetScoresRequest.java +++ /dev/null @@ -1,766 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Double; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import com.langfuse.client.resources.commons.types.ScoreDataType; -import com.langfuse.client.resources.commons.types.ScoreSource; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetScoresRequest.Builder.class -) -public final class GetScoresRequest { - private final Optional> environment; - - private final Optional> traceTags; - - private final Optional page; - - private final Optional limit; - - private final Optional userId; - - private final Optional name; - - private final Optional fromTimestamp; - - private final Optional toTimestamp; - - private final Optional source; - - private final Optional operator; - - private final Optional value; - - private final Optional scoreIds; - - private final Optional configId; - - private final Optional sessionId; - - private final Optional datasetRunId; - - private final Optional traceId; - - private final Optional observationId; - - private final Optional queueId; - - private final Optional dataType; - - private final Optional fields; - - private final Optional filter; - - private final Map additionalProperties; - - private GetScoresRequest(Optional> environment, Optional> traceTags, - Optional page, Optional limit, Optional userId, - Optional name, Optional fromTimestamp, - Optional toTimestamp, Optional source, Optional operator, - Optional value, Optional scoreIds, Optional configId, - Optional sessionId, Optional datasetRunId, Optional traceId, - Optional observationId, Optional queueId, Optional dataType, - Optional fields, Optional filter, Map additionalProperties) { - this.environment = environment; - this.traceTags = traceTags; - this.page = page; - this.limit = limit; - this.userId = userId; - this.name = name; - this.fromTimestamp = fromTimestamp; - this.toTimestamp = toTimestamp; - this.source = source; - this.operator = operator; - this.value = value; - this.scoreIds = scoreIds; - this.configId = configId; - this.sessionId = sessionId; - this.datasetRunId = datasetRunId; - this.traceId = traceId; - this.observationId = observationId; - this.queueId = queueId; - this.dataType = dataType; - this.fields = fields; - this.filter = filter; - this.additionalProperties = additionalProperties; - } - - /** - * @return Optional filter for scores where the environment is one of the provided values. - */ - @JsonProperty("environment") - public Optional> getEnvironment() { - return environment; - } - - /** - * @return Only scores linked to traces that include all of these tags will be returned. - */ - @JsonProperty("traceTags") - public Optional> getTraceTags() { - return traceTags; - } - - /** - * @return Page number, starts at 1. - */ - @JsonProperty("page") - public Optional getPage() { - return page; - } - - /** - * @return Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit. - */ - @JsonProperty("limit") - public Optional getLimit() { - return limit; - } - - /** - * @return Retrieve only scores with this userId associated to the trace. - */ - @JsonProperty("userId") - public Optional getUserId() { - return userId; - } - - /** - * @return Retrieve only scores with this name. - */ - @JsonProperty("name") - public Optional getName() { - return name; - } - - /** - * @return Optional filter to only include scores created on or after a certain datetime (ISO 8601) - */ - @JsonProperty("fromTimestamp") - public Optional getFromTimestamp() { - return fromTimestamp; - } - - /** - * @return Optional filter to only include scores created before a certain datetime (ISO 8601) - */ - @JsonProperty("toTimestamp") - public Optional getToTimestamp() { - return toTimestamp; - } - - /** - * @return Retrieve only scores from a specific source. - */ - @JsonProperty("source") - public Optional getSource() { - return source; - } - - /** - * @return Retrieve only scores with <operator> value. - */ - @JsonProperty("operator") - public Optional getOperator() { - return operator; - } - - /** - * @return Retrieve only scores with <operator> value. - */ - @JsonProperty("value") - public Optional getValue() { - return value; - } - - /** - * @return Comma-separated list of score IDs to limit the results to. - */ - @JsonProperty("scoreIds") - public Optional getScoreIds() { - return scoreIds; - } - - /** - * @return Retrieve only scores with a specific configId. - */ - @JsonProperty("configId") - public Optional getConfigId() { - return configId; - } - - /** - * @return Retrieve only scores with a specific sessionId. - */ - @JsonProperty("sessionId") - public Optional getSessionId() { - return sessionId; - } - - /** - * @return Retrieve only scores with a specific datasetRunId. - */ - @JsonProperty("datasetRunId") - public Optional getDatasetRunId() { - return datasetRunId; - } - - /** - * @return Retrieve only scores with a specific traceId. - */ - @JsonProperty("traceId") - public Optional getTraceId() { - return traceId; - } - - /** - * @return Comma-separated list of observation IDs to filter scores by. - */ - @JsonProperty("observationId") - public Optional getObservationId() { - return observationId; - } - - /** - * @return Retrieve only scores with a specific annotation queueId. - */ - @JsonProperty("queueId") - public Optional getQueueId() { - return queueId; - } - - /** - * @return Retrieve only scores with a specific dataType. - */ - @JsonProperty("dataType") - public Optional getDataType() { - return dataType; - } - - /** - * @return Comma-separated list of field groups to include in the response. Available field groups: 'score' (core score fields), 'trace' (trace properties: userId, tags, environment). If not specified, both 'score' and 'trace' are returned by default. Example: 'score' to exclude trace data, 'score,trace' to include both. Note: When filtering by trace properties (using userId or traceTags parameters), the 'trace' field group must be included, otherwise a 400 error will be returned. - */ - @JsonProperty("fields") - public Optional getFields() { - return fields; - } - - /** - * @return A JSON stringified array of filter objects. Each object requires type, column, operator, and value. Supports filtering by score metadata using the stringObject type. Example: [{"type":"stringObject","column":"metadata","key":"user_id","operator":"=","value":"abc123"}]. Supported types: stringObject (metadata key-value filtering), string, number, datetime, stringOptions, arrayOptions. Supported operators for stringObject: =, contains, does not contain, starts with, ends with. - */ - @JsonProperty("filter") - public Optional getFilter() { - return filter; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetScoresRequest && equalTo((GetScoresRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetScoresRequest other) { - return environment.equals(other.environment) && traceTags.equals(other.traceTags) && page.equals(other.page) && limit.equals(other.limit) && userId.equals(other.userId) && name.equals(other.name) && fromTimestamp.equals(other.fromTimestamp) && toTimestamp.equals(other.toTimestamp) && source.equals(other.source) && operator.equals(other.operator) && value.equals(other.value) && scoreIds.equals(other.scoreIds) && configId.equals(other.configId) && sessionId.equals(other.sessionId) && datasetRunId.equals(other.datasetRunId) && traceId.equals(other.traceId) && observationId.equals(other.observationId) && queueId.equals(other.queueId) && dataType.equals(other.dataType) && fields.equals(other.fields) && filter.equals(other.filter); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.environment, this.traceTags, this.page, this.limit, this.userId, this.name, this.fromTimestamp, this.toTimestamp, this.source, this.operator, this.value, this.scoreIds, this.configId, this.sessionId, this.datasetRunId, this.traceId, this.observationId, this.queueId, this.dataType, this.fields, this.filter); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional> environment = Optional.empty(); - - private Optional> traceTags = Optional.empty(); - - private Optional page = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional userId = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional fromTimestamp = Optional.empty(); - - private Optional toTimestamp = Optional.empty(); - - private Optional source = Optional.empty(); - - private Optional operator = Optional.empty(); - - private Optional value = Optional.empty(); - - private Optional scoreIds = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional queueId = Optional.empty(); - - private Optional dataType = Optional.empty(); - - private Optional fields = Optional.empty(); - - private Optional filter = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(GetScoresRequest other) { - environment(other.getEnvironment()); - traceTags(other.getTraceTags()); - page(other.getPage()); - limit(other.getLimit()); - userId(other.getUserId()); - name(other.getName()); - fromTimestamp(other.getFromTimestamp()); - toTimestamp(other.getToTimestamp()); - source(other.getSource()); - operator(other.getOperator()); - value(other.getValue()); - scoreIds(other.getScoreIds()); - configId(other.getConfigId()); - sessionId(other.getSessionId()); - datasetRunId(other.getDatasetRunId()); - traceId(other.getTraceId()); - observationId(other.getObservationId()); - queueId(other.getQueueId()); - dataType(other.getDataType()); - fields(other.getFields()); - filter(other.getFilter()); - return this; - } - - /** - *

Optional filter for scores where the environment is one of the provided values.

- */ - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional> environment) { - this.environment = environment; - return this; - } - - public Builder environment(List environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.of(Collections.singletonList(environment)); - return this; - } - - /** - *

Only scores linked to traces that include all of these tags will be returned.

- */ - @JsonSetter( - value = "traceTags", - nulls = Nulls.SKIP - ) - public Builder traceTags(Optional> traceTags) { - this.traceTags = traceTags; - return this; - } - - public Builder traceTags(List traceTags) { - this.traceTags = Optional.ofNullable(traceTags); - return this; - } - - public Builder traceTags(String traceTags) { - this.traceTags = Optional.of(Collections.singletonList(traceTags)); - return this; - } - - /** - *

Page number, starts at 1.

- */ - @JsonSetter( - value = "page", - nulls = Nulls.SKIP - ) - public Builder page(Optional page) { - this.page = page; - return this; - } - - public Builder page(Integer page) { - this.page = Optional.ofNullable(page); - return this; - } - - /** - *

Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.

- */ - @JsonSetter( - value = "limit", - nulls = Nulls.SKIP - ) - public Builder limit(Optional limit) { - this.limit = limit; - return this; - } - - public Builder limit(Integer limit) { - this.limit = Optional.ofNullable(limit); - return this; - } - - /** - *

Retrieve only scores with this userId associated to the trace.

- */ - @JsonSetter( - value = "userId", - nulls = Nulls.SKIP - ) - public Builder userId(Optional userId) { - this.userId = userId; - return this; - } - - public Builder userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - /** - *

Retrieve only scores with this name.

- */ - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - /** - *

Optional filter to only include scores created on or after a certain datetime (ISO 8601)

- */ - @JsonSetter( - value = "fromTimestamp", - nulls = Nulls.SKIP - ) - public Builder fromTimestamp(Optional fromTimestamp) { - this.fromTimestamp = fromTimestamp; - return this; - } - - public Builder fromTimestamp(OffsetDateTime fromTimestamp) { - this.fromTimestamp = Optional.ofNullable(fromTimestamp); - return this; - } - - /** - *

Optional filter to only include scores created before a certain datetime (ISO 8601)

- */ - @JsonSetter( - value = "toTimestamp", - nulls = Nulls.SKIP - ) - public Builder toTimestamp(Optional toTimestamp) { - this.toTimestamp = toTimestamp; - return this; - } - - public Builder toTimestamp(OffsetDateTime toTimestamp) { - this.toTimestamp = Optional.ofNullable(toTimestamp); - return this; - } - - /** - *

Retrieve only scores from a specific source.

- */ - @JsonSetter( - value = "source", - nulls = Nulls.SKIP - ) - public Builder source(Optional source) { - this.source = source; - return this; - } - - public Builder source(ScoreSource source) { - this.source = Optional.ofNullable(source); - return this; - } - - /** - *

Retrieve only scores with <operator> value.

- */ - @JsonSetter( - value = "operator", - nulls = Nulls.SKIP - ) - public Builder operator(Optional operator) { - this.operator = operator; - return this; - } - - public Builder operator(String operator) { - this.operator = Optional.ofNullable(operator); - return this; - } - - /** - *

Retrieve only scores with <operator> value.

- */ - @JsonSetter( - value = "value", - nulls = Nulls.SKIP - ) - public Builder value(Optional value) { - this.value = value; - return this; - } - - public Builder value(Double value) { - this.value = Optional.ofNullable(value); - return this; - } - - /** - *

Comma-separated list of score IDs to limit the results to.

- */ - @JsonSetter( - value = "scoreIds", - nulls = Nulls.SKIP - ) - public Builder scoreIds(Optional scoreIds) { - this.scoreIds = scoreIds; - return this; - } - - public Builder scoreIds(String scoreIds) { - this.scoreIds = Optional.ofNullable(scoreIds); - return this; - } - - /** - *

Retrieve only scores with a specific configId.

- */ - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public Builder configId(Optional configId) { - this.configId = configId; - return this; - } - - public Builder configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Retrieve only scores with a specific sessionId.

- */ - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public Builder sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - public Builder sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

Retrieve only scores with a specific datasetRunId.

- */ - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public Builder datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - public Builder datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

Retrieve only scores with a specific traceId.

- */ - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public Builder traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - public Builder traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

Comma-separated list of observation IDs to filter scores by.

- */ - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public Builder observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - public Builder observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

Retrieve only scores with a specific annotation queueId.

- */ - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public Builder queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - public Builder queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

Retrieve only scores with a specific dataType.

- */ - @JsonSetter( - value = "dataType", - nulls = Nulls.SKIP - ) - public Builder dataType(Optional dataType) { - this.dataType = dataType; - return this; - } - - public Builder dataType(ScoreDataType dataType) { - this.dataType = Optional.ofNullable(dataType); - return this; - } - - /** - *

Comma-separated list of field groups to include in the response. Available field groups: 'score' (core score fields), 'trace' (trace properties: userId, tags, environment). If not specified, both 'score' and 'trace' are returned by default. Example: 'score' to exclude trace data, 'score,trace' to include both. Note: When filtering by trace properties (using userId or traceTags parameters), the 'trace' field group must be included, otherwise a 400 error will be returned.

- */ - @JsonSetter( - value = "fields", - nulls = Nulls.SKIP - ) - public Builder fields(Optional fields) { - this.fields = fields; - return this; - } - - public Builder fields(String fields) { - this.fields = Optional.ofNullable(fields); - return this; - } - - /** - *

A JSON stringified array of filter objects. Each object requires type, column, operator, and value. Supports filtering by score metadata using the stringObject type. Example: [{"type":"stringObject","column":"metadata","key":"user_id","operator":"=","value":"abc123"}]. Supported types: stringObject (metadata key-value filtering), string, number, datetime, stringOptions, arrayOptions. Supported operators for stringObject: =, contains, does not contain, starts with, ends with.

- */ - @JsonSetter( - value = "filter", - nulls = Nulls.SKIP - ) - public Builder filter(Optional filter) { - this.filter = filter; - return this; - } - - public Builder filter(String filter) { - this.filter = Optional.ofNullable(filter); - return this; - } - - public GetScoresRequest build() { - return new GetScoresRequest(environment, traceTags, page, limit, userId, name, fromTimestamp, toTimestamp, source, operator, value, scoreIds, configId, sessionId, datasetRunId, traceId, observationId, queueId, dataType, fields, filter, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponse.java b/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponse.java deleted file mode 100644 index 8fc0613..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponse.java +++ /dev/null @@ -1,175 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.utils.pagination.types.MetaResponse; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetScoresResponse.Builder.class -) -public final class GetScoresResponse { - private final List data; - - private final MetaResponse meta; - - private final Map additionalProperties; - - private GetScoresResponse(List data, MetaResponse meta, - Map additionalProperties) { - this.data = data; - this.meta = meta; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public List getData() { - return data; - } - - @JsonProperty("meta") - public MetaResponse getMeta() { - return meta; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetScoresResponse && equalTo((GetScoresResponse) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetScoresResponse other) { - return data.equals(other.data) && meta.equals(other.meta); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.data, this.meta); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetaStage builder() { - return new Builder(); - } - - public interface MetaStage { - _FinalStage meta(@NotNull MetaResponse meta); - - Builder from(GetScoresResponse other); - } - - public interface _FinalStage { - GetScoresResponse build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage data(List data); - - _FinalStage addData(GetScoresResponseData data); - - _FinalStage addAllData(List data); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements MetaStage, _FinalStage { - private MetaResponse meta; - - private List data = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(GetScoresResponse other) { - data(other.getData()); - meta(other.getMeta()); - return this; - } - - @java.lang.Override - @JsonSetter("meta") - public _FinalStage meta(@NotNull MetaResponse meta) { - this.meta = Objects.requireNonNull(meta, "meta must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllData(List data) { - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public _FinalStage addData(GetScoresResponseData data) { - this.data.add(data); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "data", - nulls = Nulls.SKIP - ) - public _FinalStage data(List data) { - this.data.clear(); - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public GetScoresResponse build() { - return new GetScoresResponse(data, meta, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseData.java b/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseData.java deleted file mode 100644 index bc41e5c..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseData.java +++ /dev/null @@ -1,347 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2.types; - -import com.fasterxml.jackson.annotation.JsonCreator; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSubTypes; -import com.fasterxml.jackson.annotation.JsonTypeInfo; -import com.fasterxml.jackson.annotation.JsonTypeName; -import com.fasterxml.jackson.annotation.JsonUnwrapped; -import com.fasterxml.jackson.annotation.JsonValue; -import java.lang.Object; -import java.lang.String; -import java.util.Objects; -import java.util.Optional; - -public final class GetScoresResponseData { - private final Value value; - - @JsonCreator( - mode = JsonCreator.Mode.DELEGATING - ) - private GetScoresResponseData(Value value) { - this.value = value; - } - - public T visit(Visitor visitor) { - return value.visit(visitor); - } - - public static GetScoresResponseData numeric(GetScoresResponseDataNumeric value) { - return new GetScoresResponseData(new NumericValue(value)); - } - - public static GetScoresResponseData categorical(GetScoresResponseDataCategorical value) { - return new GetScoresResponseData(new CategoricalValue(value)); - } - - public static GetScoresResponseData boolean_(GetScoresResponseDataBoolean value) { - return new GetScoresResponseData(new BooleanValue(value)); - } - - public static GetScoresResponseData correction(GetScoresResponseDataCorrection value) { - return new GetScoresResponseData(new CorrectionValue(value)); - } - - public boolean isNumeric() { - return value instanceof NumericValue; - } - - public boolean isCategorical() { - return value instanceof CategoricalValue; - } - - public boolean isBoolean() { - return value instanceof BooleanValue; - } - - public boolean isCorrection() { - return value instanceof CorrectionValue; - } - - public boolean _isUnknown() { - return value instanceof _UnknownValue; - } - - public Optional getNumeric() { - if (isNumeric()) { - return Optional.of(((NumericValue) value).value); - } - return Optional.empty(); - } - - public Optional getCategorical() { - if (isCategorical()) { - return Optional.of(((CategoricalValue) value).value); - } - return Optional.empty(); - } - - public Optional getBoolean() { - if (isBoolean()) { - return Optional.of(((BooleanValue) value).value); - } - return Optional.empty(); - } - - public Optional getCorrection() { - if (isCorrection()) { - return Optional.of(((CorrectionValue) value).value); - } - return Optional.empty(); - } - - public Optional _getUnknown() { - if (_isUnknown()) { - return Optional.of(((_UnknownValue) value).value); - } - return Optional.empty(); - } - - @JsonValue - private Value getValue() { - return this.value; - } - - public interface Visitor { - T visitNumeric(GetScoresResponseDataNumeric numeric); - - T visitCategorical(GetScoresResponseDataCategorical categorical); - - T visitBoolean(GetScoresResponseDataBoolean boolean_); - - T visitCorrection(GetScoresResponseDataCorrection correction); - - T _visitUnknown(Object unknownType); - } - - @JsonTypeInfo( - use = JsonTypeInfo.Id.NAME, - property = "dataType", - visible = true, - defaultImpl = _UnknownValue.class - ) - @JsonSubTypes({ - @JsonSubTypes.Type(NumericValue.class), - @JsonSubTypes.Type(CategoricalValue.class), - @JsonSubTypes.Type(BooleanValue.class), - @JsonSubTypes.Type(CorrectionValue.class) - }) - @JsonIgnoreProperties( - ignoreUnknown = true - ) - private interface Value { - T visit(Visitor visitor); - } - - @JsonTypeName("NUMERIC") - @JsonIgnoreProperties("dataType") - private static final class NumericValue implements Value { - @JsonUnwrapped - private GetScoresResponseDataNumeric value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private NumericValue() { - } - - private NumericValue(GetScoresResponseDataNumeric value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitNumeric(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof NumericValue && equalTo((NumericValue) other); - } - - private boolean equalTo(NumericValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "GetScoresResponseData{" + "value: " + value + "}"; - } - } - - @JsonTypeName("CATEGORICAL") - @JsonIgnoreProperties("dataType") - private static final class CategoricalValue implements Value { - @JsonUnwrapped - private GetScoresResponseDataCategorical value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private CategoricalValue() { - } - - private CategoricalValue(GetScoresResponseDataCategorical value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitCategorical(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CategoricalValue && equalTo((CategoricalValue) other); - } - - private boolean equalTo(CategoricalValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "GetScoresResponseData{" + "value: " + value + "}"; - } - } - - @JsonTypeName("BOOLEAN") - @JsonIgnoreProperties("dataType") - private static final class BooleanValue implements Value { - @JsonUnwrapped - private GetScoresResponseDataBoolean value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private BooleanValue() { - } - - private BooleanValue(GetScoresResponseDataBoolean value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitBoolean(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof BooleanValue && equalTo((BooleanValue) other); - } - - private boolean equalTo(BooleanValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "GetScoresResponseData{" + "value: " + value + "}"; - } - } - - @JsonTypeName("CORRECTION") - @JsonIgnoreProperties("dataType") - private static final class CorrectionValue implements Value { - @JsonUnwrapped - private GetScoresResponseDataCorrection value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private CorrectionValue() { - } - - private CorrectionValue(GetScoresResponseDataCorrection value) { - this.value = value; - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor.visitCorrection(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof CorrectionValue && equalTo((CorrectionValue) other); - } - - private boolean equalTo(CorrectionValue other) { - return value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value); - } - - @java.lang.Override - public String toString() { - return "GetScoresResponseData{" + "value: " + value + "}"; - } - } - - @JsonIgnoreProperties("dataType") - private static final class _UnknownValue implements Value { - private String type; - - @JsonValue - private Object value; - - @JsonCreator( - mode = JsonCreator.Mode.PROPERTIES - ) - private _UnknownValue(@JsonProperty("value") Object value) { - } - - @java.lang.Override - public T visit(Visitor visitor) { - return visitor._visitUnknown(value); - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof _UnknownValue && equalTo((_UnknownValue) other); - } - - private boolean equalTo(_UnknownValue other) { - return type.equals(other.type) && value.equals(other.value); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.type, this.value); - } - - @java.lang.Override - public String toString() { - return "GetScoresResponseData{" + "type: " + type + ", value: " + value + "}"; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataBoolean.java b/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataBoolean.java deleted file mode 100644 index 69ae823..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataBoolean.java +++ /dev/null @@ -1,1040 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.IBaseScore; -import com.langfuse.client.resources.commons.types.IBooleanScore; -import com.langfuse.client.resources.commons.types.ScoreSource; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetScoresResponseDataBoolean.Builder.class -) -public final class GetScoresResponseDataBoolean implements IBooleanScore, IBaseScore { - private final double value; - - private final String stringValue; - - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Optional trace; - - private final Map additionalProperties; - - private GetScoresResponseDataBoolean(double value, String stringValue, String id, - Optional traceId, Optional sessionId, Optional observationId, - Optional datasetRunId, String name, ScoreSource source, OffsetDateTime timestamp, - OffsetDateTime createdAt, OffsetDateTime updatedAt, Optional authorUserId, - Optional comment, Object metadata, Optional configId, - Optional queueId, String environment, Optional trace, - Map additionalProperties) { - this.value = value; - this.stringValue = stringValue; - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.trace = trace; - this.additionalProperties = additionalProperties; - } - - /** - * @return The numeric value of the score. Equals 1 for "True" and 0 for "False" - */ - @JsonProperty("value") - @java.lang.Override - public double getValue() { - return value; - } - - /** - * @return The string representation of the score value. Is inferred from the numeric value and equals "True" or "False" - */ - @JsonProperty("stringValue") - @java.lang.Override - public String getStringValue() { - return stringValue; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonProperty("trace") - public Optional getTrace() { - return trace; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetScoresResponseDataBoolean && equalTo((GetScoresResponseDataBoolean) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetScoresResponseDataBoolean other) { - return value == other.value && stringValue.equals(other.stringValue) && id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment) && trace.equals(other.trace); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value, this.stringValue, this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment, this.trace); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - /** - *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- */ - StringValueStage value(double value); - - Builder from(GetScoresResponseDataBoolean other); - } - - public interface StringValueStage { - /** - *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- */ - IdStage stringValue(@NotNull String stringValue); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - GetScoresResponseDataBoolean build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - - _FinalStage trace(Optional trace); - - _FinalStage trace(GetScoresResponseTraceData trace); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements ValueStage, StringValueStage, IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private double value; - - private String stringValue; - - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional trace = Optional.empty(); - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(GetScoresResponseDataBoolean other) { - value(other.getValue()); - stringValue(other.getStringValue()); - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - trace(other.getTrace()); - return this; - } - - /** - *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- *

The numeric value of the score. Equals 1 for "True" and 0 for "False"

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public StringValueStage value(double value) { - this.value = value; - return this; - } - - /** - *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- *

The string representation of the score value. Is inferred from the numeric value and equals "True" or "False"

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("stringValue") - public IdStage stringValue(@NotNull String stringValue) { - this.stringValue = Objects.requireNonNull(stringValue, "stringValue must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage trace(GetScoresResponseTraceData trace) { - this.trace = Optional.ofNullable(trace); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "trace", - nulls = Nulls.SKIP - ) - public _FinalStage trace(Optional trace) { - this.trace = trace; - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public GetScoresResponseDataBoolean build() { - return new GetScoresResponseDataBoolean(value, stringValue, id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, trace, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataCategorical.java b/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataCategorical.java deleted file mode 100644 index ea0b83a..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataCategorical.java +++ /dev/null @@ -1,1040 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.IBaseScore; -import com.langfuse.client.resources.commons.types.ICategoricalScore; -import com.langfuse.client.resources.commons.types.ScoreSource; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetScoresResponseDataCategorical.Builder.class -) -public final class GetScoresResponseDataCategorical implements ICategoricalScore, IBaseScore { - private final double value; - - private final String stringValue; - - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Optional trace; - - private final Map additionalProperties; - - private GetScoresResponseDataCategorical(double value, String stringValue, String id, - Optional traceId, Optional sessionId, Optional observationId, - Optional datasetRunId, String name, ScoreSource source, OffsetDateTime timestamp, - OffsetDateTime createdAt, OffsetDateTime updatedAt, Optional authorUserId, - Optional comment, Object metadata, Optional configId, - Optional queueId, String environment, Optional trace, - Map additionalProperties) { - this.value = value; - this.stringValue = stringValue; - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.trace = trace; - this.additionalProperties = additionalProperties; - } - - /** - * @return Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0. - */ - @JsonProperty("value") - @java.lang.Override - public double getValue() { - return value; - } - - /** - * @return The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category - */ - @JsonProperty("stringValue") - @java.lang.Override - public String getStringValue() { - return stringValue; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonProperty("trace") - public Optional getTrace() { - return trace; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetScoresResponseDataCategorical && equalTo((GetScoresResponseDataCategorical) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetScoresResponseDataCategorical other) { - return value == other.value && stringValue.equals(other.stringValue) && id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment) && trace.equals(other.trace); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value, this.stringValue, this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment, this.trace); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - /** - *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- */ - StringValueStage value(double value); - - Builder from(GetScoresResponseDataCategorical other); - } - - public interface StringValueStage { - /** - *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- */ - IdStage stringValue(@NotNull String stringValue); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - GetScoresResponseDataCategorical build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - - _FinalStage trace(Optional trace); - - _FinalStage trace(GetScoresResponseTraceData trace); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements ValueStage, StringValueStage, IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private double value; - - private String stringValue; - - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional trace = Optional.empty(); - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(GetScoresResponseDataCategorical other) { - value(other.getValue()); - stringValue(other.getStringValue()); - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - trace(other.getTrace()); - return this; - } - - /** - *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- *

Represents the numeric category mapping of the stringValue. If no config is linked, defaults to 0.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public StringValueStage value(double value) { - this.value = value; - return this; - } - - /** - *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- *

The string representation of the score value. If no config is linked, can be any string. Otherwise, must map to a config category

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("stringValue") - public IdStage stringValue(@NotNull String stringValue) { - this.stringValue = Objects.requireNonNull(stringValue, "stringValue must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage trace(GetScoresResponseTraceData trace) { - this.trace = Optional.ofNullable(trace); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "trace", - nulls = Nulls.SKIP - ) - public _FinalStage trace(Optional trace) { - this.trace = trace; - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public GetScoresResponseDataCategorical build() { - return new GetScoresResponseDataCategorical(value, stringValue, id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, trace, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataCorrection.java b/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataCorrection.java deleted file mode 100644 index b3cf42b..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataCorrection.java +++ /dev/null @@ -1,1040 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.IBaseScore; -import com.langfuse.client.resources.commons.types.ICorrectionScore; -import com.langfuse.client.resources.commons.types.ScoreSource; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetScoresResponseDataCorrection.Builder.class -) -public final class GetScoresResponseDataCorrection implements ICorrectionScore, IBaseScore { - private final double value; - - private final String stringValue; - - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Optional trace; - - private final Map additionalProperties; - - private GetScoresResponseDataCorrection(double value, String stringValue, String id, - Optional traceId, Optional sessionId, Optional observationId, - Optional datasetRunId, String name, ScoreSource source, OffsetDateTime timestamp, - OffsetDateTime createdAt, OffsetDateTime updatedAt, Optional authorUserId, - Optional comment, Object metadata, Optional configId, - Optional queueId, String environment, Optional trace, - Map additionalProperties) { - this.value = value; - this.stringValue = stringValue; - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.trace = trace; - this.additionalProperties = additionalProperties; - } - - /** - * @return The numeric value of the score. Always 0 for correction scores. - */ - @JsonProperty("value") - @java.lang.Override - public double getValue() { - return value; - } - - /** - * @return The string representation of the correction content - */ - @JsonProperty("stringValue") - @java.lang.Override - public String getStringValue() { - return stringValue; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonProperty("trace") - public Optional getTrace() { - return trace; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetScoresResponseDataCorrection && equalTo((GetScoresResponseDataCorrection) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetScoresResponseDataCorrection other) { - return value == other.value && stringValue.equals(other.stringValue) && id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment) && trace.equals(other.trace); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value, this.stringValue, this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment, this.trace); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - /** - *

The numeric value of the score. Always 0 for correction scores.

- */ - StringValueStage value(double value); - - Builder from(GetScoresResponseDataCorrection other); - } - - public interface StringValueStage { - /** - *

The string representation of the correction content

- */ - IdStage stringValue(@NotNull String stringValue); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - GetScoresResponseDataCorrection build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - - _FinalStage trace(Optional trace); - - _FinalStage trace(GetScoresResponseTraceData trace); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements ValueStage, StringValueStage, IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private double value; - - private String stringValue; - - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional trace = Optional.empty(); - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(GetScoresResponseDataCorrection other) { - value(other.getValue()); - stringValue(other.getStringValue()); - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - trace(other.getTrace()); - return this; - } - - /** - *

The numeric value of the score. Always 0 for correction scores.

- *

The numeric value of the score. Always 0 for correction scores.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public StringValueStage value(double value) { - this.value = value; - return this; - } - - /** - *

The string representation of the correction content

- *

The string representation of the correction content

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("stringValue") - public IdStage stringValue(@NotNull String stringValue) { - this.stringValue = Objects.requireNonNull(stringValue, "stringValue must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage trace(GetScoresResponseTraceData trace) { - this.trace = Optional.ofNullable(trace); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "trace", - nulls = Nulls.SKIP - ) - public _FinalStage trace(Optional trace) { - this.trace = trace; - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public GetScoresResponseDataCorrection build() { - return new GetScoresResponseDataCorrection(value, stringValue, id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, trace, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataNumeric.java b/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataNumeric.java deleted file mode 100644 index d947598..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseDataNumeric.java +++ /dev/null @@ -1,1005 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.Nullable; -import com.langfuse.client.core.NullableNonemptyFilter; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.IBaseScore; -import com.langfuse.client.resources.commons.types.INumericScore; -import com.langfuse.client.resources.commons.types.ScoreSource; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetScoresResponseDataNumeric.Builder.class -) -public final class GetScoresResponseDataNumeric implements INumericScore, IBaseScore { - private final double value; - - private final String id; - - private final Optional traceId; - - private final Optional sessionId; - - private final Optional observationId; - - private final Optional datasetRunId; - - private final String name; - - private final ScoreSource source; - - private final OffsetDateTime timestamp; - - private final OffsetDateTime createdAt; - - private final OffsetDateTime updatedAt; - - private final Optional authorUserId; - - private final Optional comment; - - private final Object metadata; - - private final Optional configId; - - private final Optional queueId; - - private final String environment; - - private final Optional trace; - - private final Map additionalProperties; - - private GetScoresResponseDataNumeric(double value, String id, Optional traceId, - Optional sessionId, Optional observationId, Optional datasetRunId, - String name, ScoreSource source, OffsetDateTime timestamp, OffsetDateTime createdAt, - OffsetDateTime updatedAt, Optional authorUserId, Optional comment, - Object metadata, Optional configId, Optional queueId, String environment, - Optional trace, Map additionalProperties) { - this.value = value; - this.id = id; - this.traceId = traceId; - this.sessionId = sessionId; - this.observationId = observationId; - this.datasetRunId = datasetRunId; - this.name = name; - this.source = source; - this.timestamp = timestamp; - this.createdAt = createdAt; - this.updatedAt = updatedAt; - this.authorUserId = authorUserId; - this.comment = comment; - this.metadata = metadata; - this.configId = configId; - this.queueId = queueId; - this.environment = environment; - this.trace = trace; - this.additionalProperties = additionalProperties; - } - - /** - * @return The numeric value of the score - */ - @JsonProperty("value") - @java.lang.Override - public double getValue() { - return value; - } - - @JsonProperty("id") - @java.lang.Override - public String getId() { - return id; - } - - /** - * @return The trace ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getTraceId() { - if (traceId == null) { - return Optional.empty(); - } - return traceId; - } - - /** - * @return The session ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getSessionId() { - if (sessionId == null) { - return Optional.empty(); - } - return sessionId; - } - - /** - * @return The observation ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getObservationId() { - if (observationId == null) { - return Optional.empty(); - } - return observationId; - } - - /** - * @return The dataset run ID associated with the score - */ - @JsonIgnore - @java.lang.Override - public Optional getDatasetRunId() { - if (datasetRunId == null) { - return Optional.empty(); - } - return datasetRunId; - } - - @JsonProperty("name") - @java.lang.Override - public String getName() { - return name; - } - - @JsonProperty("source") - @java.lang.Override - public ScoreSource getSource() { - return source; - } - - @JsonProperty("timestamp") - @java.lang.Override - public OffsetDateTime getTimestamp() { - return timestamp; - } - - @JsonProperty("createdAt") - @java.lang.Override - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - @JsonProperty("updatedAt") - @java.lang.Override - public OffsetDateTime getUpdatedAt() { - return updatedAt; - } - - /** - * @return The user ID of the author - */ - @JsonIgnore - @java.lang.Override - public Optional getAuthorUserId() { - if (authorUserId == null) { - return Optional.empty(); - } - return authorUserId; - } - - /** - * @return Comment on the score - */ - @JsonIgnore - @java.lang.Override - public Optional getComment() { - if (comment == null) { - return Optional.empty(); - } - return comment; - } - - /** - * @return Metadata associated with the score - */ - @JsonProperty("metadata") - @java.lang.Override - public Object getMetadata() { - return metadata; - } - - /** - * @return Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range - */ - @JsonIgnore - @java.lang.Override - public Optional getConfigId() { - if (configId == null) { - return Optional.empty(); - } - return configId; - } - - /** - * @return The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue. - */ - @JsonIgnore - @java.lang.Override - public Optional getQueueId() { - if (queueId == null) { - return Optional.empty(); - } - return queueId; - } - - /** - * @return The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'. - */ - @JsonProperty("environment") - @java.lang.Override - public String getEnvironment() { - return environment; - } - - @JsonProperty("trace") - public Optional getTrace() { - return trace; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("traceId") - private Optional _getTraceId() { - return traceId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("sessionId") - private Optional _getSessionId() { - return sessionId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("observationId") - private Optional _getObservationId() { - return observationId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("datasetRunId") - private Optional _getDatasetRunId() { - return datasetRunId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("authorUserId") - private Optional _getAuthorUserId() { - return authorUserId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("comment") - private Optional _getComment() { - return comment; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("configId") - private Optional _getConfigId() { - return configId; - } - - @JsonInclude( - value = JsonInclude.Include.CUSTOM, - valueFilter = NullableNonemptyFilter.class - ) - @JsonProperty("queueId") - private Optional _getQueueId() { - return queueId; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetScoresResponseDataNumeric && equalTo((GetScoresResponseDataNumeric) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetScoresResponseDataNumeric other) { - return value == other.value && id.equals(other.id) && traceId.equals(other.traceId) && sessionId.equals(other.sessionId) && observationId.equals(other.observationId) && datasetRunId.equals(other.datasetRunId) && name.equals(other.name) && source.equals(other.source) && timestamp.equals(other.timestamp) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt) && authorUserId.equals(other.authorUserId) && comment.equals(other.comment) && metadata.equals(other.metadata) && configId.equals(other.configId) && queueId.equals(other.queueId) && environment.equals(other.environment) && trace.equals(other.trace); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.value, this.id, this.traceId, this.sessionId, this.observationId, this.datasetRunId, this.name, this.source, this.timestamp, this.createdAt, this.updatedAt, this.authorUserId, this.comment, this.metadata, this.configId, this.queueId, this.environment, this.trace); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static ValueStage builder() { - return new Builder(); - } - - public interface ValueStage { - /** - *

The numeric value of the score

- */ - IdStage value(double value); - - Builder from(GetScoresResponseDataNumeric other); - } - - public interface IdStage { - NameStage id(@NotNull String id); - } - - public interface NameStage { - SourceStage name(@NotNull String name); - } - - public interface SourceStage { - TimestampStage source(@NotNull ScoreSource source); - } - - public interface TimestampStage { - CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp); - } - - public interface CreatedAtStage { - UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt); - } - - public interface UpdatedAtStage { - MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt); - } - - public interface MetadataStage { - /** - *

Metadata associated with the score

- */ - EnvironmentStage metadata(Object metadata); - } - - public interface EnvironmentStage { - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- */ - _FinalStage environment(@NotNull String environment); - } - - public interface _FinalStage { - GetScoresResponseDataNumeric build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - /** - *

The trace ID associated with the score

- */ - _FinalStage traceId(Optional traceId); - - _FinalStage traceId(String traceId); - - _FinalStage traceId(Nullable traceId); - - /** - *

The session ID associated with the score

- */ - _FinalStage sessionId(Optional sessionId); - - _FinalStage sessionId(String sessionId); - - _FinalStage sessionId(Nullable sessionId); - - /** - *

The observation ID associated with the score

- */ - _FinalStage observationId(Optional observationId); - - _FinalStage observationId(String observationId); - - _FinalStage observationId(Nullable observationId); - - /** - *

The dataset run ID associated with the score

- */ - _FinalStage datasetRunId(Optional datasetRunId); - - _FinalStage datasetRunId(String datasetRunId); - - _FinalStage datasetRunId(Nullable datasetRunId); - - /** - *

The user ID of the author

- */ - _FinalStage authorUserId(Optional authorUserId); - - _FinalStage authorUserId(String authorUserId); - - _FinalStage authorUserId(Nullable authorUserId); - - /** - *

Comment on the score

- */ - _FinalStage comment(Optional comment); - - _FinalStage comment(String comment); - - _FinalStage comment(Nullable comment); - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - _FinalStage configId(Optional configId); - - _FinalStage configId(String configId); - - _FinalStage configId(Nullable configId); - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - _FinalStage queueId(Optional queueId); - - _FinalStage queueId(String queueId); - - _FinalStage queueId(Nullable queueId); - - _FinalStage trace(Optional trace); - - _FinalStage trace(GetScoresResponseTraceData trace); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements ValueStage, IdStage, NameStage, SourceStage, TimestampStage, CreatedAtStage, UpdatedAtStage, MetadataStage, EnvironmentStage, _FinalStage { - private double value; - - private String id; - - private String name; - - private ScoreSource source; - - private OffsetDateTime timestamp; - - private OffsetDateTime createdAt; - - private OffsetDateTime updatedAt; - - private Object metadata; - - private String environment; - - private Optional trace = Optional.empty(); - - private Optional queueId = Optional.empty(); - - private Optional configId = Optional.empty(); - - private Optional comment = Optional.empty(); - - private Optional authorUserId = Optional.empty(); - - private Optional datasetRunId = Optional.empty(); - - private Optional observationId = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional traceId = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(GetScoresResponseDataNumeric other) { - value(other.getValue()); - id(other.getId()); - traceId(other.getTraceId()); - sessionId(other.getSessionId()); - observationId(other.getObservationId()); - datasetRunId(other.getDatasetRunId()); - name(other.getName()); - source(other.getSource()); - timestamp(other.getTimestamp()); - createdAt(other.getCreatedAt()); - updatedAt(other.getUpdatedAt()); - authorUserId(other.getAuthorUserId()); - comment(other.getComment()); - metadata(other.getMetadata()); - configId(other.getConfigId()); - queueId(other.getQueueId()); - environment(other.getEnvironment()); - trace(other.getTrace()); - return this; - } - - /** - *

The numeric value of the score

- *

The numeric value of the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("value") - public IdStage value(double value) { - this.value = value; - return this; - } - - @java.lang.Override - @JsonSetter("id") - public NameStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("name") - public SourceStage name(@NotNull String name) { - this.name = Objects.requireNonNull(name, "name must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("source") - public TimestampStage source(@NotNull ScoreSource source) { - this.source = Objects.requireNonNull(source, "source must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("timestamp") - public CreatedAtStage timestamp(@NotNull OffsetDateTime timestamp) { - this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("createdAt") - public UpdatedAtStage createdAt(@NotNull OffsetDateTime createdAt) { - this.createdAt = Objects.requireNonNull(createdAt, "createdAt must not be null"); - return this; - } - - @java.lang.Override - @JsonSetter("updatedAt") - public MetadataStage updatedAt(@NotNull OffsetDateTime updatedAt) { - this.updatedAt = Objects.requireNonNull(updatedAt, "updatedAt must not be null"); - return this; - } - - /** - *

Metadata associated with the score

- *

Metadata associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("metadata") - public EnvironmentStage metadata(Object metadata) { - this.metadata = metadata; - return this; - } - - /** - *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- *

The environment from which this score originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - @JsonSetter("environment") - public _FinalStage environment(@NotNull String environment) { - this.environment = Objects.requireNonNull(environment, "environment must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage trace(GetScoresResponseTraceData trace) { - this.trace = Optional.ofNullable(trace); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "trace", - nulls = Nulls.SKIP - ) - public _FinalStage trace(Optional trace) { - this.trace = trace; - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(Nullable queueId) { - if (queueId.isNull()) { - this.queueId = null; - } - else if (queueId.isEmpty()) { - this.queueId = Optional.empty(); - } - else { - this.queueId = Optional.of(queueId.get()); - } - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage queueId(String queueId) { - this.queueId = Optional.ofNullable(queueId); - return this; - } - - /** - *

The annotation queue referenced by the score. Indicates if score was initially created while processing annotation queue.

- */ - @java.lang.Override - @JsonSetter( - value = "queueId", - nulls = Nulls.SKIP - ) - public _FinalStage queueId(Optional queueId) { - this.queueId = queueId; - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(Nullable configId) { - if (configId.isNull()) { - this.configId = null; - } - else if (configId.isEmpty()) { - this.configId = Optional.empty(); - } - else { - this.configId = Optional.of(configId.get()); - } - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage configId(String configId) { - this.configId = Optional.ofNullable(configId); - return this; - } - - /** - *

Reference a score config on a score. When set, config and score name must be equal and value must comply to optionally defined numerical range

- */ - @java.lang.Override - @JsonSetter( - value = "configId", - nulls = Nulls.SKIP - ) - public _FinalStage configId(Optional configId) { - this.configId = configId; - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(Nullable comment) { - if (comment.isNull()) { - this.comment = null; - } - else if (comment.isEmpty()) { - this.comment = Optional.empty(); - } - else { - this.comment = Optional.of(comment.get()); - } - return this; - } - - /** - *

Comment on the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage comment(String comment) { - this.comment = Optional.ofNullable(comment); - return this; - } - - /** - *

Comment on the score

- */ - @java.lang.Override - @JsonSetter( - value = "comment", - nulls = Nulls.SKIP - ) - public _FinalStage comment(Optional comment) { - this.comment = comment; - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(Nullable authorUserId) { - if (authorUserId.isNull()) { - this.authorUserId = null; - } - else if (authorUserId.isEmpty()) { - this.authorUserId = Optional.empty(); - } - else { - this.authorUserId = Optional.of(authorUserId.get()); - } - return this; - } - - /** - *

The user ID of the author

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage authorUserId(String authorUserId) { - this.authorUserId = Optional.ofNullable(authorUserId); - return this; - } - - /** - *

The user ID of the author

- */ - @java.lang.Override - @JsonSetter( - value = "authorUserId", - nulls = Nulls.SKIP - ) - public _FinalStage authorUserId(Optional authorUserId) { - this.authorUserId = authorUserId; - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(Nullable datasetRunId) { - if (datasetRunId.isNull()) { - this.datasetRunId = null; - } - else if (datasetRunId.isEmpty()) { - this.datasetRunId = Optional.empty(); - } - else { - this.datasetRunId = Optional.of(datasetRunId.get()); - } - return this; - } - - /** - *

The dataset run ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage datasetRunId(String datasetRunId) { - this.datasetRunId = Optional.ofNullable(datasetRunId); - return this; - } - - /** - *

The dataset run ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "datasetRunId", - nulls = Nulls.SKIP - ) - public _FinalStage datasetRunId(Optional datasetRunId) { - this.datasetRunId = datasetRunId; - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(Nullable observationId) { - if (observationId.isNull()) { - this.observationId = null; - } - else if (observationId.isEmpty()) { - this.observationId = Optional.empty(); - } - else { - this.observationId = Optional.of(observationId.get()); - } - return this; - } - - /** - *

The observation ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage observationId(String observationId) { - this.observationId = Optional.ofNullable(observationId); - return this; - } - - /** - *

The observation ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "observationId", - nulls = Nulls.SKIP - ) - public _FinalStage observationId(Optional observationId) { - this.observationId = observationId; - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(Nullable sessionId) { - if (sessionId.isNull()) { - this.sessionId = null; - } - else if (sessionId.isEmpty()) { - this.sessionId = Optional.empty(); - } - else { - this.sessionId = Optional.of(sessionId.get()); - } - return this; - } - - /** - *

The session ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

The session ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public _FinalStage sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(Nullable traceId) { - if (traceId.isNull()) { - this.traceId = null; - } - else if (traceId.isEmpty()) { - this.traceId = Optional.empty(); - } - else { - this.traceId = Optional.of(traceId.get()); - } - return this; - } - - /** - *

The trace ID associated with the score

- * @return Reference to {@code this} so that method calls can be chained together. - */ - @java.lang.Override - public _FinalStage traceId(String traceId) { - this.traceId = Optional.ofNullable(traceId); - return this; - } - - /** - *

The trace ID associated with the score

- */ - @java.lang.Override - @JsonSetter( - value = "traceId", - nulls = Nulls.SKIP - ) - public _FinalStage traceId(Optional traceId) { - this.traceId = traceId; - return this; - } - - @java.lang.Override - public GetScoresResponseDataNumeric build() { - return new GetScoresResponseDataNumeric(value, id, traceId, sessionId, observationId, datasetRunId, name, source, timestamp, createdAt, updatedAt, authorUserId, comment, metadata, configId, queueId, environment, trace, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseTraceData.java b/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseTraceData.java deleted file mode 100644 index 63d3651..0000000 --- a/src/main/java/com/langfuse/client/resources/scorev2/types/GetScoresResponseTraceData.java +++ /dev/null @@ -1,186 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.scorev2.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetScoresResponseTraceData.Builder.class -) -public final class GetScoresResponseTraceData { - private final Optional userId; - - private final Optional> tags; - - private final Optional environment; - - private final Map additionalProperties; - - private GetScoresResponseTraceData(Optional userId, Optional> tags, - Optional environment, Map additionalProperties) { - this.userId = userId; - this.tags = tags; - this.environment = environment; - this.additionalProperties = additionalProperties; - } - - /** - * @return The user ID associated with the trace referenced by score - */ - @JsonProperty("userId") - public Optional getUserId() { - return userId; - } - - /** - * @return A list of tags associated with the trace referenced by score - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return The environment of the trace referenced by score - */ - @JsonProperty("environment") - public Optional getEnvironment() { - return environment; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetScoresResponseTraceData && equalTo((GetScoresResponseTraceData) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetScoresResponseTraceData other) { - return userId.equals(other.userId) && tags.equals(other.tags) && environment.equals(other.environment); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.userId, this.tags, this.environment); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional userId = Optional.empty(); - - private Optional> tags = Optional.empty(); - - private Optional environment = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(GetScoresResponseTraceData other) { - userId(other.getUserId()); - tags(other.getTags()); - environment(other.getEnvironment()); - return this; - } - - /** - *

The user ID associated with the trace referenced by score

- */ - @JsonSetter( - value = "userId", - nulls = Nulls.SKIP - ) - public Builder userId(Optional userId) { - this.userId = userId; - return this; - } - - public Builder userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - /** - *

A list of tags associated with the trace referenced by score

- */ - @JsonSetter( - value = "tags", - nulls = Nulls.SKIP - ) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - /** - *

The environment of the trace referenced by score

- */ - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional environment) { - this.environment = environment; - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - public GetScoresResponseTraceData build() { - return new GetScoresResponseTraceData(userId, tags, environment, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/sessions/AsyncRawSessionsClient.java b/src/main/java/com/langfuse/client/resources/sessions/AsyncRawSessionsClient.java deleted file mode 100644 index 1ff2aa6..0000000 --- a/src/main/java/com/langfuse/client/resources/sessions/AsyncRawSessionsClient.java +++ /dev/null @@ -1,222 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.sessions; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.Override; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import okhttp3.Call; -import okhttp3.Callback; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.SessionWithTraces; -import com.langfuse.client.resources.sessions.requests.GetSessionsRequest; -import com.langfuse.client.resources.sessions.types.PaginatedSessions; - -public class AsyncRawSessionsClient { - protected final ClientOptions clientOptions; - - public AsyncRawSessionsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Get sessions - */ - public CompletableFuture> list() { - return list(GetSessionsRequest.builder().build()); - } - - /** - * Get sessions - */ - public CompletableFuture> list( - RequestOptions requestOptions) { - return list(GetSessionsRequest.builder().build(),requestOptions); - } - - /** - * Get sessions - */ - public CompletableFuture> list( - GetSessionsRequest request) { - return list(request,null); - } - - /** - * Get sessions - */ - public CompletableFuture> list( - GetSessionsRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("sessions");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getFromTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fromTimestamp", request.getFromTimestamp().get(), false); - } - if (request.getToTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "toTimestamp", request.getToTimestamp().get(), false); - } - if (request.getEnvironment().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "environment", request.getEnvironment().get(), true); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaginatedSessions.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - - /** - * Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> - */ - public CompletableFuture> get(String sessionId) { - return get(sessionId,null); - } - - /** - * Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> - */ - public CompletableFuture> get(String sessionId, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("sessions") - .addPathSegment(sessionId);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SessionWithTraces.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - } diff --git a/src/main/java/com/langfuse/client/resources/sessions/AsyncSessionsClient.java b/src/main/java/com/langfuse/client/resources/sessions/AsyncSessionsClient.java deleted file mode 100644 index f0bd843..0000000 --- a/src/main/java/com/langfuse/client/resources/sessions/AsyncSessionsClient.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.sessions; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.lang.String; -import java.util.concurrent.CompletableFuture; -import com.langfuse.client.resources.commons.types.SessionWithTraces; -import com.langfuse.client.resources.sessions.requests.GetSessionsRequest; -import com.langfuse.client.resources.sessions.types.PaginatedSessions; - -public class AsyncSessionsClient { - protected final ClientOptions clientOptions; - - private final AsyncRawSessionsClient rawClient; - - public AsyncSessionsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new AsyncRawSessionsClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public AsyncRawSessionsClient withRawResponse() { - return this.rawClient; - } - - /** - * Get sessions - */ - public CompletableFuture list() { - return this.rawClient.list().thenApply(response -> response.body()); - } - - /** - * Get sessions - */ - public CompletableFuture list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).thenApply(response -> response.body()); - } - - /** - * Get sessions - */ - public CompletableFuture list(GetSessionsRequest request) { - return this.rawClient.list(request).thenApply(response -> response.body()); - } - - /** - * Get sessions - */ - public CompletableFuture list(GetSessionsRequest request, - RequestOptions requestOptions) { - return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); - } - - /** - * Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> - */ - public CompletableFuture get(String sessionId) { - return this.rawClient.get(sessionId).thenApply(response -> response.body()); - } - - /** - * Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> - */ - public CompletableFuture get(String sessionId, RequestOptions requestOptions) { - return this.rawClient.get(sessionId, requestOptions).thenApply(response -> response.body()); - } -} diff --git a/src/main/java/com/langfuse/client/resources/sessions/RawSessionsClient.java b/src/main/java/com/langfuse/client/resources/sessions/RawSessionsClient.java deleted file mode 100644 index 83769b8..0000000 --- a/src/main/java/com/langfuse/client/resources/sessions/RawSessionsClient.java +++ /dev/null @@ -1,179 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.sessions; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.LangfuseClientApiException; -import com.langfuse.client.core.LangfuseClientException; -import com.langfuse.client.core.LangfuseClientHttpResponse; -import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; -import com.langfuse.client.core.RequestOptions; -import java.io.IOException; -import java.lang.Object; -import java.lang.String; -import okhttp3.Headers; -import okhttp3.HttpUrl; -import okhttp3.OkHttpClient; -import okhttp3.Request; -import okhttp3.Response; -import okhttp3.ResponseBody; -import com.langfuse.client.resources.commons.errors.AccessDeniedError; -import com.langfuse.client.resources.commons.errors.Error; -import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; -import com.langfuse.client.resources.commons.errors.NotFoundError; -import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.SessionWithTraces; -import com.langfuse.client.resources.sessions.requests.GetSessionsRequest; -import com.langfuse.client.resources.sessions.types.PaginatedSessions; - -public class RawSessionsClient { - protected final ClientOptions clientOptions; - - public RawSessionsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - } - - /** - * Get sessions - */ - public LangfuseClientHttpResponse list() { - return list(GetSessionsRequest.builder().build()); - } - - /** - * Get sessions - */ - public LangfuseClientHttpResponse list(RequestOptions requestOptions) { - return list(GetSessionsRequest.builder().build(),requestOptions); - } - - /** - * Get sessions - */ - public LangfuseClientHttpResponse list(GetSessionsRequest request) { - return list(request,null); - } - - /** - * Get sessions - */ - public LangfuseClientHttpResponse list(GetSessionsRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("sessions");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getFromTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fromTimestamp", request.getFromTimestamp().get(), false); - } - if (request.getToTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "toTimestamp", request.getToTimestamp().get(), false); - } - if (request.getEnvironment().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "environment", request.getEnvironment().get(), true); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, PaginatedSessions.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - - /** - * Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> - */ - public LangfuseClientHttpResponse get(String sessionId) { - return get(sessionId,null); - } - - /** - * Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> - */ - public LangfuseClientHttpResponse get(String sessionId, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("sessions") - .addPathSegment(sessionId);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, SessionWithTraces.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - } diff --git a/src/main/java/com/langfuse/client/resources/sessions/SessionsClient.java b/src/main/java/com/langfuse/client/resources/sessions/SessionsClient.java deleted file mode 100644 index 8218acd..0000000 --- a/src/main/java/com/langfuse/client/resources/sessions/SessionsClient.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.sessions; - -import com.langfuse.client.core.ClientOptions; -import com.langfuse.client.core.RequestOptions; -import java.lang.String; -import com.langfuse.client.resources.commons.types.SessionWithTraces; -import com.langfuse.client.resources.sessions.requests.GetSessionsRequest; -import com.langfuse.client.resources.sessions.types.PaginatedSessions; - -public class SessionsClient { - protected final ClientOptions clientOptions; - - private final RawSessionsClient rawClient; - - public SessionsClient(ClientOptions clientOptions) { - this.clientOptions = clientOptions; - this.rawClient = new RawSessionsClient(clientOptions); - } - - /** - * Get responses with HTTP metadata like headers - */ - public RawSessionsClient withRawResponse() { - return this.rawClient; - } - - /** - * Get sessions - */ - public PaginatedSessions list() { - return this.rawClient.list().body(); - } - - /** - * Get sessions - */ - public PaginatedSessions list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).body(); - } - - /** - * Get sessions - */ - public PaginatedSessions list(GetSessionsRequest request) { - return this.rawClient.list(request).body(); - } - - /** - * Get sessions - */ - public PaginatedSessions list(GetSessionsRequest request, RequestOptions requestOptions) { - return this.rawClient.list(request, requestOptions).body(); - } - - /** - * Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> - */ - public SessionWithTraces get(String sessionId) { - return this.rawClient.get(sessionId).body(); - } - - /** - * Get a session. Please note that traces on this endpoint are not paginated, if you plan to fetch large sessions, consider GET /api/public/traces?sessionId=<sessionId> - */ - public SessionWithTraces get(String sessionId, RequestOptions requestOptions) { - return this.rawClient.get(sessionId, requestOptions).body(); - } -} diff --git a/src/main/java/com/langfuse/client/resources/sessions/requests/GetSessionsRequest.java b/src/main/java/com/langfuse/client/resources/sessions/requests/GetSessionsRequest.java deleted file mode 100644 index 5d8bdc7..0000000 --- a/src/main/java/com/langfuse/client/resources/sessions/requests/GetSessionsRequest.java +++ /dev/null @@ -1,257 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.sessions.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetSessionsRequest.Builder.class -) -public final class GetSessionsRequest { - private final Optional> environment; - - private final Optional page; - - private final Optional limit; - - private final Optional fromTimestamp; - - private final Optional toTimestamp; - - private final Map additionalProperties; - - private GetSessionsRequest(Optional> environment, Optional page, - Optional limit, Optional fromTimestamp, - Optional toTimestamp, Map additionalProperties) { - this.environment = environment; - this.page = page; - this.limit = limit; - this.fromTimestamp = fromTimestamp; - this.toTimestamp = toTimestamp; - this.additionalProperties = additionalProperties; - } - - /** - * @return Optional filter for sessions where the environment is one of the provided values. - */ - @JsonProperty("environment") - public Optional> getEnvironment() { - return environment; - } - - /** - * @return Page number, starts at 1 - */ - @JsonProperty("page") - public Optional getPage() { - return page; - } - - /** - * @return Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit. - */ - @JsonProperty("limit") - public Optional getLimit() { - return limit; - } - - /** - * @return Optional filter to only include sessions created on or after a certain datetime (ISO 8601) - */ - @JsonProperty("fromTimestamp") - public Optional getFromTimestamp() { - return fromTimestamp; - } - - /** - * @return Optional filter to only include sessions created before a certain datetime (ISO 8601) - */ - @JsonProperty("toTimestamp") - public Optional getToTimestamp() { - return toTimestamp; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetSessionsRequest && equalTo((GetSessionsRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetSessionsRequest other) { - return environment.equals(other.environment) && page.equals(other.page) && limit.equals(other.limit) && fromTimestamp.equals(other.fromTimestamp) && toTimestamp.equals(other.toTimestamp); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.environment, this.page, this.limit, this.fromTimestamp, this.toTimestamp); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional> environment = Optional.empty(); - - private Optional page = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional fromTimestamp = Optional.empty(); - - private Optional toTimestamp = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(GetSessionsRequest other) { - environment(other.getEnvironment()); - page(other.getPage()); - limit(other.getLimit()); - fromTimestamp(other.getFromTimestamp()); - toTimestamp(other.getToTimestamp()); - return this; - } - - /** - *

Optional filter for sessions where the environment is one of the provided values.

- */ - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional> environment) { - this.environment = environment; - return this; - } - - public Builder environment(List environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.of(Collections.singletonList(environment)); - return this; - } - - /** - *

Page number, starts at 1

- */ - @JsonSetter( - value = "page", - nulls = Nulls.SKIP - ) - public Builder page(Optional page) { - this.page = page; - return this; - } - - public Builder page(Integer page) { - this.page = Optional.ofNullable(page); - return this; - } - - /** - *

Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.

- */ - @JsonSetter( - value = "limit", - nulls = Nulls.SKIP - ) - public Builder limit(Optional limit) { - this.limit = limit; - return this; - } - - public Builder limit(Integer limit) { - this.limit = Optional.ofNullable(limit); - return this; - } - - /** - *

Optional filter to only include sessions created on or after a certain datetime (ISO 8601)

- */ - @JsonSetter( - value = "fromTimestamp", - nulls = Nulls.SKIP - ) - public Builder fromTimestamp(Optional fromTimestamp) { - this.fromTimestamp = fromTimestamp; - return this; - } - - public Builder fromTimestamp(OffsetDateTime fromTimestamp) { - this.fromTimestamp = Optional.ofNullable(fromTimestamp); - return this; - } - - /** - *

Optional filter to only include sessions created before a certain datetime (ISO 8601)

- */ - @JsonSetter( - value = "toTimestamp", - nulls = Nulls.SKIP - ) - public Builder toTimestamp(Optional toTimestamp) { - this.toTimestamp = toTimestamp; - return this; - } - - public Builder toTimestamp(OffsetDateTime toTimestamp) { - this.toTimestamp = Optional.ofNullable(toTimestamp); - return this; - } - - public GetSessionsRequest build() { - return new GetSessionsRequest(environment, page, limit, fromTimestamp, toTimestamp, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/sessions/types/PaginatedSessions.java b/src/main/java/com/langfuse/client/resources/sessions/types/PaginatedSessions.java deleted file mode 100644 index 1199c1c..0000000 --- a/src/main/java/com/langfuse/client/resources/sessions/types/PaginatedSessions.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.sessions.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.Session; -import com.langfuse.client.resources.utils.pagination.types.MetaResponse; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = PaginatedSessions.Builder.class -) -public final class PaginatedSessions { - private final List data; - - private final MetaResponse meta; - - private final Map additionalProperties; - - private PaginatedSessions(List data, MetaResponse meta, - Map additionalProperties) { - this.data = data; - this.meta = meta; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public List getData() { - return data; - } - - @JsonProperty("meta") - public MetaResponse getMeta() { - return meta; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof PaginatedSessions && equalTo((PaginatedSessions) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(PaginatedSessions other) { - return data.equals(other.data) && meta.equals(other.meta); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.data, this.meta); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetaStage builder() { - return new Builder(); - } - - public interface MetaStage { - _FinalStage meta(@NotNull MetaResponse meta); - - Builder from(PaginatedSessions other); - } - - public interface _FinalStage { - PaginatedSessions build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage data(List data); - - _FinalStage addData(Session data); - - _FinalStage addAllData(List data); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements MetaStage, _FinalStage { - private MetaResponse meta; - - private List data = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(PaginatedSessions other) { - data(other.getData()); - meta(other.getMeta()); - return this; - } - - @java.lang.Override - @JsonSetter("meta") - public _FinalStage meta(@NotNull MetaResponse meta) { - this.meta = Objects.requireNonNull(meta, "meta must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllData(List data) { - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public _FinalStage addData(Session data) { - this.data.add(data); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "data", - nulls = Nulls.SKIP - ) - public _FinalStage data(List data) { - this.data.clear(); - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public PaginatedSessions build() { - return new PaginatedSessions(data, meta, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/trace/AsyncRawTraceClient.java b/src/main/java/com/langfuse/client/resources/trace/AsyncRawTraceClient.java index 5ad925e..aa62042 100644 --- a/src/main/java/com/langfuse/client/resources/trace/AsyncRawTraceClient.java +++ b/src/main/java/com/langfuse/client/resources/trace/AsyncRawTraceClient.java @@ -11,7 +11,6 @@ import com.langfuse.client.core.LangfuseClientHttpResponse; import com.langfuse.client.core.MediaTypes; import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; import com.langfuse.client.core.RequestOptions; import java.io.IOException; import java.lang.Object; @@ -33,11 +32,8 @@ import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; import com.langfuse.client.resources.commons.errors.NotFoundError; import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.TraceWithFullDetails; import com.langfuse.client.resources.trace.requests.DeleteTracesRequest; -import com.langfuse.client.resources.trace.requests.GetTracesRequest; import com.langfuse.client.resources.trace.types.DeleteTraceResponse; -import com.langfuse.client.resources.trace.types.Traces; public class AsyncRawTraceClient { protected final ClientOptions clientOptions; @@ -46,80 +42,6 @@ public AsyncRawTraceClient(ClientOptions clientOptions) { this.clientOptions = clientOptions; } - /** - * Get a specific trace - */ - public CompletableFuture> get(String traceId) { - return get(traceId,null); - } - - /** - * Get a specific trace - */ - public CompletableFuture> get(String traceId, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("traces") - .addPathSegment(traceId);if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TraceWithFullDetails.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - /** * Delete a specific trace */ @@ -195,136 +117,6 @@ public void onFailure(@NotNull Call call, @NotNull IOException e) { return future; } - /** - * Get list of traces - */ - public CompletableFuture> list() { - return list(GetTracesRequest.builder().build()); - } - - /** - * Get list of traces - */ - public CompletableFuture> list( - RequestOptions requestOptions) { - return list(GetTracesRequest.builder().build(),requestOptions); - } - - /** - * Get list of traces - */ - public CompletableFuture> list(GetTracesRequest request) { - return list(request,null); - } - - /** - * Get list of traces - */ - public CompletableFuture> list(GetTracesRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("traces");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getUserId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "userId", request.getUserId().get(), false); - } - if (request.getName().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "name", request.getName().get(), false); - } - if (request.getSessionId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "sessionId", request.getSessionId().get(), false); - } - if (request.getFromTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fromTimestamp", request.getFromTimestamp().get(), false); - } - if (request.getToTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "toTimestamp", request.getToTimestamp().get(), false); - } - if (request.getOrderBy().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "orderBy", request.getOrderBy().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (request.getRelease().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "release", request.getRelease().get(), false); - } - if (request.getFields().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fields", request.getFields().get(), false); - } - if (request.getFilter().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "filter", request.getFilter().get(), false); - } - if (request.getTags().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tags", request.getTags().get(), true); - } - if (request.getEnvironment().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "environment", request.getEnvironment().get(), true); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - CompletableFuture> future = new CompletableFuture<>(); - client.newCall(okhttpRequest).enqueue(new Callback() { - @Override - public void onResponse(@NotNull Call call, @NotNull Response response) throws IOException { - try (ResponseBody responseBody = response.body()) { - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - future.complete(new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Traces.class), response)); - return; - } - try { - switch (response.code()) { - case 400:future.completeExceptionally(new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 401:future.completeExceptionally(new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 403:future.completeExceptionally(new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 404:future.completeExceptionally(new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - case 405:future.completeExceptionally(new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response)); - return; - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - future.completeExceptionally(new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response)); - return; - } - catch (IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - } - - @Override - public void onFailure(@NotNull Call call, @NotNull IOException e) { - future.completeExceptionally(new LangfuseClientException("Network error executing HTTP request", e)); - } - }); - return future; - } - /** * Delete multiple traces */ diff --git a/src/main/java/com/langfuse/client/resources/trace/AsyncTraceClient.java b/src/main/java/com/langfuse/client/resources/trace/AsyncTraceClient.java index 9207994..725af13 100644 --- a/src/main/java/com/langfuse/client/resources/trace/AsyncTraceClient.java +++ b/src/main/java/com/langfuse/client/resources/trace/AsyncTraceClient.java @@ -8,11 +8,8 @@ import com.langfuse.client.core.RequestOptions; import java.lang.String; import java.util.concurrent.CompletableFuture; -import com.langfuse.client.resources.commons.types.TraceWithFullDetails; import com.langfuse.client.resources.trace.requests.DeleteTracesRequest; -import com.langfuse.client.resources.trace.requests.GetTracesRequest; import com.langfuse.client.resources.trace.types.DeleteTraceResponse; -import com.langfuse.client.resources.trace.types.Traces; public class AsyncTraceClient { protected final ClientOptions clientOptions; @@ -31,21 +28,6 @@ public AsyncRawTraceClient withRawResponse() { return this.rawClient; } - /** - * Get a specific trace - */ - public CompletableFuture get(String traceId) { - return this.rawClient.get(traceId).thenApply(response -> response.body()); - } - - /** - * Get a specific trace - */ - public CompletableFuture get(String traceId, - RequestOptions requestOptions) { - return this.rawClient.get(traceId, requestOptions).thenApply(response -> response.body()); - } - /** * Delete a specific trace */ @@ -61,34 +43,6 @@ public CompletableFuture delete(String traceId, return this.rawClient.delete(traceId, requestOptions).thenApply(response -> response.body()); } - /** - * Get list of traces - */ - public CompletableFuture list() { - return this.rawClient.list().thenApply(response -> response.body()); - } - - /** - * Get list of traces - */ - public CompletableFuture list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).thenApply(response -> response.body()); - } - - /** - * Get list of traces - */ - public CompletableFuture list(GetTracesRequest request) { - return this.rawClient.list(request).thenApply(response -> response.body()); - } - - /** - * Get list of traces - */ - public CompletableFuture list(GetTracesRequest request, RequestOptions requestOptions) { - return this.rawClient.list(request, requestOptions).thenApply(response -> response.body()); - } - /** * Delete multiple traces */ diff --git a/src/main/java/com/langfuse/client/resources/trace/RawTraceClient.java b/src/main/java/com/langfuse/client/resources/trace/RawTraceClient.java index b38409e..7dc43d0 100644 --- a/src/main/java/com/langfuse/client/resources/trace/RawTraceClient.java +++ b/src/main/java/com/langfuse/client/resources/trace/RawTraceClient.java @@ -11,7 +11,6 @@ import com.langfuse.client.core.LangfuseClientHttpResponse; import com.langfuse.client.core.MediaTypes; import com.langfuse.client.core.ObjectMappers; -import com.langfuse.client.core.QueryStringMapper; import com.langfuse.client.core.RequestOptions; import java.io.IOException; import java.lang.Object; @@ -28,11 +27,8 @@ import com.langfuse.client.resources.commons.errors.MethodNotAllowedError; import com.langfuse.client.resources.commons.errors.NotFoundError; import com.langfuse.client.resources.commons.errors.UnauthorizedError; -import com.langfuse.client.resources.commons.types.TraceWithFullDetails; import com.langfuse.client.resources.trace.requests.DeleteTracesRequest; -import com.langfuse.client.resources.trace.requests.GetTracesRequest; import com.langfuse.client.resources.trace.types.DeleteTraceResponse; -import com.langfuse.client.resources.trace.types.Traces; public class RawTraceClient { protected final ClientOptions clientOptions; @@ -42,16 +38,16 @@ public RawTraceClient(ClientOptions clientOptions) { } /** - * Get a specific trace + * Delete a specific trace */ - public LangfuseClientHttpResponse get(String traceId) { - return get(traceId,null); + public LangfuseClientHttpResponse delete(String traceId) { + return delete(traceId,null); } /** - * Get a specific trace + * Delete a specific trace */ - public LangfuseClientHttpResponse get(String traceId, + public LangfuseClientHttpResponse delete(String traceId, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() .addPathSegments("api/public") @@ -63,7 +59,7 @@ public LangfuseClientHttpResponse get(String traceId, } Request okhttpRequest = new Request.Builder() .url(httpUrl.build()) - .method("GET", null) + .method("DELETE", null) .headers(Headers.of(clientOptions.headers(requestOptions))) .addHeader("Accept", "application/json") .build(); @@ -75,7 +71,7 @@ public LangfuseClientHttpResponse get(String traceId, ResponseBody responseBody = response.body(); String responseBodyString = responseBody != null ? responseBody.string() : "{}"; if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, TraceWithFullDetails.class), response); + return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteTraceResponse.class), response); } try { switch (response.code()) { @@ -98,29 +94,37 @@ public LangfuseClientHttpResponse get(String traceId, } /** - * Delete a specific trace + * Delete multiple traces */ - public LangfuseClientHttpResponse delete(String traceId) { - return delete(traceId,null); + public LangfuseClientHttpResponse deleteMultiple( + DeleteTracesRequest request) { + return deleteMultiple(request,null); } /** - * Delete a specific trace + * Delete multiple traces */ - public LangfuseClientHttpResponse delete(String traceId, - RequestOptions requestOptions) { + public LangfuseClientHttpResponse deleteMultiple( + DeleteTracesRequest request, RequestOptions requestOptions) { HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() .addPathSegments("api/public") - .addPathSegments("traces") - .addPathSegment(traceId);if (requestOptions != null) { + .addPathSegments("traces");if (requestOptions != null) { requestOptions.getQueryParameters().forEach((_key, _value) -> { httpUrl.addQueryParameter(_key, _value); } ); } + RequestBody body; + try { + body = RequestBody.create(ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); + } + catch(JsonProcessingException e) { + throw new LangfuseClientException("Failed to serialize request", e); + } Request okhttpRequest = new Request.Builder() .url(httpUrl.build()) - .method("DELETE", null) + .method("DELETE", body) .headers(Headers.of(clientOptions.headers(requestOptions))) + .addHeader("Content-Type", "application/json") .addHeader("Accept", "application/json") .build(); OkHttpClient client = clientOptions.httpClient(); @@ -152,179 +156,4 @@ public LangfuseClientHttpResponse delete(String traceId, throw new LangfuseClientException("Network error executing HTTP request", e); } } - - /** - * Get list of traces - */ - public LangfuseClientHttpResponse list() { - return list(GetTracesRequest.builder().build()); - } - - /** - * Get list of traces - */ - public LangfuseClientHttpResponse list(RequestOptions requestOptions) { - return list(GetTracesRequest.builder().build(),requestOptions); - } - - /** - * Get list of traces - */ - public LangfuseClientHttpResponse list(GetTracesRequest request) { - return list(request,null); - } - - /** - * Get list of traces - */ - public LangfuseClientHttpResponse list(GetTracesRequest request, - RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("traces");if (request.getPage().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "page", request.getPage().get(), false); - } - if (request.getLimit().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "limit", request.getLimit().get(), false); - } - if (request.getUserId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "userId", request.getUserId().get(), false); - } - if (request.getName().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "name", request.getName().get(), false); - } - if (request.getSessionId().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "sessionId", request.getSessionId().get(), false); - } - if (request.getFromTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fromTimestamp", request.getFromTimestamp().get(), false); - } - if (request.getToTimestamp().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "toTimestamp", request.getToTimestamp().get(), false); - } - if (request.getOrderBy().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "orderBy", request.getOrderBy().get(), false); - } - if (request.getVersion().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "version", request.getVersion().get(), false); - } - if (request.getRelease().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "release", request.getRelease().get(), false); - } - if (request.getFields().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "fields", request.getFields().get(), false); - } - if (request.getFilter().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "filter", request.getFilter().get(), false); - } - if (request.getTags().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "tags", request.getTags().get(), true); - } - if (request.getEnvironment().isPresent()) { - QueryStringMapper.addQueryParameter(httpUrl, "environment", request.getEnvironment().get(), true); - } - if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - Request.Builder _requestBuilder = new Request.Builder() - .url(httpUrl.build()) - .method("GET", null) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Accept", "application/json"); - Request okhttpRequest = _requestBuilder.build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Traces.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - - /** - * Delete multiple traces - */ - public LangfuseClientHttpResponse deleteMultiple( - DeleteTracesRequest request) { - return deleteMultiple(request,null); - } - - /** - * Delete multiple traces - */ - public LangfuseClientHttpResponse deleteMultiple( - DeleteTracesRequest request, RequestOptions requestOptions) { - HttpUrl.Builder httpUrl = HttpUrl.parse(this.clientOptions.environment().getUrl()).newBuilder() - .addPathSegments("api/public") - .addPathSegments("traces");if (requestOptions != null) { - requestOptions.getQueryParameters().forEach((_key, _value) -> { - httpUrl.addQueryParameter(_key, _value); - } ); - } - RequestBody body; - try { - body = RequestBody.create(ObjectMappers.JSON_MAPPER.writeValueAsBytes(request), MediaTypes.APPLICATION_JSON); - } - catch(JsonProcessingException e) { - throw new LangfuseClientException("Failed to serialize request", e); - } - Request okhttpRequest = new Request.Builder() - .url(httpUrl.build()) - .method("DELETE", body) - .headers(Headers.of(clientOptions.headers(requestOptions))) - .addHeader("Content-Type", "application/json") - .addHeader("Accept", "application/json") - .build(); - OkHttpClient client = clientOptions.httpClient(); - if (requestOptions != null && requestOptions.getTimeout().isPresent()) { - client = clientOptions.httpClientWithTimeout(requestOptions); - } - try (Response response = client.newCall(okhttpRequest).execute()) { - ResponseBody responseBody = response.body(); - String responseBodyString = responseBody != null ? responseBody.string() : "{}"; - if (response.isSuccessful()) { - return new LangfuseClientHttpResponse<>(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, DeleteTraceResponse.class), response); - } - try { - switch (response.code()) { - case 400:throw new Error(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 401:throw new UnauthorizedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 403:throw new AccessDeniedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 404:throw new NotFoundError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - case 405:throw new MethodNotAllowedError(ObjectMappers.JSON_MAPPER.readValue(responseBodyString, Object.class), response); - } - } - catch (JsonProcessingException ignored) { - // unable to map error response, throwing generic error - } - Object errorBody = ObjectMappers.parseErrorBody(responseBodyString); - throw new LangfuseClientApiException("Error with status code " + response.code(), response.code(), errorBody, response); - } - catch (IOException e) { - throw new LangfuseClientException("Network error executing HTTP request", e); - } - } - } + } diff --git a/src/main/java/com/langfuse/client/resources/trace/TraceClient.java b/src/main/java/com/langfuse/client/resources/trace/TraceClient.java index 63354f5..132fe06 100644 --- a/src/main/java/com/langfuse/client/resources/trace/TraceClient.java +++ b/src/main/java/com/langfuse/client/resources/trace/TraceClient.java @@ -7,11 +7,8 @@ import com.langfuse.client.core.ClientOptions; import com.langfuse.client.core.RequestOptions; import java.lang.String; -import com.langfuse.client.resources.commons.types.TraceWithFullDetails; import com.langfuse.client.resources.trace.requests.DeleteTracesRequest; -import com.langfuse.client.resources.trace.requests.GetTracesRequest; import com.langfuse.client.resources.trace.types.DeleteTraceResponse; -import com.langfuse.client.resources.trace.types.Traces; public class TraceClient { protected final ClientOptions clientOptions; @@ -30,20 +27,6 @@ public RawTraceClient withRawResponse() { return this.rawClient; } - /** - * Get a specific trace - */ - public TraceWithFullDetails get(String traceId) { - return this.rawClient.get(traceId).body(); - } - - /** - * Get a specific trace - */ - public TraceWithFullDetails get(String traceId, RequestOptions requestOptions) { - return this.rawClient.get(traceId, requestOptions).body(); - } - /** * Delete a specific trace */ @@ -58,34 +41,6 @@ public DeleteTraceResponse delete(String traceId, RequestOptions requestOptions) return this.rawClient.delete(traceId, requestOptions).body(); } - /** - * Get list of traces - */ - public Traces list() { - return this.rawClient.list().body(); - } - - /** - * Get list of traces - */ - public Traces list(RequestOptions requestOptions) { - return this.rawClient.list(requestOptions).body(); - } - - /** - * Get list of traces - */ - public Traces list(GetTracesRequest request) { - return this.rawClient.list(request).body(); - } - - /** - * Get list of traces - */ - public Traces list(GetTracesRequest request, RequestOptions requestOptions) { - return this.rawClient.list(request, requestOptions).body(); - } - /** * Delete multiple traces */ diff --git a/src/main/java/com/langfuse/client/resources/trace/requests/GetTracesRequest.java b/src/main/java/com/langfuse/client/resources/trace/requests/GetTracesRequest.java deleted file mode 100644 index 899eb21..0000000 --- a/src/main/java/com/langfuse/client/resources/trace/requests/GetTracesRequest.java +++ /dev/null @@ -1,526 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.trace.requests; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Integer; -import java.lang.Object; -import java.lang.String; -import java.time.OffsetDateTime; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import java.util.Optional; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = GetTracesRequest.Builder.class -) -public final class GetTracesRequest { - private final Optional> tags; - - private final Optional> environment; - - private final Optional page; - - private final Optional limit; - - private final Optional userId; - - private final Optional name; - - private final Optional sessionId; - - private final Optional fromTimestamp; - - private final Optional toTimestamp; - - private final Optional orderBy; - - private final Optional version; - - private final Optional release; - - private final Optional fields; - - private final Optional filter; - - private final Map additionalProperties; - - private GetTracesRequest(Optional> tags, Optional> environment, - Optional page, Optional limit, Optional userId, - Optional name, Optional sessionId, Optional fromTimestamp, - Optional toTimestamp, Optional orderBy, Optional version, - Optional release, Optional fields, Optional filter, - Map additionalProperties) { - this.tags = tags; - this.environment = environment; - this.page = page; - this.limit = limit; - this.userId = userId; - this.name = name; - this.sessionId = sessionId; - this.fromTimestamp = fromTimestamp; - this.toTimestamp = toTimestamp; - this.orderBy = orderBy; - this.version = version; - this.release = release; - this.fields = fields; - this.filter = filter; - this.additionalProperties = additionalProperties; - } - - /** - * @return Only traces that include all of these tags will be returned. - */ - @JsonProperty("tags") - public Optional> getTags() { - return tags; - } - - /** - * @return Optional filter for traces where the environment is one of the provided values. - */ - @JsonProperty("environment") - public Optional> getEnvironment() { - return environment; - } - - /** - * @return Page number, starts at 1 - */ - @JsonProperty("page") - public Optional getPage() { - return page; - } - - /** - * @return Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit. - */ - @JsonProperty("limit") - public Optional getLimit() { - return limit; - } - - @JsonProperty("userId") - public Optional getUserId() { - return userId; - } - - @JsonProperty("name") - public Optional getName() { - return name; - } - - @JsonProperty("sessionId") - public Optional getSessionId() { - return sessionId; - } - - /** - * @return Optional filter to only include traces with a trace.timestamp on or after a certain datetime (ISO 8601) - */ - @JsonProperty("fromTimestamp") - public Optional getFromTimestamp() { - return fromTimestamp; - } - - /** - * @return Optional filter to only include traces with a trace.timestamp before a certain datetime (ISO 8601) - */ - @JsonProperty("toTimestamp") - public Optional getToTimestamp() { - return toTimestamp; - } - - /** - * @return Format of the string [field].[asc/desc]. Fields: id, timestamp, name, userId, release, version, public, bookmarked, sessionId. Example: timestamp.asc - */ - @JsonProperty("orderBy") - public Optional getOrderBy() { - return orderBy; - } - - /** - * @return Optional filter to only include traces with a certain version. - */ - @JsonProperty("version") - public Optional getVersion() { - return version; - } - - /** - * @return Optional filter to only include traces with a certain release. - */ - @JsonProperty("release") - public Optional getRelease() { - return release; - } - - /** - * @return Comma-separated list of fields to include in the response. Available field groups: 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not specified, all fields are returned. Example: 'core,scores,metrics'. Note: Excluded 'observations' or 'scores' fields return empty arrays; excluded 'metrics' returns -1 for 'totalCost' and 'latency'. - */ - @JsonProperty("fields") - public Optional getFields() { - return fields; - } - - /** - * @return JSON string containing an array of filter conditions. When provided, this takes precedence over query parameter filters (userId, name, sessionId, tags, version, release, environment, fromTimestamp, toTimestamp). - */ - @JsonProperty("filter") - public Optional getFilter() { - return filter; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof GetTracesRequest && equalTo((GetTracesRequest) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(GetTracesRequest other) { - return tags.equals(other.tags) && environment.equals(other.environment) && page.equals(other.page) && limit.equals(other.limit) && userId.equals(other.userId) && name.equals(other.name) && sessionId.equals(other.sessionId) && fromTimestamp.equals(other.fromTimestamp) && toTimestamp.equals(other.toTimestamp) && orderBy.equals(other.orderBy) && version.equals(other.version) && release.equals(other.release) && fields.equals(other.fields) && filter.equals(other.filter); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.tags, this.environment, this.page, this.limit, this.userId, this.name, this.sessionId, this.fromTimestamp, this.toTimestamp, this.orderBy, this.version, this.release, this.fields, this.filter); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static Builder builder() { - return new Builder(); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder { - private Optional> tags = Optional.empty(); - - private Optional> environment = Optional.empty(); - - private Optional page = Optional.empty(); - - private Optional limit = Optional.empty(); - - private Optional userId = Optional.empty(); - - private Optional name = Optional.empty(); - - private Optional sessionId = Optional.empty(); - - private Optional fromTimestamp = Optional.empty(); - - private Optional toTimestamp = Optional.empty(); - - private Optional orderBy = Optional.empty(); - - private Optional version = Optional.empty(); - - private Optional release = Optional.empty(); - - private Optional fields = Optional.empty(); - - private Optional filter = Optional.empty(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - public Builder from(GetTracesRequest other) { - tags(other.getTags()); - environment(other.getEnvironment()); - page(other.getPage()); - limit(other.getLimit()); - userId(other.getUserId()); - name(other.getName()); - sessionId(other.getSessionId()); - fromTimestamp(other.getFromTimestamp()); - toTimestamp(other.getToTimestamp()); - orderBy(other.getOrderBy()); - version(other.getVersion()); - release(other.getRelease()); - fields(other.getFields()); - filter(other.getFilter()); - return this; - } - - /** - *

Only traces that include all of these tags will be returned.

- */ - @JsonSetter( - value = "tags", - nulls = Nulls.SKIP - ) - public Builder tags(Optional> tags) { - this.tags = tags; - return this; - } - - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); - return this; - } - - public Builder tags(String tags) { - this.tags = Optional.of(Collections.singletonList(tags)); - return this; - } - - /** - *

Optional filter for traces where the environment is one of the provided values.

- */ - @JsonSetter( - value = "environment", - nulls = Nulls.SKIP - ) - public Builder environment(Optional> environment) { - this.environment = environment; - return this; - } - - public Builder environment(List environment) { - this.environment = Optional.ofNullable(environment); - return this; - } - - public Builder environment(String environment) { - this.environment = Optional.of(Collections.singletonList(environment)); - return this; - } - - /** - *

Page number, starts at 1

- */ - @JsonSetter( - value = "page", - nulls = Nulls.SKIP - ) - public Builder page(Optional page) { - this.page = page; - return this; - } - - public Builder page(Integer page) { - this.page = Optional.ofNullable(page); - return this; - } - - /** - *

Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.

- */ - @JsonSetter( - value = "limit", - nulls = Nulls.SKIP - ) - public Builder limit(Optional limit) { - this.limit = limit; - return this; - } - - public Builder limit(Integer limit) { - this.limit = Optional.ofNullable(limit); - return this; - } - - @JsonSetter( - value = "userId", - nulls = Nulls.SKIP - ) - public Builder userId(Optional userId) { - this.userId = userId; - return this; - } - - public Builder userId(String userId) { - this.userId = Optional.ofNullable(userId); - return this; - } - - @JsonSetter( - value = "name", - nulls = Nulls.SKIP - ) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); - return this; - } - - @JsonSetter( - value = "sessionId", - nulls = Nulls.SKIP - ) - public Builder sessionId(Optional sessionId) { - this.sessionId = sessionId; - return this; - } - - public Builder sessionId(String sessionId) { - this.sessionId = Optional.ofNullable(sessionId); - return this; - } - - /** - *

Optional filter to only include traces with a trace.timestamp on or after a certain datetime (ISO 8601)

- */ - @JsonSetter( - value = "fromTimestamp", - nulls = Nulls.SKIP - ) - public Builder fromTimestamp(Optional fromTimestamp) { - this.fromTimestamp = fromTimestamp; - return this; - } - - public Builder fromTimestamp(OffsetDateTime fromTimestamp) { - this.fromTimestamp = Optional.ofNullable(fromTimestamp); - return this; - } - - /** - *

Optional filter to only include traces with a trace.timestamp before a certain datetime (ISO 8601)

- */ - @JsonSetter( - value = "toTimestamp", - nulls = Nulls.SKIP - ) - public Builder toTimestamp(Optional toTimestamp) { - this.toTimestamp = toTimestamp; - return this; - } - - public Builder toTimestamp(OffsetDateTime toTimestamp) { - this.toTimestamp = Optional.ofNullable(toTimestamp); - return this; - } - - /** - *

Format of the string [field].[asc/desc]. Fields: id, timestamp, name, userId, release, version, public, bookmarked, sessionId. Example: timestamp.asc

- */ - @JsonSetter( - value = "orderBy", - nulls = Nulls.SKIP - ) - public Builder orderBy(Optional orderBy) { - this.orderBy = orderBy; - return this; - } - - public Builder orderBy(String orderBy) { - this.orderBy = Optional.ofNullable(orderBy); - return this; - } - - /** - *

Optional filter to only include traces with a certain version.

- */ - @JsonSetter( - value = "version", - nulls = Nulls.SKIP - ) - public Builder version(Optional version) { - this.version = version; - return this; - } - - public Builder version(String version) { - this.version = Optional.ofNullable(version); - return this; - } - - /** - *

Optional filter to only include traces with a certain release.

- */ - @JsonSetter( - value = "release", - nulls = Nulls.SKIP - ) - public Builder release(Optional release) { - this.release = release; - return this; - } - - public Builder release(String release) { - this.release = Optional.ofNullable(release); - return this; - } - - /** - *

Comma-separated list of fields to include in the response. Available field groups: 'core' (always included), 'io' (input, output, metadata), 'scores', 'observations', 'metrics'. If not specified, all fields are returned. Example: 'core,scores,metrics'. Note: Excluded 'observations' or 'scores' fields return empty arrays; excluded 'metrics' returns -1 for 'totalCost' and 'latency'.

- */ - @JsonSetter( - value = "fields", - nulls = Nulls.SKIP - ) - public Builder fields(Optional fields) { - this.fields = fields; - return this; - } - - public Builder fields(String fields) { - this.fields = Optional.ofNullable(fields); - return this; - } - - /** - * JSON string containing an array of filter conditions. When provided, this takes precedence over query parameter filters (userId, name, sessionId, tags, version, release, environment, fromTimestamp, toTimestamp). - */ - @JsonSetter( - value = "filter", - nulls = Nulls.SKIP - ) - public Builder filter(Optional filter) { - this.filter = filter; - return this; - } - - public Builder filter(String filter) { - this.filter = Optional.ofNullable(filter); - return this; - } - - public GetTracesRequest build() { - return new GetTracesRequest(tags, environment, page, limit, userId, name, sessionId, fromTimestamp, toTimestamp, orderBy, version, release, fields, filter, additionalProperties); - } - - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/trace/types/Sort.java b/src/main/java/com/langfuse/client/resources/trace/types/Sort.java deleted file mode 100644 index b8da8fa..0000000 --- a/src/main/java/com/langfuse/client/resources/trace/types/Sort.java +++ /dev/null @@ -1,126 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.trace.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.HashMap; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = Sort.Builder.class -) -public final class Sort { - private final String id; - - private final Map additionalProperties; - - private Sort(String id, Map additionalProperties) { - this.id = id; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("id") - public String getId() { - return id; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Sort && equalTo((Sort) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Sort other) { - return id.equals(other.id); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.id); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static IdStage builder() { - return new Builder(); - } - - public interface IdStage { - _FinalStage id(@NotNull String id); - - Builder from(Sort other); - } - - public interface _FinalStage { - Sort build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements IdStage, _FinalStage { - private String id; - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(Sort other) { - id(other.getId()); - return this; - } - - @java.lang.Override - @JsonSetter("id") - public _FinalStage id(@NotNull String id) { - this.id = Objects.requireNonNull(id, "id must not be null"); - return this; - } - - @java.lang.Override - public Sort build() { - return new Sort(id, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -} diff --git a/src/main/java/com/langfuse/client/resources/trace/types/Traces.java b/src/main/java/com/langfuse/client/resources/trace/types/Traces.java deleted file mode 100644 index 716d110..0000000 --- a/src/main/java/com/langfuse/client/resources/trace/types/Traces.java +++ /dev/null @@ -1,176 +0,0 @@ -/** - * This file was auto-generated by Fern from our API Definition. - */ - -package com.langfuse.client.resources.trace.types; - -import com.fasterxml.jackson.annotation.JsonAnyGetter; -import com.fasterxml.jackson.annotation.JsonAnySetter; -import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.langfuse.client.core.ObjectMappers; -import java.lang.Object; -import java.lang.String; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Objects; -import org.jetbrains.annotations.NotNull; -import com.langfuse.client.resources.commons.types.TraceWithDetails; -import com.langfuse.client.resources.utils.pagination.types.MetaResponse; - -@JsonInclude(JsonInclude.Include.NON_ABSENT) -@JsonDeserialize( - builder = Traces.Builder.class -) -public final class Traces { - private final List data; - - private final MetaResponse meta; - - private final Map additionalProperties; - - private Traces(List data, MetaResponse meta, - Map additionalProperties) { - this.data = data; - this.meta = meta; - this.additionalProperties = additionalProperties; - } - - @JsonProperty("data") - public List getData() { - return data; - } - - @JsonProperty("meta") - public MetaResponse getMeta() { - return meta; - } - - @java.lang.Override - public boolean equals(Object other) { - if (this == other) return true; - return other instanceof Traces && equalTo((Traces) other); - } - - @JsonAnyGetter - public Map getAdditionalProperties() { - return this.additionalProperties; - } - - private boolean equalTo(Traces other) { - return data.equals(other.data) && meta.equals(other.meta); - } - - @java.lang.Override - public int hashCode() { - return Objects.hash(this.data, this.meta); - } - - @java.lang.Override - public String toString() { - return ObjectMappers.stringify(this); - } - - public static MetaStage builder() { - return new Builder(); - } - - public interface MetaStage { - _FinalStage meta(@NotNull MetaResponse meta); - - Builder from(Traces other); - } - - public interface _FinalStage { - Traces build(); - - _FinalStage additionalProperty(String key, Object value); - - _FinalStage additionalProperties(Map additionalProperties); - - _FinalStage data(List data); - - _FinalStage addData(TraceWithDetails data); - - _FinalStage addAllData(List data); - } - - @JsonIgnoreProperties( - ignoreUnknown = true - ) - public static final class Builder implements MetaStage, _FinalStage { - private MetaResponse meta; - - private List data = new ArrayList<>(); - - @JsonAnySetter - private Map additionalProperties = new HashMap<>(); - - private Builder() { - } - - @java.lang.Override - public Builder from(Traces other) { - data(other.getData()); - meta(other.getMeta()); - return this; - } - - @java.lang.Override - @JsonSetter("meta") - public _FinalStage meta(@NotNull MetaResponse meta) { - this.meta = Objects.requireNonNull(meta, "meta must not be null"); - return this; - } - - @java.lang.Override - public _FinalStage addAllData(List data) { - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public _FinalStage addData(TraceWithDetails data) { - this.data.add(data); - return this; - } - - @java.lang.Override - @JsonSetter( - value = "data", - nulls = Nulls.SKIP - ) - public _FinalStage data(List data) { - this.data.clear(); - if (data != null) { - this.data.addAll(data); - } - return this; - } - - @java.lang.Override - public Traces build() { - return new Traces(data, meta, additionalProperties); - } - - @java.lang.Override - public Builder additionalProperty(String key, Object value) { - this.additionalProperties.put(key, value); - return this; - } - - @java.lang.Override - public Builder additionalProperties(Map additionalProperties) { - this.additionalProperties.putAll(additionalProperties); - return this; - } - } -}