Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
383 changes: 383 additions & 0 deletions api/OpenAI.net8.0.cs

Large diffs are not rendered by default.

351 changes: 351 additions & 0 deletions api/OpenAI.netstandard2.0.cs

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions specification/client/containers.client.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import "../base/typespec/containers/main.tsp";
import "@azure-tools/typespec-client-generator-core";

using OpenAI;
using Azure.ClientGenerator.Core;

@@convenientAPI(Containers.listContainers, false);
@@convenientAPI(Containers.createContainer, false);
@@convenientAPI(Containers.retrieveContainer, false);
@@convenientAPI(Containers.deleteContainer, false);
@@convenientAPI(Containers.createContainerFile, false);
@@convenientAPI(Containers.listContainerFiles, false);
@@convenientAPI(Containers.retrieveContainerFile, false);
@@convenientAPI(Containers.deleteContainerFile, false);
@@convenientAPI(Containers.retrieveContainerFileContent, false);
8 changes: 8 additions & 0 deletions specification/client/graders.client.tsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import "../base/typespec/graders/main.tsp";
import "@azure-tools/typespec-client-generator-core";

using OpenAI;
using Azure.ClientGenerator.Core;

@@convenientAPI(Graders.runGrader, false);
@@convenientAPI(Graders.validateGrader, false);
2 changes: 2 additions & 0 deletions specification/main.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import "./client/moderations.client.tsp";
import "./client/runs.client.tsp";
import "./client/threads.client.tsp";
import "./client/vector-stores.client.tsp";
import "./client/graders.client.tsp";
import "./client/containers.client.tsp";

import "./client/models/audio.models.tsp";
import "./client/models/common.models.tsp";
Expand Down
54 changes: 53 additions & 1 deletion src/Custom/Containers/ContainerClient.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Diagnostics.CodeAnalysis;
Expand All @@ -6,7 +7,58 @@
namespace OpenAI.Containers;

[CodeGenType("Containers")]
internal partial class ContainerClient
[CodeGenSuppress("ContainerClient", typeof(ClientPipeline), typeof(Uri))]
public partial class ContainerClient
{
// CUSTOM: Added as a convenience.
/// <summary> Initializes a new instance of <see cref="ContainerClient"/>. </summary>
/// <param name="apiKey"> The API key to authenticate with the service. </param>
/// <exception cref="ArgumentNullException"> <paramref name="apiKey"/> is null. </exception>
public ContainerClient(string apiKey) : this(new ApiKeyCredential(apiKey), new OpenAIClientOptions())
{
}

// CUSTOM:
// - Used a custom pipeline.
// - Demoted the endpoint parameter to be a property in the options class.
/// <summary> Initializes a new instance of <see cref="ContainerClient"/>. </summary>
/// <param name="credential"> The API key to authenticate with the service. </param>
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
public ContainerClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions())
{
}

// CUSTOM:
// - Used a custom pipeline.
// - Demoted the endpoint parameter to be a property in the options class.
/// <summary> Initializes a new instance of <see cref="ContainerClient"/>. </summary>
/// <param name="credential"> The API key to authenticate with the service. </param>
/// <param name="options"> The options to configure the client. </param>
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
public ContainerClient(ApiKeyCredential credential, OpenAIClientOptions options)
{
Argument.AssertNotNull(credential, nameof(credential));
options ??= new OpenAIClientOptions();

Pipeline = OpenAIClient.CreatePipeline(credential, options);
_endpoint = OpenAIClient.GetEndpoint(options);
}

// CUSTOM:
// - Used a custom pipeline.
// - Demoted the endpoint parameter to be a property in the options class.
// - Made protected.
/// <summary> Initializes a new instance of <see cref="ContainerClient"/>. </summary>
/// <param name="pipeline"> The HTTP pipeline to send and receive REST requests and responses. </param>
/// <param name="options"> The options to configure the client. </param>
/// <exception cref="ArgumentNullException"> <paramref name="pipeline"/> is null. </exception>
protected internal ContainerClient(ClientPipeline pipeline, OpenAIClientOptions options)
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
options ??= new OpenAIClientOptions();

Pipeline = pipeline;
_endpoint = OpenAIClient.GetEndpoint(options);
}

}
12 changes: 12 additions & 0 deletions src/Custom/Containers/GeneratorStubs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace OpenAI.Containers;

[CodeGenType("ContainerListResource")] public partial class ContainerListResource { }
[CodeGenType("ContainerResource")] public partial class ContainerResource { }
[CodeGenType("ContainerResourceExpiresAfter")] public partial class ContainerResourceExpiresAfter { }
[CodeGenType("CreateContainerBody")] public partial class CreateContainerBody { }
[CodeGenType("CreateContainerBodyExpiresAfter")] public partial class CreateContainerBodyExpiresAfter { }
[CodeGenType("DeleteContainerResponse")] public partial class DeleteContainerResponse { }
[CodeGenType("CreateContainerFileBody")] public partial class CreateContainerFileBody { }
[CodeGenType("ContainerFileResource")] public partial class ContainerFileResource { }
[CodeGenType("ContainerFileListResource")] public partial class ContainerFileListResource { }
[CodeGenType("DeleteContainerFileResponse")] public partial class DeleteContainerFileResponse { }
87 changes: 0 additions & 87 deletions src/Custom/Containers/Internal/GeneratorStubs.cs

This file was deleted.

20 changes: 20 additions & 0 deletions src/Custom/Graders/GeneratorStubs.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace OpenAI.Graders;

[CodeGenType("GraderStringCheckOperation")] public readonly partial struct GraderStringCheckOperation { }
[CodeGenType("GraderType")] public readonly partial struct GraderType { }
[CodeGenType("GraderTextSimilarityEvaluationMetric")] public readonly partial struct GraderTextSimilarityEvaluationMetric { }
[CodeGenType("GraderStringCheck")] public partial class GraderStringCheck { }
[CodeGenType("Grader")] public partial class Grader { }
[CodeGenType("UnknownGrader")] public partial class UnknownGrader { }
[CodeGenType("GraderLabelModel")] public partial class GraderLabelModel { }
[CodeGenType("GraderTextSimilarity")] public partial class GraderTextSimilarity { }
[CodeGenType("GraderPython")] public partial class GraderPython { }
[CodeGenType("GraderScoreModel")] public partial class GraderScoreModel { }
[CodeGenType("GraderMulti")] public partial class GraderMulti { }
[CodeGenType("FineTuneReinforcementHyperparameters")] public partial class FineTuneReinforcementHyperparameters { }
[CodeGenType("RunGraderRequest")] public partial class RunGraderRequest { }
[CodeGenType("RunGraderResponse")] public partial class RunGraderResponse { }
[CodeGenType("RunGraderResponseMetadata")] public partial class RunGraderResponseMetadata { }
[CodeGenType("RunGraderResponseMetadataErrors")] public partial class RunGraderResponseMetadataErrors { }
[CodeGenType("ValidateGraderRequest")] public partial class ValidateGraderRequest { }
[CodeGenType("ValidateGraderResponse")] public partial class ValidateGraderResponse { }
53 changes: 52 additions & 1 deletion src/Custom/Graders/GraderClient.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.ClientModel;
using System.ClientModel.Primitives;
using System.Diagnostics.CodeAnalysis;
Expand All @@ -6,7 +7,57 @@
namespace OpenAI.Graders;

[CodeGenType("Graders")]
internal partial class GraderClient
[CodeGenSuppress("GraderClient", typeof(ClientPipeline), typeof(Uri))]
public partial class GraderClient
{
// CUSTOM: Added as a convenience.
/// <summary> Initializes a new instance of <see cref="GraderClient"/>. </summary>
/// <param name="apiKey"> The API key to authenticate with the service. </param>
/// <exception cref="ArgumentNullException"> <paramref name="apiKey"/> is null. </exception>
public GraderClient(string apiKey) : this(new ApiKeyCredential(apiKey), new OpenAIClientOptions())
{
}

// CUSTOM:
// - Used a custom pipeline.
// - Demoted the endpoint parameter to be a property in the options class.
/// <summary> Initializes a new instance of <see cref="GraderClient"/>. </summary>
/// <param name="credential"> The API key to authenticate with the service. </param>
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
public GraderClient(ApiKeyCredential credential) : this(credential, new OpenAIClientOptions())
{
}

// CUSTOM:
// - Used a custom pipeline.
// - Demoted the endpoint parameter to be a property in the options class.
/// <summary> Initializes a new instance of <see cref="GraderClient"/>. </summary>
/// <param name="credential"> The API key to authenticate with the service. </param>
/// <param name="options"> The options to configure the client. </param>
/// <exception cref="ArgumentNullException"> <paramref name="credential"/> is null. </exception>
public GraderClient(ApiKeyCredential credential, OpenAIClientOptions options)
{
Argument.AssertNotNull(credential, nameof(credential));
options ??= new OpenAIClientOptions();

Pipeline = OpenAIClient.CreatePipeline(credential, options);
_endpoint = OpenAIClient.GetEndpoint(options);
}

// CUSTOM:
// - Used a custom pipeline.
// - Demoted the endpoint parameter to be a property in the options class.
// - Made protected.
/// <summary> Initializes a new instance of <see cref="GraderClient"/>. </summary>
/// <param name="pipeline"> The HTTP pipeline to send and receive REST requests and responses. </param>
/// <param name="options"> The options to configure the client. </param>
/// <exception cref="ArgumentNullException"> <paramref name="pipeline"/> is null. </exception>
protected internal GraderClient(ClientPipeline pipeline, OpenAIClientOptions options)
{
Argument.AssertNotNull(pipeline, nameof(pipeline));
options ??= new OpenAIClientOptions();

Pipeline = pipeline;
_endpoint = OpenAIClient.GetEndpoint(options);
}
}
81 changes: 0 additions & 81 deletions src/Custom/Graders/Internal/GeneratorStubs.cs

This file was deleted.

Loading