Skip to content

Commit fa64a6f

Browse files
committed
Merge branch 'main' of https://github.com/openai/openai-dotnet into shreja/AddServiceTier
2 parents 0289a68 + 75ec790 commit fa64a6f

File tree

132 files changed

+61093
-57236
lines changed

Some content is hidden

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

132 files changed

+61093
-57236
lines changed

api/OpenAI.net8.0.cs

Lines changed: 123 additions & 41 deletions
Large diffs are not rendered by default.

api/OpenAI.netstandard2.0.cs

Lines changed: 110 additions & 39 deletions
Large diffs are not rendered by default.

codegen/generator/src/OpenAILibraryGenerator.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ protected override void Configure()
3333
AddVisitor(new OpenAILibraryVisitor());
3434
AddVisitor(new VirtualMessageCreationVisitor());
3535
AddVisitor(new ProhibitedNamespaceVisitor());
36-
AddVisitor(new ExplicitConversionFromClientResultVisitor());
3736
AddVisitor(new ImplicitConversionToBinaryContentVisitor());
3837
AddVisitor(new ModelSerializationVisitor());
3938
AddVisitor(new ExperimentalAttributeVisitor());

codegen/generator/src/Visitors/ExplicitConversionFromClientResultVisitor.cs

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

codegen/generator/src/Visitors/PaginationVisitor.cs

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class PaginationVisitor : ScmLibraryVisitor
2222
private static readonly Dictionary<string, string> _paramReplacementMap = new()
2323
{
2424
{ "after", "AfterId" },
25-
{ "before", "LastId" },
25+
{ "before", "BeforeId" },
2626
{ "limit", "PageSizeLimit" },
2727
{ "order", "Order" },
2828
{ "model", "Model" },
@@ -40,11 +40,35 @@ public class PaginationVisitor : ScmLibraryVisitor
4040
},
4141
{
4242
"GetChatCompletionMessages",
43-
("ChatCompletionMessageListDatum", "ChatCompletionCollectionOptions", _chatParamsToReplace)
43+
("ChatCompletionMessageListDatum", "ChatCompletionMessageCollectionOptions", _chatParamsToReplace)
4444
},
4545
{
4646
"GetChatCompletionMessagesAsync",
4747
("ChatCompletionMessageListDatum", "ChatCompletionMessageCollectionOptions", _chatParamsToReplace)
48+
},
49+
{
50+
"GetContainers",
51+
("ContainerResource", "ContainerCollectionOptions", _chatParamsToReplace)
52+
},
53+
{
54+
"GetContainersAsync",
55+
("ContainerResource", "ContainerCollectionOptions", _chatParamsToReplace)
56+
},
57+
{
58+
"GetContainerFiles",
59+
("ContainerFileResource", "ContainerFileCollectionOptions", _chatParamsToReplace)
60+
},
61+
{
62+
"GetContainerFilesAsync",
63+
("ContainerFileResource", "ContainerFileCollectionOptions", _chatParamsToReplace)
64+
},
65+
{
66+
"GetInputItems",
67+
("ResponseItem", "ResponseItemCollectionOptions", _chatParamsToReplace)
68+
},
69+
{
70+
"GetInputItemsAsync",
71+
("ResponseItem", "ResponseItemCollectionOptions", _chatParamsToReplace)
4872
}
4973
};
5074

specification/base/typespec/containers/models.tsp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ model ContainerFileListResource {
1313
object: "list";
1414

1515
/** A list of container files. */
16-
data: ContainerFileResource[];
16+
@pageItems data: ContainerFileResource[];
1717

1818
/** The ID of the first file in the list. */
1919
first_id: string;
2020

2121
/** The ID of the last file in the list. */
22-
last_id: string;
22+
@continuationToken last_id: string;
2323

2424
/** Whether there are more files available. */
2525
has_more: boolean;
@@ -59,13 +59,13 @@ model ContainerListResource {
5959
object: "list";
6060

6161
/** A list of containers. */
62-
data: ContainerResource[];
62+
@pageItems data: ContainerResource[];
6363

6464
/** The ID of the first container in the list. */
6565
first_id: string;
6666

6767
/** The ID of the last container in the list. */
68-
last_id: string;
68+
@continuationToken last_id: string;
6969

7070
/** Whether there are more containers available. */
7171
has_more: boolean;

specification/base/typespec/containers/operations.tsp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace OpenAI;
1414
interface Containers {
1515
@get
1616
@operationId("ListContainers")
17+
@list
1718
listContainers(
1819
...PageLimitQueryParameter,
1920
...PageOrderQueryParameter,
@@ -64,6 +65,7 @@ interface Containers {
6465
@get
6566
@route("{container_id}/files")
6667
@operationId("ListContainerFiles")
68+
@list
6769
listContainerFiles(
6870
@path
6971
container_id: string,

specification/base/typespec/responses/models.tsp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ model ResponseItemList {
12721272
object: "list";
12731273

12741274
/** A list of items used to generate this response. */
1275-
data: ItemResource[];
1275+
@pageItems data: ItemResource[];
12761276

12771277
/** Whether there are more items available. */
12781278
has_more: boolean;
@@ -1281,7 +1281,7 @@ model ResponseItemList {
12811281
first_id: string;
12821282

12831283
/** The ID of the last item in the list. */
1284-
last_id: string;
1284+
@continuationToken last_id: string;
12851285
}
12861286

12871287
// Tool customization: Establish discriminated type base

specification/base/typespec/responses/operations.tsp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ interface Responses {
8282
@operationId("listInputItems")
8383
@get
8484
@route("{response_id}/input_items")
85+
@list
8586
listInputItems(
8687
@path
8788
@example("resp_677efb5139a88190b512bc3fef8e535d")

specification/client/containers.client.tsp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,6 @@ import "@azure-tools/typespec-client-generator-core";
44
using OpenAI;
55
using Azure.ClientGenerator.Core;
66

7-
@@convenientAPI(Containers.listContainers, false);
8-
@@convenientAPI(Containers.createContainer, false);
9-
@@convenientAPI(Containers.retrieveContainer, false);
10-
@@convenientAPI(Containers.deleteContainer, false);
11-
@@convenientAPI(Containers.createContainerFile, false);
12-
@@convenientAPI(Containers.listContainerFiles, false);
13-
@@convenientAPI(Containers.retrieveContainerFile, false);
14-
@@convenientAPI(Containers.deleteContainerFile, false);
15-
@@convenientAPI(Containers.retrieveContainerFileContent, false);
16-
177
@@clientName(Containers.retrieveContainer, "GetContainer");
188
@@clientName(Containers.retrieveContainerFile, "GetContainerFile");
199
@@clientName(Containers.retrieveContainerFileContent, "GetContainerFileContent");

0 commit comments

Comments
 (0)