Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/main/java/com/google/genai/Models.java
Original file line number Diff line number Diff line change
Expand Up @@ -4487,6 +4487,7 @@ ObjectNode candidateFromMldev(ApiClient apiClient, JsonNode fromObject, ObjectNo
ObjectNode generateContentResponseFromMldev(
ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode();

if (Common.getValueByPath(fromObject, new String[] {"candidates"}) != null) {
ArrayNode keyArray =
(ArrayNode) Common.getValueByPath(fromObject, new String[] {"candidates"});
Expand Down Expand Up @@ -5337,6 +5338,7 @@ ObjectNode candidateFromVertex(
ObjectNode generateContentResponseFromVertex(
ApiClient apiClient, JsonNode fromObject, ObjectNode parentObject) {
ObjectNode toObject = JsonSerializable.objectMapper.createObjectNode();

if (Common.getValueByPath(fromObject, new String[] {"candidates"}) != null) {
ArrayNode keyArray =
(ArrayNode) Common.getValueByPath(fromObject, new String[] {"candidates"});
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/com/google/genai/types/GenerateContentConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ public abstract class GenerateContentConfig extends JsonSerializable {
@JsonProperty("httpOptions")
public abstract Optional<HttpOptions> httpOptions();

/** If true, the raw HTTP response will be returned in the 'sdk_http_response' field. */
@JsonProperty("shouldReturnHttpResponse")
public abstract Optional<Boolean> shouldReturnHttpResponse();

/**
* Instructions for the model to steer it toward better performance. For example, "Answer as
* concisely as possible" or "Don't use technical terms in your response".
Expand Down Expand Up @@ -233,6 +237,15 @@ public Builder httpOptions(HttpOptions.Builder httpOptionsBuilder) {
return httpOptions(httpOptionsBuilder.build());
}

/**
* Setter for shouldReturnHttpResponse.
*
* <p>shouldReturnHttpResponse: If true, the raw HTTP response will be returned in the
* 'sdk_http_response' field.
*/
@JsonProperty("shouldReturnHttpResponse")
public abstract Builder shouldReturnHttpResponse(boolean shouldReturnHttpResponse);

/**
* Setter for systemInstruction.
*
Expand Down
21 changes: 21 additions & 0 deletions src/main/java/com/google/genai/types/GenerateContentResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
@AutoValue
@JsonDeserialize(builder = GenerateContentResponse.Builder.class)
public abstract class GenerateContentResponse extends JsonSerializable {
/** Used to retain the full HTTP response. */
@JsonProperty("sdkHttpResponse")
public abstract Optional<HttpResponse> sdkHttpResponse();

/** Response variations returned by the model. */
@JsonProperty("candidates")
public abstract Optional<List<Candidate>> candidates();
Expand Down Expand Up @@ -89,6 +93,23 @@ private static Builder create() {
return new AutoValue_GenerateContentResponse.Builder();
}

/**
* Setter for sdkHttpResponse.
*
* <p>sdkHttpResponse: Used to retain the full HTTP response.
*/
@JsonProperty("sdkHttpResponse")
public abstract Builder sdkHttpResponse(HttpResponse sdkHttpResponse);

/**
* Setter for sdkHttpResponse builder.
*
* <p>sdkHttpResponse: Used to retain the full HTTP response.
*/
public Builder sdkHttpResponse(HttpResponse.Builder sdkHttpResponseBuilder) {
return sdkHttpResponse(sdkHttpResponseBuilder.build());
}

/**
* Setter for candidates.
*
Expand Down