Skip to content

Commit ed48a43

Browse files
feat(specs): add generate code endpoint to ingestion specs (generated)
algolia/api-clients-automation#3489 Co-authored-by: algolia-bot <[email protected]> Co-authored-by: Clément Vannicatte <[email protected]>
1 parent c6c235d commit ed48a43

File tree

3 files changed

+223
-1
lines changed

3 files changed

+223
-1
lines changed

algoliasearch/src/main/java/com/algolia/api/IngestionClient.java

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,70 @@ public CompletableFuture<TaskUpdateResponse> enableTaskV1Async(@Nonnull String t
12901290
return this.enableTaskV1Async(taskID, null);
12911291
}
12921292

1293+
/**
1294+
* Generates code for the selected model based on the given prompt.
1295+
*
1296+
* @param generateTransformationCodePayload (required)
1297+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
1298+
* the transporter requestOptions.
1299+
* @throws AlgoliaRuntimeException If it fails to process the API call
1300+
*/
1301+
public GenerateTransformationCodeResponse generateTransformationCode(
1302+
@Nonnull GenerateTransformationCodePayload generateTransformationCodePayload,
1303+
RequestOptions requestOptions
1304+
) throws AlgoliaRuntimeException {
1305+
return LaunderThrowable.await(generateTransformationCodeAsync(generateTransformationCodePayload, requestOptions));
1306+
}
1307+
1308+
/**
1309+
* Generates code for the selected model based on the given prompt.
1310+
*
1311+
* @param generateTransformationCodePayload (required)
1312+
* @throws AlgoliaRuntimeException If it fails to process the API call
1313+
*/
1314+
public GenerateTransformationCodeResponse generateTransformationCode(
1315+
@Nonnull GenerateTransformationCodePayload generateTransformationCodePayload
1316+
) throws AlgoliaRuntimeException {
1317+
return this.generateTransformationCode(generateTransformationCodePayload, null);
1318+
}
1319+
1320+
/**
1321+
* (asynchronously) Generates code for the selected model based on the given prompt.
1322+
*
1323+
* @param generateTransformationCodePayload (required)
1324+
* @param requestOptions The requestOptions to send along with the query, they will be merged with
1325+
* the transporter requestOptions.
1326+
* @throws AlgoliaRuntimeException If it fails to process the API call
1327+
*/
1328+
public CompletableFuture<GenerateTransformationCodeResponse> generateTransformationCodeAsync(
1329+
@Nonnull GenerateTransformationCodePayload generateTransformationCodePayload,
1330+
RequestOptions requestOptions
1331+
) throws AlgoliaRuntimeException {
1332+
Parameters.requireNonNull(
1333+
generateTransformationCodePayload,
1334+
"Parameter `generateTransformationCodePayload` is required when calling" + " `generateTransformationCode`."
1335+
);
1336+
1337+
HttpRequest request = HttpRequest.builder()
1338+
.setPath("/1/transformations/models")
1339+
.setMethod("POST")
1340+
.setBody(generateTransformationCodePayload)
1341+
.build();
1342+
return executeAsync(request, requestOptions, new TypeReference<GenerateTransformationCodeResponse>() {});
1343+
}
1344+
1345+
/**
1346+
* (asynchronously) Generates code for the selected model based on the given prompt.
1347+
*
1348+
* @param generateTransformationCodePayload (required)
1349+
* @throws AlgoliaRuntimeException If it fails to process the API call
1350+
*/
1351+
public CompletableFuture<GenerateTransformationCodeResponse> generateTransformationCodeAsync(
1352+
@Nonnull GenerateTransformationCodePayload generateTransformationCodePayload
1353+
) throws AlgoliaRuntimeException {
1354+
return this.generateTransformationCodeAsync(generateTransformationCodePayload, null);
1355+
}
1356+
12931357
/**
12941358
* Retrieves an authentication resource by its ID.
12951359
*
@@ -2859,7 +2923,7 @@ public TransformationModels listTransformationModels() throws AlgoliaRuntimeExce
28592923
*/
28602924
public CompletableFuture<TransformationModels> listTransformationModelsAsync(RequestOptions requestOptions)
28612925
throws AlgoliaRuntimeException {
2862-
HttpRequest request = HttpRequest.builder().setPath("/1/transformations/copilot").setMethod("GET").build();
2926+
HttpRequest request = HttpRequest.builder().setPath("/1/transformations/models").setMethod("GET").build();
28632927

28642928
return executeAsync(request, requestOptions, new TypeReference<TransformationModels>() {});
28652929
}
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.ingestion;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.Objects;
9+
10+
/** GenerateTransformationCodePayload */
11+
public class GenerateTransformationCodePayload {
12+
13+
@JsonProperty("id")
14+
private String id;
15+
16+
@JsonProperty("systemPrompt")
17+
private String systemPrompt;
18+
19+
@JsonProperty("userPrompt")
20+
private String userPrompt;
21+
22+
public GenerateTransformationCodePayload setId(String id) {
23+
this.id = id;
24+
return this;
25+
}
26+
27+
/** Get id */
28+
@javax.annotation.Nonnull
29+
public String getId() {
30+
return id;
31+
}
32+
33+
public GenerateTransformationCodePayload setSystemPrompt(String systemPrompt) {
34+
this.systemPrompt = systemPrompt;
35+
return this;
36+
}
37+
38+
/** Get systemPrompt */
39+
@javax.annotation.Nullable
40+
public String getSystemPrompt() {
41+
return systemPrompt;
42+
}
43+
44+
public GenerateTransformationCodePayload setUserPrompt(String userPrompt) {
45+
this.userPrompt = userPrompt;
46+
return this;
47+
}
48+
49+
/** Get userPrompt */
50+
@javax.annotation.Nonnull
51+
public String getUserPrompt() {
52+
return userPrompt;
53+
}
54+
55+
@Override
56+
public boolean equals(Object o) {
57+
if (this == o) {
58+
return true;
59+
}
60+
if (o == null || getClass() != o.getClass()) {
61+
return false;
62+
}
63+
GenerateTransformationCodePayload generateTransformationCodePayload = (GenerateTransformationCodePayload) o;
64+
return (
65+
Objects.equals(this.id, generateTransformationCodePayload.id) &&
66+
Objects.equals(this.systemPrompt, generateTransformationCodePayload.systemPrompt) &&
67+
Objects.equals(this.userPrompt, generateTransformationCodePayload.userPrompt)
68+
);
69+
}
70+
71+
@Override
72+
public int hashCode() {
73+
return Objects.hash(id, systemPrompt, userPrompt);
74+
}
75+
76+
@Override
77+
public String toString() {
78+
StringBuilder sb = new StringBuilder();
79+
sb.append("class GenerateTransformationCodePayload {\n");
80+
sb.append(" id: ").append(toIndentedString(id)).append("\n");
81+
sb.append(" systemPrompt: ").append(toIndentedString(systemPrompt)).append("\n");
82+
sb.append(" userPrompt: ").append(toIndentedString(userPrompt)).append("\n");
83+
sb.append("}");
84+
return sb.toString();
85+
}
86+
87+
/**
88+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
89+
*/
90+
private String toIndentedString(Object o) {
91+
if (o == null) {
92+
return "null";
93+
}
94+
return o.toString().replace("\n", "\n ");
95+
}
96+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost
2+
// - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
3+
4+
package com.algolia.model.ingestion;
5+
6+
import com.fasterxml.jackson.annotation.*;
7+
import com.fasterxml.jackson.databind.annotation.*;
8+
import java.util.Objects;
9+
10+
/** GenerateTransformationCodeResponse */
11+
public class GenerateTransformationCodeResponse {
12+
13+
@JsonProperty("generatedCode")
14+
private String generatedCode;
15+
16+
public GenerateTransformationCodeResponse setGeneratedCode(String generatedCode) {
17+
this.generatedCode = generatedCode;
18+
return this;
19+
}
20+
21+
/** Get generatedCode */
22+
@javax.annotation.Nullable
23+
public String getGeneratedCode() {
24+
return generatedCode;
25+
}
26+
27+
@Override
28+
public boolean equals(Object o) {
29+
if (this == o) {
30+
return true;
31+
}
32+
if (o == null || getClass() != o.getClass()) {
33+
return false;
34+
}
35+
GenerateTransformationCodeResponse generateTransformationCodeResponse = (GenerateTransformationCodeResponse) o;
36+
return Objects.equals(this.generatedCode, generateTransformationCodeResponse.generatedCode);
37+
}
38+
39+
@Override
40+
public int hashCode() {
41+
return Objects.hash(generatedCode);
42+
}
43+
44+
@Override
45+
public String toString() {
46+
StringBuilder sb = new StringBuilder();
47+
sb.append("class GenerateTransformationCodeResponse {\n");
48+
sb.append(" generatedCode: ").append(toIndentedString(generatedCode)).append("\n");
49+
sb.append("}");
50+
return sb.toString();
51+
}
52+
53+
/**
54+
* Convert the given object to string with each line indented by 4 spaces (except the first line).
55+
*/
56+
private String toIndentedString(Object o) {
57+
if (o == null) {
58+
return "null";
59+
}
60+
return o.toString().replace("\n", "\n ");
61+
}
62+
}

0 commit comments

Comments
 (0)