Skip to content

Commit

Permalink
CodeGen from PR 29297 in Azure/azure-rest-api-specs
Browse files Browse the repository at this point in the history
Merge b05cf2651969c8c8bc7f38a7fe0e5de1a035f951 into bf9738223ed8c1c25485980b74cfb8ef4158b847
  • Loading branch information
SDKAuto committed Jun 3, 2024
1 parent d0c603d commit e215d56
Show file tree
Hide file tree
Showing 77 changed files with 12,623 additions and 2,655 deletions.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ public enum AssistantsServiceVersion implements ServiceVersion {
/**
* Enum value 2024-02-15-preview.
*/
V2024_02_15_PREVIEW("2024-02-15-preview");
V2024_02_15_PREVIEW("2024-02-15-preview"),

/**
* Enum value 2024-05-01-preview.
*/
V2024_05_01_PREVIEW("2024-05-01-preview");

private final String version;

Expand All @@ -35,6 +40,6 @@ public String getVersion() {
* @return The latest {@link AssistantsServiceVersion}.
*/
public static AssistantsServiceVersion getLatest() {
return V2024_02_15_PREVIEW;
return V2024_05_01_PREVIEW;
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.ai.openai.assistants.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
* The CreateVectorStoreFileBatchRequest model.
*/
@Immutable
public final class CreateVectorStoreFileBatchRequest implements JsonSerializable<CreateVectorStoreFileBatchRequest> {
/*
* A list of File IDs that the vector store should use. Useful for tools like `file_search` that can access files.
*/
@Generated
private final List<String> fileIds;

/**
* Creates an instance of CreateVectorStoreFileBatchRequest class.
*
* @param fileIds the fileIds value to set.
*/
@Generated
public CreateVectorStoreFileBatchRequest(List<String> fileIds) {
this.fileIds = fileIds;
}

/**
* Get the fileIds property: A list of File IDs that the vector store should use. Useful for tools like
* `file_search` that can access files.
*
* @return the fileIds value.
*/
@Generated
public List<String> getFileIds() {
return this.fileIds;
}

/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("file_ids", this.fileIds, (writer, element) -> writer.writeString(element));
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of CreateVectorStoreFileBatchRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CreateVectorStoreFileBatchRequest if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the CreateVectorStoreFileBatchRequest.
*/
@Generated
public static CreateVectorStoreFileBatchRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
List<String> fileIds = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("file_ids".equals(fieldName)) {
fileIds = reader.readArray(reader1 -> reader1.getString());
} else {
reader.skipChildren();
}
}
return new CreateVectorStoreFileBatchRequest(fileIds);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.ai.openai.assistants.implementation.models;

import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;

/**
* The CreateVectorStoreFileRequest model.
*/
@Immutable
public final class CreateVectorStoreFileRequest implements JsonSerializable<CreateVectorStoreFileRequest> {
/*
* A File ID that the vector store should use. Useful for tools like `file_search` that can access files.
*/
@Generated
private final String fileId;

/**
* Creates an instance of CreateVectorStoreFileRequest class.
*
* @param fileId the fileId value to set.
*/
@Generated
public CreateVectorStoreFileRequest(String fileId) {
this.fileId = fileId;
}

/**
* Get the fileId property: A File ID that the vector store should use. Useful for tools like `file_search` that can
* access files.
*
* @return the fileId value.
*/
@Generated
public String getFileId() {
return this.fileId;
}

/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("file_id", this.fileId);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of CreateVectorStoreFileRequest from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of CreateVectorStoreFileRequest if the JsonReader was pointing to an instance of it, or null
* if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the CreateVectorStoreFileRequest.
*/
@Generated
public static CreateVectorStoreFileRequest fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
String fileId = null;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("file_id".equals(fieldName)) {
fileId = reader.getString();
} else {
reader.skipChildren();
}
}
return new CreateVectorStoreFileRequest(fileId);
});
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) TypeSpec Code Generator.

package com.azure.ai.openai.assistants.implementation.models;

import com.azure.ai.openai.assistants.models.VectorStore;
import com.azure.core.annotation.Generated;
import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;

/**
* The response data for a requested list of items.
*/
@Immutable
public final class OpenAIPageableListOfVectorStore implements JsonSerializable<OpenAIPageableListOfVectorStore> {
/*
* The object type, which is always list.
*/
@Generated
private final String object = "list";

/*
* The requested list of items.
*/
@Generated
private final List<VectorStore> data;

/*
* The first ID represented in this list.
*/
@Generated
private final String firstId;

/*
* The last ID represented in this list.
*/
@Generated
private final String lastId;

/*
* A value indicating whether there are additional values available not captured in this list.
*/
@Generated
private final boolean hasMore;

/**
* Creates an instance of OpenAIPageableListOfVectorStore class.
*
* @param data the data value to set.
* @param firstId the firstId value to set.
* @param lastId the lastId value to set.
* @param hasMore the hasMore value to set.
*/
@Generated
private OpenAIPageableListOfVectorStore(List<VectorStore> data, String firstId, String lastId, boolean hasMore) {
this.data = data;
this.firstId = firstId;
this.lastId = lastId;
this.hasMore = hasMore;
}

/**
* Get the object property: The object type, which is always list.
*
* @return the object value.
*/
@Generated
public String getObject() {
return this.object;
}

/**
* Get the data property: The requested list of items.
*
* @return the data value.
*/
@Generated
public List<VectorStore> getData() {
return this.data;
}

/**
* Get the firstId property: The first ID represented in this list.
*
* @return the firstId value.
*/
@Generated
public String getFirstId() {
return this.firstId;
}

/**
* Get the lastId property: The last ID represented in this list.
*
* @return the lastId value.
*/
@Generated
public String getLastId() {
return this.lastId;
}

/**
* Get the hasMore property: A value indicating whether there are additional values available not captured in this
* list.
*
* @return the hasMore value.
*/
@Generated
public boolean isHasMore() {
return this.hasMore;
}

/**
* {@inheritDoc}
*/
@Generated
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("object", this.object);
jsonWriter.writeArrayField("data", this.data, (writer, element) -> writer.writeJson(element));
jsonWriter.writeStringField("first_id", this.firstId);
jsonWriter.writeStringField("last_id", this.lastId);
jsonWriter.writeBooleanField("has_more", this.hasMore);
return jsonWriter.writeEndObject();
}

/**
* Reads an instance of OpenAIPageableListOfVectorStore from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of OpenAIPageableListOfVectorStore if the JsonReader was pointing to an instance of it, or
* null if it was pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the OpenAIPageableListOfVectorStore.
*/
@Generated
public static OpenAIPageableListOfVectorStore fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
List<VectorStore> data = null;
String firstId = null;
String lastId = null;
boolean hasMore = false;
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();

if ("data".equals(fieldName)) {
data = reader.readArray(reader1 -> VectorStore.fromJson(reader1));
} else if ("first_id".equals(fieldName)) {
firstId = reader.getString();
} else if ("last_id".equals(fieldName)) {
lastId = reader.getString();
} else if ("has_more".equals(fieldName)) {
hasMore = reader.getBoolean();
} else {
reader.skipChildren();
}
}
return new OpenAIPageableListOfVectorStore(data, firstId, lastId, hasMore);
});
}
}
Loading

0 comments on commit e215d56

Please sign in to comment.