Skip to content

Commit 67eda13

Browse files
authored
Fix renaming second part (Azure#49985)
* Fix renamings second part * Fix api * Revert changes
1 parent 6e9b9b8 commit 67eda13

25 files changed

+231
-256
lines changed

sdk/ai/Azure.AI.Agents.Persistent/api/Azure.AI.Agents.Persistent.net8.0.cs

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

sdk/ai/Azure.AI.Agents.Persistent/api/Azure.AI.Agents.Persistent.netstandard2.0.cs

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

sdk/ai/Azure.AI.Agents.Persistent/src/Custom/OpenApiToolDefinition.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public OpenApiToolDefinition(string name, string description, BinaryData spec, O
1414
spec: spec,
1515
auth: auth,
1616
defaultParams: defaultParams ?? [],
17+
functions: new ChangeTrackingList<InternalFunctionDefinition>(),
1718
serializedAdditionalRawData: null
1819
)
1920
){}

sdk/ai/Azure.AI.Agents.Persistent/src/Custom/PersistentAgentsAdministration.cs renamed to sdk/ai/Azure.AI.Agents.Persistent/src/Custom/PersistentAgentsAdministrationClient.cs

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
// Licensed under the MIT License.
33

44
using System;
5+
using System.Collections.Generic;
56
using System.ComponentModel.Design;
7+
using System.IO;
8+
using System.Linq;
9+
using System.Text.Json;
610
using System.Threading;
711
using System.Threading.Tasks;
812
using Autorest.CSharp.Core;
@@ -11,8 +15,7 @@
1115

1216
namespace Azure.AI.Agents.Persistent
1317
{
14-
[CodeGenClient("PersistentAgentsAdministrationClient")]
15-
public partial class PersistentAgentsAdministration
18+
public partial class PersistentAgentsAdministrationClient
1619
{
1720
private static readonly bool s_is_test_run = AppContextSwitchHelper.GetConfigValue(
1821
PersistantAgensConstants.UseOldConnectionString,
@@ -27,7 +30,7 @@ public partial class PersistentAgentsAdministration
2730
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
2831
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/> or <paramref name="credential"/> is null. </exception>
2932
/// <exception cref="ArgumentException"> is an empty string, and was expected to be non-empty. </exception>
30-
public PersistentAgentsAdministration(string endpoint, TokenCredential credential) : this(endpoint, credential, new PersistentAgentsAdministrationClientOptions())
33+
public PersistentAgentsAdministrationClient(string endpoint, TokenCredential credential) : this(endpoint, credential, new PersistentAgentsAdministrationClientOptions())
3134
{
3235
}
3336

@@ -37,7 +40,7 @@ public partial class PersistentAgentsAdministration
3740
/// <param name="options"> The options for configuring the client. </param>
3841
/// <exception cref="ArgumentNullException"> <paramref name="endpoint"/>, or <paramref name="credential"/> is null. </exception>
3942
/// <exception cref="ArgumentException"> is an empty string, and was expected to be non-empty. </exception>
40-
public PersistentAgentsAdministration(string endpoint, TokenCredential credential, PersistentAgentsAdministrationClientOptions options)
43+
public PersistentAgentsAdministrationClient(string endpoint, TokenCredential credential, PersistentAgentsAdministrationClientOptions options)
4144
{
4245
// TODO: Remve this code when 1DP endpoint will be available and just call the upsteam constructor.
4346
Argument.AssertNotNull(endpoint, nameof(endpoint));
@@ -257,5 +260,83 @@ internal virtual Pageable<BinaryData> GetAgents(int? limit, string order, string
257260
HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAgentsRequest(limit, order, after, before, context);
258261
return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "PersistentAgentsAdministrationClient.GetAgents", "data", null, context);
259262
}
263+
264+
/// <summary>
265+
/// [Protocol Method] Retrieves an existing agent.
266+
/// <list type="bullet">
267+
/// <item>
268+
/// <description>
269+
/// This <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/ProtocolMethods.md">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios.
270+
/// </description>
271+
/// </item>
272+
/// <item>
273+
/// <description>
274+
/// Please try the simpler <see cref="GetAgentAsync(string,CancellationToken)"/> convenience overload with strongly typed models first.
275+
/// </description>
276+
/// </item>
277+
/// </list>
278+
/// </summary>
279+
/// <param name="agentId"> Identifier of the agent. </param>
280+
/// <param name="context"> The request context, which can override default behaviors of the client pipeline on a per-call basis. </param>
281+
/// <exception cref="ArgumentNullException"> <paramref name="agentId"/> is null. </exception>
282+
/// <exception cref="ArgumentException"> <paramref name="agentId"/> is an empty string, and was expected to be non-empty. </exception>
283+
/// <exception cref="RequestFailedException"> Service returned a non-success status code. </exception>
284+
/// <returns> The response returned from the service. </returns>
285+
public virtual async Task<Response> GetAgentAsync(string agentId, RequestContext context)
286+
{
287+
Argument.AssertNotNullOrEmpty(agentId, nameof(agentId));
288+
289+
using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministration.GetAgent");
290+
scope.Start();
291+
try
292+
{
293+
using HttpMessage message = CreateGetAgentRequest(agentId, context);
294+
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
295+
}
296+
catch (Exception e)
297+
{
298+
scope.Failed(e);
299+
throw;
300+
}
301+
}
302+
303+
/// <summary>
304+
/// [Protocol Method] Retrieves an existing agent.
305+
/// <list type="bullet">
306+
/// <item>
307+
/// <description>
308+
/// This <see href="https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/ProtocolMethods.md">protocol method</see> allows explicit creation of the request and processing of the response for advanced scenarios.
309+
/// </description>
310+
/// </item>
311+
/// <item>
312+
/// <description>
313+
/// Please try the simpler <see cref="GetAgent(string,CancellationToken)"/> convenience overload with strongly typed models first.
314+
/// </description>
315+
/// </item>
316+
/// </list>
317+
/// </summary>
318+
/// <param name="agentId"> Identifier of the agent. </param>
319+
/// <param name="context"> The request context, which can override default behaviors of the client pipeline on a per-call basis. </param>
320+
/// <exception cref="ArgumentNullException"> <paramref name="agentId"/> is null. </exception>
321+
/// <exception cref="ArgumentException"> <paramref name="agentId"/> is an empty string, and was expected to be non-empty. </exception>
322+
/// <exception cref="RequestFailedException"> Service returned a non-success status code. </exception>
323+
/// <returns> The response returned from the service. </returns>
324+
public virtual Response GetAgent(string agentId, RequestContext context)
325+
{
326+
Argument.AssertNotNullOrEmpty(agentId, nameof(agentId));
327+
328+
using var scope = ClientDiagnostics.CreateScope("PersistentAgentsAdministration.GetAgent");
329+
scope.Start();
330+
try
331+
{
332+
using HttpMessage message = CreateGetAgentRequest(agentId, context);
333+
return _pipeline.ProcessMessage(message, context);
334+
}
335+
catch (Exception e)
336+
{
337+
scope.Failed(e);
338+
throw;
339+
}
340+
}
260341
}
261342
}

sdk/ai/Azure.AI.Agents.Persistent/src/Custom/PersistentAgentsClient.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public class PersistentAgentsClient
1616
protected PersistentAgentsClient()
1717
{ }
1818

19-
internal PersistentAgentsClient(PersistentAgentsAdministration client)
19+
internal PersistentAgentsClient(PersistentAgentsAdministrationClient client)
2020
{
2121
_client = client;
2222
}
2323

24-
private PersistentAgentsAdministration _client;
24+
private PersistentAgentsAdministrationClient _client;
2525
/// <summary> Initializes a new instance of AzureAIClient. </summary>
2626
/// <param name="endpoint"> The Azure AI Foundry project endpoint, in the form `https://&lt;aiservices-id&gt;.services.ai.azure.com/api/projects/&lt;project-name&gt;`</param>
2727
/// <param name="credential"> A credential used to authenticate to an Azure Service. </param>
@@ -88,7 +88,7 @@ public virtual async Task<Response<ThreadRun>> CreateThreadAndRunAsync(string as
8888
).ConfigureAwait(false);
8989
}
9090

91-
public PersistentAgentsAdministration Administration { get => _client; }
91+
public PersistentAgentsAdministrationClient Administration { get => _client; }
9292
public PersistentAgentsFiles Files { get => _client.GetPersistentAgentsFilesClient(); }
9393
public ThreadMessages Messages { get => _client.GetThreadMessagesClient();}
9494
public Threads Threads { get => _client.GetThreadsClient(); }

sdk/ai/Azure.AI.Agents.Persistent/src/Custom/PersistentAgentsExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,20 @@ public static class PersistentAgentsExtensions
2323
public static PersistentAgentsClient GetPersistentAgentsClient(this ClientConnectionProvider provider)
2424
{
2525
PersistentAgentsAdministrationKey key = new();
26-
PersistentAgentsAdministration agentsClient = provider.Subclients.GetClient(key , () => CreateAdministrationAgentsClient(provider));
26+
PersistentAgentsAdministrationClient agentsClient = provider.Subclients.GetClient(key , () => CreateAdministrationAgentsClient(provider));
2727
return new PersistentAgentsClient(agentsClient);
2828
}
2929

30-
private static PersistentAgentsAdministration CreateAdministrationAgentsClient(this ClientConnectionProvider provider)
30+
private static PersistentAgentsAdministrationClient CreateAdministrationAgentsClient(this ClientConnectionProvider provider)
3131
{
3232
ClientConnection connection = provider.GetConnection(typeof(PersistentAgentsClient).FullName!);
3333
if (!connection.TryGetLocatorAsUri(out Uri? uri) || uri is null)
3434
{
3535
throw new InvalidOperationException("Invalid URI.");
3636
}
3737
if (connection.Credential is TokenCredential cred)
38-
return new PersistentAgentsAdministration(uri, cred);
39-
throw new InvalidOperationException($"PersistentAgentsAdministration does not support {connection.CredentialKind}.");
38+
return new PersistentAgentsAdministrationClient(uri, cred);
39+
throw new InvalidOperationException($"PersistentAgentsAdministrationClient does not support {connection.CredentialKind}.");
4040
}
4141

4242
private record PersistentAgentsAdministrationKey();

sdk/ai/Azure.AI.Agents.Persistent/src/Custom/Streaming/StreamingUpdateReason.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public enum StreamingUpdateReason
1818
/// Indicates that an update was generated as part of a <c>thread.created</c> event.
1919
/// </summary>
2020
/// <remarks> This reason is typically only associated with calls to
21-
/// <see cref="PersistentAgentsAdministration.CreateThreadAndRun(string, PersistentAgentThreadCreationOptions, string, string, System.Collections.Generic.IEnumerable{ToolDefinition}, UpdateToolResourcesOptions, bool?, float?, float?, int?, int?, Truncation, System.BinaryData, System.BinaryData, bool?, System.Collections.Generic.IReadOnlyDictionary{string, string}, System.Threading.CancellationToken)"/>,
21+
/// <see cref="PersistentAgentsAdministrationClient.CreateThreadAndRun(string, PersistentAgentThreadCreationOptions, string, string, System.Collections.Generic.IEnumerable{ToolDefinition}, UpdateToolResourcesOptions, bool?, float?, float?, int?, int?, Truncation, System.BinaryData, System.BinaryData, bool?, System.Collections.Generic.IReadOnlyDictionary{string, string}, System.Threading.CancellationToken)"/>,
2222
/// as other run-related methods operate on a thread that has previously been created.
2323
/// </remarks>
2424
ThreadCreated,

sdk/ai/Azure.AI.Agents.Persistent/src/Generated/AIAgentsPersistentClientBuilderExtensions.cs

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateAgentRequest.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sdk/ai/Azure.AI.Agents.Persistent/src/Generated/CreateRunRequest.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)