UPDATE 12-sept

This commit is contained in:
PAVEL PALMA
2025-09-12 16:09:42 -06:00
parent 62c09be67d
commit 6120b8d6c2
17 changed files with 89 additions and 375 deletions

View File

@@ -1,53 +0,0 @@
/*
* Copyright 2025 Google. This software is provided as-is, without warranty or representation for any use or purpose.
* Your use of it is subject to your agreement with Google.
*/
package com.example.dto.gemini;
import com.example.dto.dialogflow.conversation.ConversationEntryEntity;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.cloud.Timestamp;
import java.util.Map;
import java.util.Optional;
@JsonInclude(JsonInclude.Include.NON_NULL)
public record ConversationEntrySummaryDTO(
@JsonProperty("text") String text,
@JsonProperty("timestamp") Timestamp timestamp,
Optional<ConversationEntryEntity> type,
@JsonProperty("intentDisplayName") String intentDisplayName,
@JsonProperty("parameters") Map<String, Object> parameters,
@JsonProperty("webhookStatus") String webhookStatus,
@JsonProperty("canal") String canal
) {
@JsonCreator
public ConversationEntrySummaryDTO(
@JsonProperty("text") String text,
@JsonProperty("timestamp") Timestamp timestamp,
@JsonProperty("type") String typeString,
@JsonProperty("intentDisplayName") String intentDisplayName,
@JsonProperty("parameters") Map<String, Object> parameters,
@JsonProperty("webhookStatus") String webhookStatus,
@JsonProperty("canal") String canal
) {
this(
text,
timestamp,
Optional.ofNullable(typeString).map(t -> {
try {
return ConversationEntryEntity.valueOf(t);
} catch (IllegalArgumentException e) {
System.err.println("Warning: Invalid ConversationEntryType string during deserialization: " + t);
return null;
}
}),
intentDisplayName,
parameters,
webhookStatus,
canal
);
}
}

View File

@@ -1,37 +0,0 @@
/*
* Copyright 2025 Google. This software is provided as-is, without warranty or representation for any use or purpose.
* Your use of it is subject to your agreement with Google.
*/
package com.example.dto.gemini;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.cloud.Timestamp;
import java.util.Collections;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
public record ConversationSessionSummaryDTO(
@JsonProperty("sessionId") String sessionId,
@JsonProperty("userId") String userId,
@JsonProperty("startTime") Timestamp startTime,
@JsonProperty("lastUpdated") Timestamp lastUpdated,
@JsonProperty("entries") List<ConversationEntrySummaryDTO> entries
) {
@JsonCreator
public ConversationSessionSummaryDTO(
@JsonProperty("sessionId") String sessionId,
@JsonProperty("userId") String userId,
@JsonProperty("startTime") Timestamp startTime,
@JsonProperty("lastUpdated") Timestamp lastUpdated,
@JsonProperty("entries") List<ConversationEntrySummaryDTO> entries
) {
this.sessionId = sessionId;
this.userId = userId;
this.startTime = startTime;
this.lastUpdated = lastUpdated;
this.entries = entries != null ? entries : Collections.emptyList();
}
}

View File

@@ -1,29 +0,0 @@
/*
* Copyright 2025 Google. This software is provided as-is, without warranty or representation for any use or purpose.
* Your use of it is subject to your agreement with Google.
*/
package com.example.dto.gemini;
import jakarta.validation.constraints.DecimalMax;
import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
public record ConversationSummaryRequest(
@NotBlank(message = "Session ID is required.")
String sessionId,
@NotBlank(message = "Prompt for summarization is required.")
String prompt,
@DecimalMin(value = "0.0", message = "Temperature must be between 0.0 and 1.0.")
@DecimalMax(value = "0.1", message = "Temperature must be between 0.0 and 1.0.")
Float temperature,
@DecimalMin(value = "0.1", message = "Max Output Tokens must be at least 1.")
Integer maxOutputTokens,
@NotBlank(message = "model is required.")
String modelName,
@NotBlank(message = "topP is required.")
@DecimalMin(value = "0.0", message = "topP must be between 0.0 and 1.0.")
Float top_P
) {}

View File

@@ -1,13 +0,0 @@
/*
* Copyright 2025 Google. This software is provided as-is, without warranty or representation for any use or purpose.
* Your use of it is subject to your agreement with Google.
*/
package com.example.dto.gemini;
import jakarta.validation.constraints.NotBlank;
public record ConversationSummaryResponse(
@NotBlank
String summaryText
) {}