Files
agent-framework/dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/Models/AgentId.cs
T
103c7e7105 .NET: Improve fidelity of OpenAI Responses hosting (#1550)
* Improve conformance of OpenAI Responses API serving

* Update dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/AgentRunResponseExtensions.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>

* Update dotnet/src/Microsoft.Agents.AI.Hosting.OpenAI/Responses/AgentRunResponseExtensions.cs

Co-authored-by: Stephen Toub <stoub@microsoft.com>

* Sort packages

* Relax adherence where acceptable

* nit

* PromptCacheKey is not obsolete

* format

---------

Co-authored-by: Stephen Toub <stoub@microsoft.com>
2025-10-22 17:48:44 +00:00

88 lines
2.2 KiB
C#

// Copyright (c) Microsoft. All rights reserved.
using System.Text.Json.Serialization;
namespace Microsoft.Agents.AI.Hosting.OpenAI.Responses.Models;
/// <summary>
/// Represents an agent identifier.
/// </summary>
internal sealed record AgentId
{
/// <summary>
/// Initializes a new instance of the <see cref="AgentId"/> class.
/// </summary>
/// <param name="type">The agent ID type.</param>
/// <param name="name">The name of the agent.</param>
/// <param name="version">The version of the agent.</param>
public AgentId(AgentIdType type, string name, string version)
{
this.Type = type;
this.Name = name;
this.Version = version;
}
/// <summary>
/// The agent ID type.
/// </summary>
[JsonPropertyName("type")]
public AgentIdType Type { get; init; }
/// <summary>
/// The name of the agent.
/// </summary>
[JsonPropertyName("name")]
public string Name { get; init; }
/// <summary>
/// The version of the agent.
/// </summary>
[JsonPropertyName("version")]
public string Version { get; init; }
}
/// <summary>
/// Represents an agent ID type.
/// </summary>
internal sealed record AgentIdType
{
/// <summary>
/// Initializes a new instance of the <see cref="AgentIdType"/> class.
/// </summary>
/// <param name="value">The type value.</param>
public AgentIdType(string value)
{
this.Value = value;
}
/// <summary>
/// The type value.
/// </summary>
[JsonPropertyName("type")]
public string Value { get; init; }
}
/// <summary>
/// Represents an agent reference.
/// </summary>
internal sealed record AgentReference
{
/// <summary>
/// The type of the reference (e.g., "agent" or "agent_reference").
/// </summary>
[JsonPropertyName("type")]
public string Type { get; init; } = "agent_reference";
/// <summary>
/// The name of the agent.
/// </summary>
[JsonPropertyName("name")]
public required string Name { get; init; }
/// <summary>
/// The version of the agent.
/// </summary>
[JsonPropertyName("version")]
public string? Version { get; init; }
}