Skip to content

Commit 9823382

Browse files
authored
[OpenAI] Regenerate Code with later changes in typespec definition (Azure#37604)
1 parent 2c7f920 commit 9823382

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2562
-1166
lines changed

sdk/openai/azure-ai-openai/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
Use `getAudioTranscription` or `getAudioTranscriptionWithResponse` convenience methods from respective classes.
1111
- Removed methods `getAudioTranslationAsResponseObject` and `getAudioTranslationAsResponseObjectWithResponse` from `OpenAIClient` and `OpenAIAsyncClient` classes.
1212
Use `getAudioTranslation` or `getAudioTranslationWithResponse` convenience methods from respective classes.
13+
- Removed property, ResponseError `error` from `ImageLocation` class.
1314

1415
### Bugs Fixed
1516

sdk/openai/azure-ai-openai/README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -276,15 +276,9 @@ ImageGenerationOptions imageGenerationOptions = new ImageGenerationOptions(
276276
ImageResponse images = client.getImages(imageGenerationOptions);
277277

278278
for (ImageLocation imageLocation : images.getData()) {
279-
ResponseError error = imageLocation.getError();
280-
if (error != null) {
281-
System.out.printf("Image generation operation failed. Error code: %s, error message: %s.%n",
282-
error.getCode(), error.getMessage());
283-
} else {
284-
System.out.printf(
285-
"Image location URL that provides temporary access to download the generated image is %s.%n",
286-
imageLocation.getUrl());
287-
}
279+
System.out.printf(
280+
"Image location URL that provides temporary access to download the generated image is %s.%n",
281+
imageLocation.getUrl());
288282
}
289283
```
290284

sdk/openai/azure-ai-openai/assets.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"AssetsRepo": "Azure/azure-sdk-assets",
33
"AssetsRepoPrefixPath": "java",
44
"TagPrefix": "java/openai/azure-ai-openai",
5-
"Tag": "java/openai/azure-ai-openai_a191d5c4de"
5+
"Tag": "java/openai/azure-ai-openai_d62b613ecd"
66
}

sdk/openai/azure-ai-openai/src/main/java/com/azure/ai/openai/implementation/OpenAIClientImpl.java

Lines changed: 1074 additions & 1074 deletions
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
// Code generated by Microsoft (R) TypeSpec Code Generator.
4+
package com.azure.ai.openai.implementation.models;
5+
6+
import com.azure.ai.openai.models.AzureOpenAIOperationState;
7+
import com.azure.core.annotation.Generated;
8+
import com.azure.core.annotation.Immutable;
9+
import com.azure.core.models.ResponseError;
10+
import com.fasterxml.jackson.annotation.JsonCreator;
11+
import com.fasterxml.jackson.annotation.JsonProperty;
12+
import java.time.Instant;
13+
import java.time.OffsetDateTime;
14+
import java.time.ZoneOffset;
15+
16+
/** A polling status update or final response payload for an image operation. */
17+
@Immutable
18+
public final class BatchImageGenerationOperationResponse {
19+
20+
/*
21+
* The ID of the operation.
22+
*/
23+
@Generated
24+
@JsonProperty(value = "id")
25+
private String id;
26+
27+
/*
28+
* A timestamp when this job or item was created (in unix epochs).
29+
*/
30+
@Generated
31+
@JsonProperty(value = "created")
32+
private long createdAt;
33+
34+
/*
35+
* A timestamp when this operation and its associated images expire and will be deleted (in unix epochs).
36+
*/
37+
@Generated
38+
@JsonProperty(value = "expires")
39+
private Long expires;
40+
41+
/*
42+
* The result of the operation if the operation succeeded.
43+
*/
44+
@Generated
45+
@JsonProperty(value = "result")
46+
private ImageGenerations result;
47+
48+
/*
49+
* The status of the operation
50+
*/
51+
@Generated
52+
@JsonProperty(value = "status")
53+
private AzureOpenAIOperationState status;
54+
55+
/*
56+
* The error if the operation failed.
57+
*/
58+
@Generated
59+
@JsonProperty(value = "error")
60+
private ResponseError error;
61+
62+
/**
63+
* Creates an instance of BatchImageGenerationOperationResponse class.
64+
*
65+
* @param id the id value to set.
66+
* @param createdAt the createdAt value to set.
67+
* @param status the status value to set.
68+
*/
69+
@Generated
70+
private BatchImageGenerationOperationResponse(
71+
String id, OffsetDateTime createdAt, AzureOpenAIOperationState status) {
72+
this.id = id;
73+
this.createdAt = createdAt.toEpochSecond();
74+
this.status = status;
75+
}
76+
77+
@Generated
78+
@JsonCreator
79+
private BatchImageGenerationOperationResponse(
80+
@JsonProperty(value = "id") String id,
81+
@JsonProperty(value = "created") long createdAt,
82+
@JsonProperty(value = "status") AzureOpenAIOperationState status) {
83+
this(id, OffsetDateTime.ofInstant(Instant.ofEpochSecond(createdAt), ZoneOffset.UTC), status);
84+
}
85+
86+
/**
87+
* Get the id property: The ID of the operation.
88+
*
89+
* @return the id value.
90+
*/
91+
@Generated
92+
public String getId() {
93+
return this.id;
94+
}
95+
96+
/**
97+
* Get the createdAt property: A timestamp when this job or item was created (in unix epochs).
98+
*
99+
* @return the createdAt value.
100+
*/
101+
@Generated
102+
public OffsetDateTime getCreatedAt() {
103+
return OffsetDateTime.ofInstant(Instant.ofEpochSecond(this.createdAt), ZoneOffset.UTC);
104+
}
105+
106+
/**
107+
* Get the expires property: A timestamp when this operation and its associated images expire and will be deleted
108+
* (in unix epochs).
109+
*
110+
* @return the expires value.
111+
*/
112+
@Generated
113+
public Long getExpires() {
114+
return this.expires;
115+
}
116+
117+
/**
118+
* Get the result property: The result of the operation if the operation succeeded.
119+
*
120+
* @return the result value.
121+
*/
122+
@Generated
123+
public ImageGenerations getResult() {
124+
return this.result;
125+
}
126+
127+
/**
128+
* Get the status property: The status of the operation.
129+
*
130+
* @return the status value.
131+
*/
132+
@Generated
133+
public AzureOpenAIOperationState getStatus() {
134+
return this.status;
135+
}
136+
137+
/**
138+
* Get the error property: The error if the operation failed.
139+
*
140+
* @return the error value.
141+
*/
142+
@Generated
143+
public ResponseError getError() {
144+
return this.error;
145+
}
146+
}

0 commit comments

Comments
 (0)