Skip to content

Commit d566842

Browse files
committed
Merge branch 'main' of https://github.com/openai/openai-dotnet into shreja/Issue_447_ResponseAnnotation
2 parents 7cf6f54 + efabd97 commit d566842

File tree

69 files changed

+10610
-10904
lines changed

Some content is hidden

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

69 files changed

+10610
-10904
lines changed

api/OpenAI.net8.0.cs

Lines changed: 109 additions & 18 deletions
Large diffs are not rendered by default.

api/OpenAI.netstandard2.0.cs

Lines changed: 87 additions & 18 deletions
Large diffs are not rendered by default.

specification/client/models/common.models.tsp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,6 @@ union DotNetResponseReasoningEffortLevel {
1515
ReasoningEffort,
1616
}
1717

18-
@access(Access.public)
19-
@usage(Usage.input | Usage.output)
20-
union DotNetResponseWebSearchContextSize {
21-
// WebSearchPreviewTool.search_context_size,
22-
low: "low",
23-
24-
medium: "medium",
25-
high: "high",
26-
}
27-
2818
// ResponseFormat
2919

3020
@access(Access.public)

specification/client/models/responses.models.tsp

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,6 @@ using TypeSpec.Http;
66

77
namespace OpenAI;
88

9-
@access(Access.public)
10-
@usage(Usage.input | Usage.output)
11-
@discriminator("type")
12-
model DotnetResponseWebSearchLocation {
13-
...Location;
14-
}
15-
16-
@access(Access.public)
17-
@usage(Usage.input | Usage.output)
18-
model DotnetResponseWebSearchApproximateLocation
19-
extends DotnetResponseWebSearchLocation {
20-
...ApproximateLocation;
21-
}
22-
239
@access(Access.public)
2410
@usage(Usage.input | Usage.output)
2511
model DotNetItemReferenceItemResource extends ItemResource {

specification/client/responses.client.tsp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,10 @@ using Azure.ClientGenerator.Core;
3030
@@visibility(WebSearchToolCallItemResource.status, Lifecycle.Read);
3131

3232
@@visibility(ResponsesMessageItemResource.status, Lifecycle.Read);
33+
34+
@@clientName(FileSearchTool.max_num_results, "MaxResultCount");
35+
36+
@@clientName(FunctionTool.name, "FunctionName");
37+
@@clientName(FunctionTool.description, "FunctionDescription");
38+
@@clientName(FunctionTool.parameters, "FunctionParameters");
39+
@@clientName(FunctionTool.strict, "StrictModeEnabled");

src/Custom/Assistants/AssistantClient.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,13 @@ public AssistantClient(AuthenticationPolicy authenticationPolicy, OpenAIClientOp
8383
_threadSubClient = new(Pipeline, options);
8484
}
8585

86+
/// <summary>
87+
/// Gets the endpoint URI for the service.
88+
/// </summary>
89+
[Experimental("OPENAI001")]
90+
public Uri Endpoint => _endpoint;
91+
92+
8693
// CUSTOM:
8794
// - Used a custom pipeline.
8895
// - Demoted the endpoint parameter to be a property in the options class.
@@ -114,7 +121,7 @@ public virtual async Task<ClientResult<Assistant>> CreateAssistantAsync(string m
114121
options ??= new();
115122
options.Model = model;
116123

117-
ClientResult protocolResult = await CreateAssistantAsync(options?.ToBinaryContent(), cancellationToken.ToRequestOptions()).ConfigureAwait(false);
124+
ClientResult protocolResult = await CreateAssistantAsync(options?.ToBinaryContent(), cancellationToken.ToRequestOptions()).ConfigureAwait(false);
118125
return ClientResult.FromValue((Assistant)protocolResult, protocolResult.GetRawResponse());
119126
}
120127

@@ -130,7 +137,7 @@ public virtual ClientResult<Assistant> CreateAssistant(string model, AssistantCr
130137
options.Model = model;
131138

132139
ClientResult protocolResult = CreateAssistant(options?.ToBinaryContent(), cancellationToken.ToRequestOptions());
133-
return ClientResult.FromValue((Assistant)protocolResult, protocolResult.GetRawResponse());
140+
return ClientResult.FromValue((Assistant)protocolResult, protocolResult.GetRawResponse());
134141
}
135142

136143
/// <summary>
@@ -319,7 +326,7 @@ public virtual ClientResult<AssistantDeletionResult> DeleteAssistant(string assi
319326
public virtual async Task<ClientResult<AssistantThread>> CreateThreadAsync(ThreadCreationOptions options = null, CancellationToken cancellationToken = default)
320327
{
321328
ClientResult protocolResult = await CreateThreadAsync(options?.ToBinaryContent(), cancellationToken.ToRequestOptions()).ConfigureAwait(false);
322-
return ClientResult.FromValue((AssistantThread)protocolResult, protocolResult.GetRawResponse());;
329+
return ClientResult.FromValue((AssistantThread)protocolResult, protocolResult.GetRawResponse()); ;
323330
}
324331

325332
/// <summary>
@@ -717,7 +724,7 @@ public virtual ClientResult<ThreadRun> CreateRun(string threadId, string assista
717724
options.Stream = null;
718725

719726
ClientResult protocolResult = CreateRun(threadId, options?.ToBinaryContent(), cancellationToken.ToRequestOptions());
720-
return ClientResult.FromValue((ThreadRun)protocolResult, protocolResult.GetRawResponse());
727+
return ClientResult.FromValue((ThreadRun)protocolResult, protocolResult.GetRawResponse());
721728
}
722729

723730
/// <summary>

src/Custom/Audio/AudioClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,12 @@ protected internal AudioClient(ClientPipeline pipeline, string model, OpenAIClie
116116
[Experimental("OPENAI001")]
117117
public string Model => _model;
118118

119+
/// <summary>
120+
/// Gets the endpoint URI for the service.
121+
/// </summary>
122+
[Experimental("OPENAI001")]
123+
public Uri Endpoint => _endpoint;
124+
119125
#region GenerateSpeech
120126

121127
/// <summary> Generates a life-like, spoken audio recording of the input text. </summary>

src/Custom/Batch/BatchClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ protected internal BatchClient(ClientPipeline pipeline, OpenAIClientOptions opti
9595
_endpoint = OpenAIClient.GetEndpoint(options);
9696
}
9797

98+
/// <summary>
99+
/// Gets the endpoint URI for the service.
100+
/// </summary>
101+
[Experimental("OPENAI001")]
102+
public Uri Endpoint => _endpoint;
103+
98104
internal virtual CreateBatchOperation CreateCreateBatchOperation(string batchId, string status, PipelineResponse response)
99105
{
100106
return new CreateBatchOperation(this, _endpoint, batchId, status, response);

src/Custom/Chat/ChatClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ protected internal ChatClient(ClientPipeline pipeline, string model, OpenAIClien
124124
[Experimental("OPENAI001")]
125125
public string Model => _model;
126126

127+
/// <summary>
128+
/// Gets the endpoint URI for the service.
129+
/// </summary>
130+
[Experimental("OPENAI001")]
131+
public Uri Endpoint => _endpoint;
132+
127133
/// <summary> Generates a completion for the given chat. </summary>
128134
/// <param name="messages"> The messages comprising the chat so far. </param>
129135
/// <param name="options"> The options to configure the chat completion. </param>

src/Custom/Containers/ContainerClient.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,10 @@ protected internal ContainerClient(ClientPipeline pipeline, OpenAIClientOptions
7777
_endpoint = OpenAIClient.GetEndpoint(options);
7878
}
7979

80+
/// <summary>
81+
/// Gets the endpoint URI for the service.
82+
/// </summary>
83+
[Experimental("OPENAI001")]
84+
public Uri Endpoint => _endpoint;
85+
8086
}

0 commit comments

Comments
 (0)