Skip to content

Commit 253f36e

Browse files
committed
GetFileAssociations
1 parent 45770fe commit 253f36e

23 files changed

+2603
-2293
lines changed

codegen/generator/src/Visitors/PaginationVisitor.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ namespace OpenAILibraryPlugin.Visitors;
1818
public class PaginationVisitor : ScmLibraryVisitor
1919
{
2020

21-
private static readonly string[] _paginationParamsToReplace = ["after", "before", "limit", "order", "model", "metadata"];
21+
private static readonly string[] _paginationParamsToReplace = ["after", "before", "limit", "order", "model", "metadata", "filter"];
2222
private static readonly Dictionary<string, string> _paramReplacementMap = new()
2323
{
2424
{ "after", "AfterId" },
2525
{ "before", "BeforeId" },
2626
{ "limit", "PageSizeLimit" },
2727
{ "order", "Order" },
2828
{ "model", "Model" },
29-
{ "metadata", "Metadata" }
29+
{ "metadata", "Metadata" },
30+
{ "filter", "Filter" }
3031
};
3132
private static readonly Dictionary<string, (string ReturnType, string OptionsType, string[] ParamsToReplace)> _optionsReplacements = new()
3233
{
@@ -53,6 +54,14 @@ public class PaginationVisitor : ScmLibraryVisitor
5354
{
5455
"GetVectorStoresAsync",
5556
("VectorStore", "VectorStoreCollectionOptions", _paginationParamsToReplace)
57+
},
58+
{
59+
"GetFileAssociations",
60+
("VectorStoreFileAssociation", "VectorStoreFileAssociationCollectionOptions", _paginationParamsToReplace)
61+
},
62+
{
63+
"GetFileAssociationsAsync",
64+
("VectorStoreFileAssociation", "VectorStoreFileAssociationCollectionOptions", _paginationParamsToReplace)
5665
}
5766
};
5867

specification/base/typespec/vector-stores/models.tsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ model ListVectorStoreFilesResponse {
200200
// Tool customization: add a clear enum enforcement of constrained 'object' label
201201
object: "list";
202202

203-
data: VectorStoreFileObject[];
203+
@pageItems data: VectorStoreFileObject[];
204204
first_id: string;
205-
last_id: string;
205+
@continuationToken last_id: string;
206206
has_more: boolean;
207207
}
208208

specification/base/typespec/vector-stores/operations.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ interface VectorStores {
126126
@get
127127
@operationId("listVectorStoreFiles")
128128
@summary("Returns a list of vector store files.")
129+
@list
129130
listVectorStoreFiles(
130131
...AcceptJsonHeader,
131132

specification/client/models/vector-stores.models.tsp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,15 @@ model VectorStoreCollectionOptions {
4141
...CollectionBeforeQueryParameter,
4242
...CollectionLimitQueryParameter,
4343
...PageOrderQueryParameter,
44+
}
45+
46+
@access(Access.public)
47+
@usage(Usage.input)
48+
model VectorStoreFileAssociationCollectionOptions {
49+
...CollectionAfterQueryParameter,
50+
...CollectionBeforeQueryParameter,
51+
...CollectionLimitQueryParameter,
52+
...PageOrderQueryParameter,
53+
54+
@query filter?: ListVectorStoreFilesFilter;
4455
}

specification/client/vector-stores.client.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ using Azure.ClientGenerator.Core;
1313
@@clientName(VectorStores.cancelVectorStoreFileBatch, "CancelBatchFileJob");
1414
@@clientName(VectorStores.getVectorStoreFile, "GetFileAssociation");
1515
@@clientName(VectorStores.listVectorStores, "GetVectorStores");
16+
@@clientName(VectorStores.listVectorStoreFiles, "GetFileAssociations");

src/Custom/VectorStores/Internal/Pagination/AsyncVectorStoreFileCollectionResult.cs

Lines changed: 0 additions & 98 deletions
This file was deleted.

src/Custom/VectorStores/Internal/Pagination/VectorStoreFileCollectionResult.cs

Lines changed: 0 additions & 103 deletions
This file was deleted.

src/Custom/VectorStores/VectorStoreClient.Protocol.cs

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77

88
namespace OpenAI.VectorStores;
99

10-
[CodeGenSuppress("GetVectorStoreFilesAsync", typeof(string), typeof(int?), typeof(string), typeof(string), typeof(string), typeof(string), typeof(RequestOptions))]
11-
[CodeGenSuppress("GetVectorStoreFiles", typeof(string), typeof(int?), typeof(string), typeof(string), typeof(string), typeof(string), typeof(RequestOptions))]
1210
[CodeGenSuppress("CreateVectorStoreFileAsync", typeof(string), typeof(BinaryContent), typeof(RequestOptions))]
1311
[CodeGenSuppress("CreateVectorStoreFile", typeof(string), typeof(BinaryContent), typeof(RequestOptions))]
1412
[CodeGenSuppress("CreateVectorStoreFileBatchAsync", typeof(string), typeof(BinaryContent), typeof(RequestOptions))]
@@ -104,77 +102,6 @@ internal virtual ClientResult GetVectorStore(string vectorStoreId, RequestOption
104102
return ClientResult.FromResponse(Pipeline.ProcessMessage(message, options));
105103
}
106104

107-
/// <summary>
108-
/// [Protocol Method] Returns a paginated collection of vector store files.
109-
/// </summary>
110-
/// <param name="vectorStoreId"> The ID of the vector store that the files belong to. </param>
111-
/// <param name="limit">
112-
/// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
113-
/// default is 20.
114-
/// </param>
115-
/// <param name="order">
116-
/// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
117-
/// for descending order. Allowed values: "asc" | "desc"
118-
/// </param>
119-
/// <param name="after">
120-
/// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
121-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
122-
/// subsequent call can include after=obj_foo in order to fetch the next page of the list.
123-
/// </param>
124-
/// <param name="before">
125-
/// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
126-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
127-
/// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
128-
/// </param>
129-
/// <param name="filter"> Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. </param>
130-
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
131-
/// <exception cref="ArgumentNullException"> <paramref name="vectorStoreId"/> is null. </exception>
132-
/// <exception cref="ArgumentException"> <paramref name="vectorStoreId"/> is an empty string, and was expected to be non-empty. </exception>
133-
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
134-
/// <returns> A collection of service responses, each holding a page of values. </returns>
135-
public virtual AsyncCollectionResult GetFileAssociationsAsync(string vectorStoreId, int? limit, string order, string after, string before, string filter, RequestOptions options)
136-
{
137-
Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId));
138-
139-
return new AsyncVectorStoreFileCollectionResult(this, Pipeline, options, vectorStoreId, limit, order, after, before, filter);
140-
}
141-
142-
/// <summary>
143-
/// [Protocol Method] Returns a paginated collection of vector store files.
144-
/// </summary>
145-
/// <param name="vectorStoreId"> The ID of the vector store that the files belong to. </param>
146-
/// <param name="limit">
147-
/// A limit on the number of objects to be returned. Limit can range between 1 and 100, and the
148-
/// default is 20.
149-
/// </param>
150-
/// <param name="order">
151-
/// Sort order by the `created_at` timestamp of the objects. `asc` for ascending order and`desc`
152-
/// for descending order. Allowed values: "asc" | "desc"
153-
/// </param>
154-
/// <param name="after">
155-
/// A cursor for use in pagination. `after` is an object ID that defines your place in the list.
156-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
157-
/// subsequent call can include after=obj_foo in order to fetch the next page of the list.
158-
/// </param>
159-
/// <param name="before">
160-
/// A cursor for use in pagination. `before` is an object ID that defines your place in the list.
161-
/// For instance, if you make a list request and receive 100 objects, ending with obj_foo, your
162-
/// subsequent call can include before=obj_foo in order to fetch the previous page of the list.
163-
/// </param>
164-
/// <param name="filter"> Filter by file status. One of `in_progress`, `completed`, `failed`, `cancelled`. </param>
165-
/// <param name="options"> The request options, which can override default behaviors of the client pipeline on a per-call basis. </param>
166-
/// <exception cref="ArgumentNullException"> <paramref name="vectorStoreId"/> is null. </exception>
167-
/// <exception cref="ArgumentException"> <paramref name="vectorStoreId"/> is an empty string, and was expected to be non-empty. </exception>
168-
/// <exception cref="ClientResultException"> Service returned a non-success status code. </exception>
169-
/// <returns> A collection of service responses, each holding a page of values. </returns>
170-
public virtual CollectionResult GetFileAssociations(string vectorStoreId, int? limit, string order, string after, string before, string filter, RequestOptions options)
171-
{
172-
Argument.AssertNotNullOrEmpty(vectorStoreId, nameof(vectorStoreId));
173-
174-
return new VectorStoreFileCollectionResult(this, Pipeline, options, vectorStoreId, limit, order, after, before, filter);
175-
}
176-
177-
178105
/// <summary>
179106
/// [Protocol Method] Create a vector store file by attaching a [File](/docs/api-reference/files) to a [vector store](/docs/api-reference/vector-stores/object).
180107
/// </summary>

0 commit comments

Comments
 (0)