Skip to content

Commit dbfbd35

Browse files
author
ShivangiReja
committed
Rename OpenAI to Agent
1 parent aaac798 commit dbfbd35

37 files changed

+714
-633
lines changed

sdk/ai/Azure.AI.Projects/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ creating, running, and using assistants and threads.
3333
To get started, create an `AssistantsClient`:
3434
```C# Snippet:OverviewCreateClient
3535
var connectionString = Environment.GetEnvironmentVariable("AZURE_AI_CONNECTION_STRING");
36-
AgentClient client = new AgentClient(connectionString, new DefaultAzureCredential());
36+
AgentsClient client = new AgentsClient(connectionString, new DefaultAzureCredential());
3737
```
3838

3939
> **NOTE**: The Assistants API should always be used from a trusted device. Because the same authentication mechanism for running threads also allows changing persistent resources like Assistant instructions, a malicious user could extract an API key and modify Assistant behavior for other customers.
@@ -135,11 +135,11 @@ purpose of 'assistants' to make a file ID available:
135135
File.WriteAllText(
136136
path: "sample_file_for_upload.txt",
137137
contents: "The word 'apple' uses the code 442345, while the word 'banana' uses the code 673457.");
138-
Response<OpenAIFile> uploadAgentFileResponse = await client.UploadFileAsync(
138+
Response<AgentFile> uploadAgentFileResponse = await client.UploadFileAsync(
139139
filePath: "sample_file_for_upload.txt",
140-
purpose: OpenAIFilePurpose.Agents);
140+
purpose: AgentFilePurpose.Agents);
141141

142-
OpenAIFile uploadedAgentFile = uploadAgentFileResponse.Value;
142+
AgentFile uploadedAgentFile = uploadAgentFileResponse.Value;
143143
```
144144

145145
Once uploaded, the file ID can then be provided to create a vector store for it

sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs

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

sdk/ai/Azure.AI.Projects/src/Custom/Agent/AIClientModelFactory.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -136,19 +136,19 @@ public static ThreadRun ThreadRun(string id = null, string threadId = null, stri
136136
return new ThreadRun(id, @object: null, threadId, agentId, status, requiredAction, lastError, model, instructions, tools.ToList(), createdAt, expiresAt, startedAt, completedAt, cancelledAt, failedAt, incompleteDetails, usage, temperature, topP, maxPromptTokens, maxCompletionTokens, truncationStrategy, toolChoice, responseFormat, metadata, toolResources, parallelToolCalls, serializedAdditionalRawData: null);
137137
}
138138

139-
/// <summary> Initializes a new instance of <see cref="Azure.AI.Projects.OpenAIFile"/>. </summary>
139+
/// <summary> Initializes a new instance of <see cref="Projects.AgentFile"/>. </summary>
140140
/// <param name="id"> The identifier, which can be referenced in API endpoints. </param>
141141
/// <param name="size"> The size of the file, in bytes. </param>
142142
/// <param name="filename"> The name of the file. </param>
143143
/// <param name="createdAt"> The Unix timestamp, in seconds, representing when this object was created. </param>
144144
/// <param name="purpose"> The intended purpose of a file. </param>
145-
/// <returns> A new <see cref="Azure.AI.Projects.OpenAIFile"/> instance for mocking. </returns>
146-
public static OpenAIFile OpenAIFile(string id = null, int size = default, string filename = null, DateTimeOffset createdAt = default, OpenAIFilePurpose purpose = default)
145+
/// <returns> A new <see cref="Projects.AgentFile"/> instance for mocking. </returns>
146+
public static AgentFile AgentFile(string id = null, int size = default, string filename = null, DateTimeOffset createdAt = default, AgentFilePurpose purpose = default)
147147
{
148-
return new OpenAIFile(id, size, filename, createdAt, purpose);
148+
return new AgentFile(id, size, filename, createdAt, purpose);
149149
}
150150

151-
/// <summary> Initializes a new instance of <see cref="Azure.AI.Projects.RunStep"/>. </summary>
151+
/// <summary> Initializes a new instance of <see cref="Projects.RunStep"/>. </summary>
152152
/// <param name="id"> The identifier, which can be referenced in API endpoints. </param>
153153
/// <param name="type"> The type of run step, which can be either message_creation or tool_calls. </param>
154154
/// <param name="agentId"> The ID of the agent associated with the run step. </param>
@@ -164,7 +164,7 @@ public static OpenAIFile OpenAIFile(string id = null, int size = default, string
164164
/// <param name="failedAt"> The Unix timestamp, in seconds, representing when this failed. </param>
165165
/// <param name="usage"> Usage statistics related to the run step. </param>
166166
/// <param name="metadata"> A set of key/value pairs that can be attached to an object, used for storing additional information. </param>
167-
/// <returns> A new <see cref="Azure.AI.Projects.RunStep"/> instance for mocking. </returns>
167+
/// <returns> A new <see cref="Projects.RunStep"/> instance for mocking. </returns>
168168
public static RunStep RunStep(string id = null, RunStepType type = default, string agentId = null, string threadId = null, string runId = null, RunStepStatus status = default, RunStepDetails stepDetails = null, RunStepError lastError = null, DateTimeOffset createdAt = default, DateTimeOffset? expiredAt = null, DateTimeOffset? completedAt = null, DateTimeOffset? cancelledAt = null, DateTimeOffset? failedAt = null, RunStepCompletionUsage usage = null, IReadOnlyDictionary<string, string> metadata = null)
169169
{
170170
metadata ??= new Dictionary<string, string>();

sdk/ai/Azure.AI.Projects/src/Custom/Agent/OpenAIFile.cs renamed to sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ namespace Azure.AI.Projects;
1717
*/
1818

1919
[CodeGenSerialization(nameof(Size), DeserializationValueHook = nameof(DeserializeNullableSize))]
20-
public partial class OpenAIFile
20+
[CodeGenModel("OpenAIFile")]
21+
public partial class AgentFile
2122
{
2223
/*
2324
* CUSTOM CODE DESCRIPTION: This change allows us to complete the customization of hiding an unnecessary "Object" discriminator.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using Azure.Core;
8+
9+
namespace Azure.AI.Projects
10+
{
11+
/// <summary> The possible values denoting the intended usage of a file. </summary>
12+
[CodeGenModel("OpenAIFilePurpose")]
13+
public readonly partial struct AgentFilePurpose : IEquatable<AgentFilePurpose>
14+
{
15+
}
16+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using Azure.Core;
7+
8+
namespace Azure.AI.Projects
9+
{
10+
[CodeGenModel("OpenAIPageableListOfVectorStore")]
11+
public partial class AgentPageableListOfVectorStore
12+
{
13+
}
14+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using System.Collections.Generic;
8+
using System.Linq;
9+
using Azure.Core;
10+
11+
namespace Azure.AI.Projects
12+
{
13+
/// <summary> The response data for a requested list of items. </summary>
14+
[CodeGenModel("OpenAIPageableListOfVectorStoreFile")]
15+
public partial class AgentPageableListOfVectorStoreFile
16+
{
17+
}
18+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using Azure.Core;
8+
9+
namespace Azure.AI.Projects
10+
{
11+
/// <summary> The OpenAIPageableListOfVectorStoreFile_object. </summary>
12+
[CodeGenModel("OpenAIPageableListOfVectorStoreFileObject")]
13+
public readonly partial struct AgentPageableListOfVectorStoreFileObject : IEquatable<AgentPageableListOfVectorStoreFileObject>
14+
{
15+
}
16+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright (c) Microsoft Corporation. All rights reserved.
2+
// Licensed under the MIT License.
3+
4+
#nullable disable
5+
6+
using System;
7+
using Azure.Core;
8+
9+
namespace Azure.AI.Projects
10+
{
11+
/// <summary> The OpenAIPageableListOfVectorStore_object. </summary>
12+
[CodeGenModel("OpenAIPageableListOfVectorStoreObject")]
13+
public readonly partial struct AgentPageableListOfVectorStoreObject : IEquatable<AgentPageableListOfVectorStoreObject>
14+
{
15+
}
16+
}

sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentClient.cs renamed to sdk/ai/Azure.AI.Projects/src/Custom/Agent/AgentsClient.cs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ namespace Azure.AI.Projects
1818
{
1919
/// <summary> The Agents sub-client. </summary>
2020
[CodeGenClient("Agents")]
21-
public partial class AgentClient
21+
public partial class AgentsClient
2222
{
2323
/// <summary> Initializes a new instance of AzureAIClient. </summary>
2424
/// <param name="connectionString">The Azure AI Studio project connection string, in the form `endpoint;subscription_id;resource_group_name;project_name`.</param>
2525
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
2626
/// <exception cref="ArgumentNullException"> <paramref name="connectionString"/> is null. </exception>
2727
/// <exception cref="ArgumentException"> <paramref name="connectionString"/> </exception>
28-
public AgentClient(string connectionString, TokenCredential credential) : this(connectionString, credential, new AIProjectClientOptions())
28+
public AgentsClient(string connectionString, TokenCredential credential) : this(connectionString, credential, new AIProjectClientOptions())
2929
{
3030
}
3131

@@ -37,7 +37,7 @@ public partial class AgentClient
3737
/// <param name="options"> The options for configuring the client. </param>
3838
/// <exception cref="ArgumentNullException"> <paramref name="connectionString"/> is null. </exception>
3939
/// <exception cref="ArgumentException"> <paramref name="connectionString"/> is an empty string. </exception>
40-
public AgentClient(string connectionString, TokenCredential credential, AIProjectClientOptions options)
40+
public AgentsClient(string connectionString, TokenCredential credential, AIProjectClientOptions options)
4141
: this(new Uri(ClientHelper.ParseConnectionString(connectionString, "endpoint")),
4242
ClientHelper.ParseConnectionString(connectionString, "subscriptionId"),
4343
ClientHelper.ParseConnectionString(connectionString, "resourceGroupName"),
@@ -55,7 +55,7 @@ public AgentClient(string connectionString, TokenCredential credential, AIProjec
5555
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
5656
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/>, <paramref name="subscriptionId"/>, <paramref name="resourceGroupName"/>, <paramref name="projectName"/> or <paramref name="credential"/> is null. </exception>
5757
/// <exception cref="ArgumentException"> <paramref name="subscriptionId"/>, <paramref name="resourceGroupName"/> or <paramref name="projectName"/> is an empty string, and was expected to be non-empty. </exception>
58-
public AgentClient(Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, TokenCredential credential) : this(endpoint, subscriptionId, resourceGroupName, projectName, credential, new AIProjectClientOptions())
58+
public AgentsClient(Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, TokenCredential credential) : this(endpoint, subscriptionId, resourceGroupName, projectName, credential, new AIProjectClientOptions())
5959
{
6060
}
6161

@@ -68,7 +68,7 @@ public AgentClient(string connectionString, TokenCredential credential, AIProjec
6868
/// <param name="options"> The options for configuring the client. </param>
6969
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/>, <paramref name="subscriptionId"/>, <paramref name="resourceGroupName"/>, <paramref name="projectName"/> or <paramref name="credential"/> is null. </exception>
7070
/// <exception cref="ArgumentException"> <paramref name="subscriptionId"/>, <paramref name="resourceGroupName"/> or <paramref name="projectName"/> is an empty string, and was expected to be non-empty. </exception>
71-
public AgentClient(Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, TokenCredential credential, AIProjectClientOptions options)
71+
public AgentsClient(Uri endpoint, string subscriptionId, string resourceGroupName, string projectName, TokenCredential credential, AIProjectClientOptions options)
7272
{
7373
Argument.AssertNotNull(endpoint, nameof(endpoint));
7474
Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId));
@@ -337,9 +337,9 @@ public virtual Task<Response<ThreadRun>> SubmitToolOutputsToRunAsync(ThreadRun r
337337
/// <param name="filePath"> The local file path. </param>
338338
/// <param name="purpose"> The intended purpose of the uploaded file. </param>
339339
/// <param name="cancellationToken"> The cancellation token to use. </param>
340-
public virtual Response<OpenAIFile> UploadFile(
340+
public virtual Response<AgentFile> UploadFile(
341341
string filePath,
342-
OpenAIFilePurpose purpose,
342+
AgentFilePurpose purpose,
343343
CancellationToken cancellationToken = default)
344344
{
345345
Argument.AssertNotNullOrEmpty(filePath, nameof(filePath));
@@ -354,9 +354,9 @@ public virtual Response<OpenAIFile> UploadFile(
354354
/// <param name="filePath"> The local file path. </param>
355355
/// <param name="purpose"> The intended purpose of the uploaded file. </param>
356356
/// <param name="cancellationToken"> The cancellation token to use. </param>
357-
public virtual async Task<Response<OpenAIFile>> UploadFileAsync(
357+
public virtual async Task<Response<AgentFile>> UploadFileAsync(
358358
string filePath,
359-
OpenAIFilePurpose purpose,
359+
AgentFilePurpose purpose,
360360
CancellationToken cancellationToken = default)
361361
{
362362
Argument.AssertNotNullOrEmpty(filePath, nameof(filePath));
@@ -371,7 +371,7 @@ public virtual async Task<Response<OpenAIFile>> UploadFileAsync(
371371
/// <param name="filename"> The name of the file. </param>
372372
/// <param name="cancellationToken"> The cancellation token to use. </param>
373373
/// <exception cref="ArgumentNullException"> <paramref name="data"/> is null. </exception>
374-
public virtual async Task<Response<OpenAIFile>> UploadFileAsync(Stream data, OpenAIFilePurpose purpose, string filename, CancellationToken cancellationToken = default)
374+
public virtual async Task<Response<AgentFile>> UploadFileAsync(Stream data, AgentFilePurpose purpose, string filename, CancellationToken cancellationToken = default)
375375
{
376376
Argument.AssertNotNull(data, nameof(data));
377377
Argument.AssertNotNullOrEmpty(filename, nameof(filename));
@@ -380,7 +380,7 @@ public virtual async Task<Response<OpenAIFile>> UploadFileAsync(Stream data, Ope
380380
using MultipartFormDataRequestContent content = uploadFileRequest.ToMultipartRequestContent();
381381
RequestContext context = FromCancellationToken(cancellationToken);
382382
Response response = await UploadFileAsync(content, content.ContentType, context).ConfigureAwait(false);
383-
return Response.FromValue(OpenAIFile.FromResponse(response), response);
383+
return Response.FromValue(AgentFile.FromResponse(response), response);
384384
}
385385

386386
/// <summary> Uploads a file for use by other operations. </summary>
@@ -389,7 +389,7 @@ public virtual async Task<Response<OpenAIFile>> UploadFileAsync(Stream data, Ope
389389
/// <param name="filename"> The name of the file. </param>
390390
/// <param name="cancellationToken"> The cancellation token to use. </param>
391391
/// <exception cref="ArgumentNullException"> <paramref name="data"/> is null. </exception>
392-
public virtual Response<OpenAIFile> UploadFile(Stream data, OpenAIFilePurpose purpose, string filename, CancellationToken cancellationToken = default)
392+
public virtual Response<AgentFile> UploadFile(Stream data, AgentFilePurpose purpose, string filename, CancellationToken cancellationToken = default)
393393
{
394394
Argument.AssertNotNull(data, nameof(data));
395395
Argument.AssertNotNullOrEmpty(filename, nameof(filename));
@@ -398,7 +398,7 @@ public virtual Response<OpenAIFile> UploadFile(Stream data, OpenAIFilePurpose pu
398398
using MultipartFormDataRequestContent content = uploadFileRequest.ToMultipartRequestContent();
399399
RequestContext context = FromCancellationToken(cancellationToken);
400400
Response response = UploadFile(content, content.ContentType, context);
401-
return Response.FromValue(OpenAIFile.FromResponse(response), response);
401+
return Response.FromValue(AgentFile.FromResponse(response), response);
402402
}
403403

404404
/*
@@ -493,7 +493,7 @@ Response<ThreadDeletionStatus> baseResponse
493493
/// <summary> Returns a list of files that belong to the user's organization. </summary>
494494
/// <param name="purpose"> Limits files in the response to those with the specified purpose. </param>
495495
/// <param name="cancellationToken"> The cancellation token to use. </param>
496-
public virtual Response<IReadOnlyList<OpenAIFile>> GetFiles(OpenAIFilePurpose? purpose = null, CancellationToken cancellationToken = default)
496+
public virtual Response<IReadOnlyList<AgentFile>> GetFiles(AgentFilePurpose? purpose = null, CancellationToken cancellationToken = default)
497497
{
498498
using DiagnosticScope scope = ClientDiagnostics.CreateScope("Agents.GetFiles");
499499
scope.Start();
@@ -504,8 +504,8 @@ public virtual Response<IReadOnlyList<OpenAIFile>> GetFiles(OpenAIFilePurpose? p
504504
/// <summary> Returns a list of files that belong to the user's organization. </summary>
505505
/// <param name="purpose"> Limits files in the response to those with the specified purpose. </param>
506506
/// <param name="cancellationToken"> The cancellation token to use. </param>
507-
public virtual async Task<Response<IReadOnlyList<OpenAIFile>>> GetFilesAsync(
508-
OpenAIFilePurpose? purpose = null,
507+
public virtual async Task<Response<IReadOnlyList<AgentFile>>> GetFilesAsync(
508+
AgentFilePurpose? purpose = null,
509509
CancellationToken cancellationToken = default)
510510
{
511511
using DiagnosticScope scope = ClientDiagnostics.CreateScope("Agents.GetFiles");

0 commit comments

Comments
 (0)