diff --git a/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.net8.0.cs b/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.net8.0.cs index b289176035d1..3589ddc2494b 100644 --- a/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.net8.0.cs +++ b/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.net8.0.cs @@ -489,11 +489,12 @@ public static partial class AIProjectsModelFactory public static Azure.AI.Projects.ConnectionPropertiesApiKeyAuth ConnectionPropertiesApiKeyAuth(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null, Azure.AI.Projects.CredentialsApiKeyAuth credentials = null) { throw null; } public static Azure.AI.Projects.ConnectionResponse ConnectionResponse(string id = null, string name = null, Azure.AI.Projects.ConnectionProperties properties = null) { throw null; } public static Azure.AI.Projects.CredentialsApiKeyAuth CredentialsApiKeyAuth(string key = null) { throw null; } - public static Azure.AI.Projects.Evaluation Evaluation(string id = null, Azure.AI.Projects.InputData data = null, string displayName = null, string description = null, Azure.AI.Projects.SystemData systemData = null, string status = null, System.Collections.Generic.IDictionary tags = null, System.Collections.Generic.IDictionary properties = null, System.Collections.Generic.IDictionary evaluators = null) { throw null; } + public static Azure.AI.Projects.Evaluation Evaluation(string id = null, Azure.AI.Projects.InputData data = null, Azure.AI.Projects.EvaluationTarget target = null, string displayName = null, string description = null, Azure.AI.Projects.SystemData systemData = null, string status = null, System.Collections.Generic.IDictionary tags = null, System.Collections.Generic.IDictionary properties = null, System.Collections.Generic.IDictionary evaluators = null) { throw null; } public static Azure.AI.Projects.EvaluationSchedule EvaluationSchedule(string name = null, Azure.AI.Projects.ApplicationInsightsConfiguration data = null, string description = null, Azure.AI.Projects.SystemData systemData = null, string provisioningState = null, System.Collections.Generic.IDictionary tags = null, System.Collections.Generic.IDictionary properties = null, string isEnabled = null, System.Collections.Generic.IDictionary evaluators = null, Azure.AI.Projects.Trigger trigger = null) { throw null; } public static Azure.AI.Projects.FileSearchToolCallContent FileSearchToolCallContent(Azure.AI.Projects.FileSearchToolCallContentType type = default(Azure.AI.Projects.FileSearchToolCallContentType), string text = null) { throw null; } public static Azure.AI.Projects.GetWorkspaceResponse GetWorkspaceResponse(string id = null, string name = null, Azure.AI.Projects.WorkspaceProperties properties = null) { throw null; } public static Azure.AI.Projects.IncompleteRunDetails IncompleteRunDetails(Azure.AI.Projects.IncompleteDetailsReason reason = default(Azure.AI.Projects.IncompleteDetailsReason)) { throw null; } + public static Azure.AI.Projects.InternalConnectionPropertiesCustomAuth InternalConnectionPropertiesCustomAuth(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null) { throw null; } public static Azure.AI.Projects.InternalConnectionPropertiesNoAuth InternalConnectionPropertiesNoAuth(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null) { throw null; } public static Azure.AI.Projects.ListConnectionsResponse ListConnectionsResponse(System.Collections.Generic.IEnumerable value = null) { throw null; } public static Azure.AI.Projects.MessageDelta MessageDelta(Azure.AI.Projects.MessageRole role = default(Azure.AI.Projects.MessageRole), System.Collections.Generic.IEnumerable content = null) { throw null; } @@ -562,6 +563,19 @@ public static partial class AIProjectsModelFactory public static Azure.AI.Projects.VectorStoreStaticChunkingStrategyResponse VectorStoreStaticChunkingStrategyResponse(Azure.AI.Projects.VectorStoreStaticChunkingStrategyOptions @static = null) { throw null; } public static Azure.AI.Projects.WorkspaceProperties WorkspaceProperties(string applicationInsights = null) { throw null; } } + public partial class AOAIModelConfig : Azure.AI.Projects.TargetModelConfig, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AOAIModelConfig(string azureEndpoint, string apiKey, string azureDeployment) { } + public string ApiKey { get { throw null; } set { } } + public string AzureDeployment { get { throw null; } set { } } + public string AzureEndpoint { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AOAIModelConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AOAIModelConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ApplicationInsightsConfiguration : Azure.AI.Projects.InputData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ApplicationInsightsConfiguration(string resourceId, string query) { } @@ -581,7 +595,8 @@ public enum AuthenticationType ApiKey = 0, EntraId = 1, SAS = 2, - None = 3, + Custom = 3, + None = 4, } public partial class AzureAISearchResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -845,6 +860,7 @@ public Evaluation(Azure.AI.Projects.InputData data, System.Collections.Generic.I public string Status { get { throw null; } } public Azure.AI.Projects.SystemData SystemData { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public Azure.AI.Projects.EvaluationTarget Target { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.Evaluation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -909,6 +925,19 @@ public EvaluationsClient(System.Uri endpoint, string subscriptionId, string reso public virtual Azure.Response Update(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task UpdateAsync(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } } + public partial class EvaluationTarget : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EvaluationTarget(string systemMessage, Azure.AI.Projects.TargetModelConfig modelConfig) { } + public Azure.AI.Projects.TargetModelConfig ModelConfig { get { throw null; } set { } } + public System.Collections.Generic.IDictionary ModelParams { get { throw null; } } + public string SystemMessage { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.EvaluationTarget System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.EvaluationTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class EvaluatorConfiguration : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public EvaluatorConfiguration(string id) { } @@ -1142,6 +1171,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class InternalConnectionPropertiesCustomAuth : Azure.AI.Projects.ConnectionProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal InternalConnectionPropertiesCustomAuth() : base (default(Azure.AI.Projects.ConnectionType), default(string)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.InternalConnectionPropertiesCustomAuth System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.InternalConnectionPropertiesCustomAuth System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class InternalConnectionPropertiesNoAuth : Azure.AI.Projects.ConnectionProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal InternalConnectionPropertiesNoAuth() : base (default(Azure.AI.Projects.ConnectionType), default(string)) { } @@ -1181,6 +1220,18 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.Projects.ListSortOrder left, Azure.AI.Projects.ListSortOrder right) { throw null; } public override string ToString() { throw null; } } + public partial class MAASModelConfig : Azure.AI.Projects.TargetModelConfig, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MAASModelConfig(string azureEndpoint, string apiKey) { } + public string ApiKey { get { throw null; } set { } } + public string AzureEndpoint { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.MAASModelConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.MAASModelConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class MessageAttachment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MessageAttachment(Azure.AI.Projects.VectorStoreDataSource ds, System.Collections.Generic.List tools) { } @@ -2543,6 +2594,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public abstract partial class TargetModelConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected TargetModelConfig() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.TargetModelConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.TargetModelConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class TelemetryClient { protected TelemetryClient() { } diff --git a/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs b/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs index b289176035d1..3589ddc2494b 100644 --- a/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs +++ b/sdk/ai/Azure.AI.Projects/api/Azure.AI.Projects.netstandard2.0.cs @@ -489,11 +489,12 @@ public static partial class AIProjectsModelFactory public static Azure.AI.Projects.ConnectionPropertiesApiKeyAuth ConnectionPropertiesApiKeyAuth(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null, Azure.AI.Projects.CredentialsApiKeyAuth credentials = null) { throw null; } public static Azure.AI.Projects.ConnectionResponse ConnectionResponse(string id = null, string name = null, Azure.AI.Projects.ConnectionProperties properties = null) { throw null; } public static Azure.AI.Projects.CredentialsApiKeyAuth CredentialsApiKeyAuth(string key = null) { throw null; } - public static Azure.AI.Projects.Evaluation Evaluation(string id = null, Azure.AI.Projects.InputData data = null, string displayName = null, string description = null, Azure.AI.Projects.SystemData systemData = null, string status = null, System.Collections.Generic.IDictionary tags = null, System.Collections.Generic.IDictionary properties = null, System.Collections.Generic.IDictionary evaluators = null) { throw null; } + public static Azure.AI.Projects.Evaluation Evaluation(string id = null, Azure.AI.Projects.InputData data = null, Azure.AI.Projects.EvaluationTarget target = null, string displayName = null, string description = null, Azure.AI.Projects.SystemData systemData = null, string status = null, System.Collections.Generic.IDictionary tags = null, System.Collections.Generic.IDictionary properties = null, System.Collections.Generic.IDictionary evaluators = null) { throw null; } public static Azure.AI.Projects.EvaluationSchedule EvaluationSchedule(string name = null, Azure.AI.Projects.ApplicationInsightsConfiguration data = null, string description = null, Azure.AI.Projects.SystemData systemData = null, string provisioningState = null, System.Collections.Generic.IDictionary tags = null, System.Collections.Generic.IDictionary properties = null, string isEnabled = null, System.Collections.Generic.IDictionary evaluators = null, Azure.AI.Projects.Trigger trigger = null) { throw null; } public static Azure.AI.Projects.FileSearchToolCallContent FileSearchToolCallContent(Azure.AI.Projects.FileSearchToolCallContentType type = default(Azure.AI.Projects.FileSearchToolCallContentType), string text = null) { throw null; } public static Azure.AI.Projects.GetWorkspaceResponse GetWorkspaceResponse(string id = null, string name = null, Azure.AI.Projects.WorkspaceProperties properties = null) { throw null; } public static Azure.AI.Projects.IncompleteRunDetails IncompleteRunDetails(Azure.AI.Projects.IncompleteDetailsReason reason = default(Azure.AI.Projects.IncompleteDetailsReason)) { throw null; } + public static Azure.AI.Projects.InternalConnectionPropertiesCustomAuth InternalConnectionPropertiesCustomAuth(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null) { throw null; } public static Azure.AI.Projects.InternalConnectionPropertiesNoAuth InternalConnectionPropertiesNoAuth(Azure.AI.Projects.ConnectionType category = Azure.AI.Projects.ConnectionType.AzureOpenAI, string target = null) { throw null; } public static Azure.AI.Projects.ListConnectionsResponse ListConnectionsResponse(System.Collections.Generic.IEnumerable value = null) { throw null; } public static Azure.AI.Projects.MessageDelta MessageDelta(Azure.AI.Projects.MessageRole role = default(Azure.AI.Projects.MessageRole), System.Collections.Generic.IEnumerable content = null) { throw null; } @@ -562,6 +563,19 @@ public static partial class AIProjectsModelFactory public static Azure.AI.Projects.VectorStoreStaticChunkingStrategyResponse VectorStoreStaticChunkingStrategyResponse(Azure.AI.Projects.VectorStoreStaticChunkingStrategyOptions @static = null) { throw null; } public static Azure.AI.Projects.WorkspaceProperties WorkspaceProperties(string applicationInsights = null) { throw null; } } + public partial class AOAIModelConfig : Azure.AI.Projects.TargetModelConfig, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AOAIModelConfig(string azureEndpoint, string apiKey, string azureDeployment) { } + public string ApiKey { get { throw null; } set { } } + public string AzureDeployment { get { throw null; } set { } } + public string AzureEndpoint { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AOAIModelConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.AOAIModelConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ApplicationInsightsConfiguration : Azure.AI.Projects.InputData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ApplicationInsightsConfiguration(string resourceId, string query) { } @@ -581,7 +595,8 @@ public enum AuthenticationType ApiKey = 0, EntraId = 1, SAS = 2, - None = 3, + Custom = 3, + None = 4, } public partial class AzureAISearchResource : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -845,6 +860,7 @@ public Evaluation(Azure.AI.Projects.InputData data, System.Collections.Generic.I public string Status { get { throw null; } } public Azure.AI.Projects.SystemData SystemData { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public Azure.AI.Projects.EvaluationTarget Target { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.AI.Projects.Evaluation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -909,6 +925,19 @@ public EvaluationsClient(System.Uri endpoint, string subscriptionId, string reso public virtual Azure.Response Update(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task UpdateAsync(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } } + public partial class EvaluationTarget : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EvaluationTarget(string systemMessage, Azure.AI.Projects.TargetModelConfig modelConfig) { } + public Azure.AI.Projects.TargetModelConfig ModelConfig { get { throw null; } set { } } + public System.Collections.Generic.IDictionary ModelParams { get { throw null; } } + public string SystemMessage { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.EvaluationTarget System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.EvaluationTarget System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class EvaluatorConfiguration : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public EvaluatorConfiguration(string id) { } @@ -1142,6 +1171,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class InternalConnectionPropertiesCustomAuth : Azure.AI.Projects.ConnectionProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal InternalConnectionPropertiesCustomAuth() : base (default(Azure.AI.Projects.ConnectionType), default(string)) { } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.InternalConnectionPropertiesCustomAuth System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.InternalConnectionPropertiesCustomAuth System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class InternalConnectionPropertiesNoAuth : Azure.AI.Projects.ConnectionProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal InternalConnectionPropertiesNoAuth() : base (default(Azure.AI.Projects.ConnectionType), default(string)) { } @@ -1181,6 +1220,18 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.AI.Projects.ListSortOrder left, Azure.AI.Projects.ListSortOrder right) { throw null; } public override string ToString() { throw null; } } + public partial class MAASModelConfig : Azure.AI.Projects.TargetModelConfig, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MAASModelConfig(string azureEndpoint, string apiKey) { } + public string ApiKey { get { throw null; } set { } } + public string AzureEndpoint { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.MAASModelConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.MAASModelConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class MessageAttachment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public MessageAttachment(Azure.AI.Projects.VectorStoreDataSource ds, System.Collections.Generic.List tools) { } @@ -2543,6 +2594,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public abstract partial class TargetModelConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected TargetModelConfig() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.TargetModelConfig System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.AI.Projects.TargetModelConfig System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class TelemetryClient { protected TelemetryClient() { } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs index 8637d2103c3c..69d51bb078be 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AIProjectsModelFactory.cs @@ -21,6 +21,7 @@ public static partial class AIProjectsModelFactory /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + /// Evaluation target specifying the model config and parameters. /// Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. /// Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. /// Metadata containing createdBy and modifiedBy information. @@ -29,7 +30,7 @@ public static partial class AIProjectsModelFactory /// Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. /// Evaluators to be used for the evaluation. /// A new instance for mocking. - public static Evaluation Evaluation(string id = null, InputData data = null, string displayName = null, string description = null, SystemData systemData = null, string status = null, IDictionary tags = null, IDictionary properties = null, IDictionary evaluators = null) + public static Evaluation Evaluation(string id = null, InputData data = null, EvaluationTarget target = null, string displayName = null, string description = null, SystemData systemData = null, string status = null, IDictionary tags = null, IDictionary properties = null, IDictionary evaluators = null) { tags ??= new Dictionary(); properties ??= new Dictionary(); @@ -38,6 +39,7 @@ public static Evaluation Evaluation(string id = null, InputData data = null, str return new Evaluation( id, data, + target, displayName, description, systemData, @@ -129,7 +131,7 @@ public static ListConnectionsResponse ListConnectionsResponse(IEnumerable /// The properties of the resource /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , and . /// /// A new instance for mocking. public static ConnectionResponse ConnectionResponse(string id = null, string name = null, ConnectionProperties properties = null) @@ -164,6 +166,15 @@ public static CredentialsApiKeyAuth CredentialsApiKeyAuth(string key = null) return new CredentialsApiKeyAuth(key, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Category of the connection. + /// The connection URL to be used for this service. + /// A new instance for mocking. + public static InternalConnectionPropertiesCustomAuth InternalConnectionPropertiesCustomAuth(ConnectionType category = default, string target = null) + { + return new InternalConnectionPropertiesCustomAuth(AuthenticationType.Custom, category, target, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// Category of the connection. /// The connection URL to be used for this service. diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AOAIModelConfig.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AOAIModelConfig.Serialization.cs new file mode 100644 index 000000000000..0077e6236560 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AOAIModelConfig.Serialization.cs @@ -0,0 +1,150 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class AOAIModelConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AOAIModelConfig)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("azureEndpoint"u8); + writer.WriteStringValue(AzureEndpoint); + writer.WritePropertyName("apiKey"u8); + writer.WriteStringValue(ApiKey); + writer.WritePropertyName("azureDeployment"u8); + writer.WriteStringValue(AzureDeployment); + } + + AOAIModelConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AOAIModelConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAOAIModelConfig(document.RootElement, options); + } + + internal static AOAIModelConfig DeserializeAOAIModelConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string azureEndpoint = default; + string apiKey = default; + string azureDeployment = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureEndpoint"u8)) + { + azureEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("apiKey"u8)) + { + apiKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("azureDeployment"u8)) + { + azureDeployment = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AOAIModelConfig(type, serializedAdditionalRawData, azureEndpoint, apiKey, azureDeployment); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AOAIModelConfig)} does not support writing '{options.Format}' format."); + } + } + + AOAIModelConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAOAIModelConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AOAIModelConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AOAIModelConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAOAIModelConfig(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AOAIModelConfig.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AOAIModelConfig.cs new file mode 100644 index 000000000000..b226cfb94368 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AOAIModelConfig.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Azure OpenAI model configuration. The API version would be selected by the service for querying the model. + public partial class AOAIModelConfig : TargetModelConfig + { + /// Initializes a new instance of . + /// Endpoint URL for AOAI model. + /// API Key for AOAI model. + /// Deployment name for AOAI model. + /// , or is null. + public AOAIModelConfig(string azureEndpoint, string apiKey, string azureDeployment) + { + Argument.AssertNotNull(azureEndpoint, nameof(azureEndpoint)); + Argument.AssertNotNull(apiKey, nameof(apiKey)); + Argument.AssertNotNull(azureDeployment, nameof(azureDeployment)); + + Type = "AOAI"; + AzureEndpoint = azureEndpoint; + ApiKey = apiKey; + AzureDeployment = azureDeployment; + } + + /// Initializes a new instance of . + /// Type of the model configuration. + /// Keeps track of any properties unknown to the library. + /// Endpoint URL for AOAI model. + /// API Key for AOAI model. + /// Deployment name for AOAI model. + internal AOAIModelConfig(string type, IDictionary serializedAdditionalRawData, string azureEndpoint, string apiKey, string azureDeployment) : base(type, serializedAdditionalRawData) + { + AzureEndpoint = azureEndpoint; + ApiKey = apiKey; + AzureDeployment = azureDeployment; + } + + /// Initializes a new instance of for deserialization. + internal AOAIModelConfig() + { + } + + /// Endpoint URL for AOAI model. + public string AzureEndpoint { get; set; } + /// API Key for AOAI model. + public string ApiKey { get; set; } + /// Deployment name for AOAI model. + public string AzureDeployment { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.Serialization.cs index c64772bece56..40f375b55a99 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.Serialization.cs @@ -16,6 +16,7 @@ internal static partial class AuthenticationTypeExtensions AuthenticationType.ApiKey => "ApiKey", AuthenticationType.EntraId => "AAD", AuthenticationType.SAS => "SAS", + AuthenticationType.Custom => "CustomKeys", AuthenticationType.None => "None", _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AuthenticationType value.") }; @@ -25,6 +26,7 @@ public static AuthenticationType ToAuthenticationType(this string value) if (StringComparer.OrdinalIgnoreCase.Equals(value, "ApiKey")) return AuthenticationType.ApiKey; if (StringComparer.OrdinalIgnoreCase.Equals(value, "AAD")) return AuthenticationType.EntraId; if (StringComparer.OrdinalIgnoreCase.Equals(value, "SAS")) return AuthenticationType.SAS; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "CustomKeys")) return AuthenticationType.Custom; if (StringComparer.OrdinalIgnoreCase.Equals(value, "None")) return AuthenticationType.None; throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AuthenticationType value."); } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.cs b/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.cs index 70ef54413110..13808106dd47 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/AuthenticationType.cs @@ -16,6 +16,8 @@ public enum AuthenticationType EntraId, /// Shared Access Signature (SAS) authentication. SAS, + /// Custom authentication. + Custom, /// No authentication. None } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionProperties.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionProperties.Serialization.cs index 8e1e16436855..801d22774bed 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionProperties.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionProperties.Serialization.cs @@ -83,6 +83,7 @@ internal static ConnectionProperties DeserializeConnectionProperties(JsonElement { case "AAD": return InternalConnectionPropertiesAADAuth.DeserializeInternalConnectionPropertiesAADAuth(element, options); case "ApiKey": return ConnectionPropertiesApiKeyAuth.DeserializeConnectionPropertiesApiKeyAuth(element, options); + case "CustomKeys": return InternalConnectionPropertiesCustomAuth.DeserializeInternalConnectionPropertiesCustomAuth(element, options); case "None": return InternalConnectionPropertiesNoAuth.DeserializeInternalConnectionPropertiesNoAuth(element, options); case "SAS": return InternalConnectionPropertiesSASAuth.DeserializeInternalConnectionPropertiesSASAuth(element, options); } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionProperties.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionProperties.cs index b3abf7895c7f..f8422e640716 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionProperties.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionProperties.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Projects /// /// Connection properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , and . /// public abstract partial class ConnectionProperties { diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.cs b/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.cs index 0197ccf697dc..af78c22e4c85 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/ConnectionResponse.cs @@ -51,7 +51,7 @@ public partial class ConnectionResponse /// /// The properties of the resource /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , and . /// /// , or is null. internal ConnectionResponse(string id, string name, ConnectionProperties properties) @@ -71,7 +71,7 @@ internal ConnectionResponse(string id, string name, ConnectionProperties propert /// /// The properties of the resource /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , and . /// /// Keeps track of any properties unknown to the library. internal ConnectionResponse(string id, string name, ConnectionProperties properties, IDictionary serializedAdditionalRawData) @@ -94,7 +94,7 @@ internal ConnectionResponse() /// /// The properties of the resource /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include and . + /// The available derived classes include , and . /// public ConnectionProperties Properties { get; } } diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.Serialization.cs index 3c1fcb985d24..fd8ae44bdf81 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.Serialization.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.Serialization.cs @@ -41,6 +41,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WritePropertyName("data"u8); writer.WriteObjectValue(Data, options); + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteObjectValue(Target, options); + } if (Optional.IsDefined(DisplayName)) { writer.WritePropertyName("displayName"u8); @@ -130,6 +135,7 @@ internal static Evaluation DeserializeEvaluation(JsonElement element, ModelReade } string id = default; InputData data = default; + EvaluationTarget target = default; string displayName = default; string description = default; SystemData systemData = default; @@ -151,6 +157,15 @@ internal static Evaluation DeserializeEvaluation(JsonElement element, ModelReade data = InputData.DeserializeInputData(property.Value, options); continue; } + if (property.NameEquals("target"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + target = EvaluationTarget.DeserializeEvaluationTarget(property.Value, options); + continue; + } if (property.NameEquals("displayName"u8)) { displayName = property.Value.GetString(); @@ -222,6 +237,7 @@ internal static Evaluation DeserializeEvaluation(JsonElement element, ModelReade return new Evaluation( id, data, + target, displayName, description, systemData, diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs b/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs index a5bb875ca420..f40d8ceaad92 100644 --- a/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs +++ b/sdk/ai/Azure.AI.Projects/src/Generated/Evaluation.cs @@ -71,6 +71,7 @@ public Evaluation(InputData data, IDictionary ev /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include and . /// + /// Evaluation target specifying the model config and parameters. /// Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. /// Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. /// Metadata containing createdBy and modifiedBy information. @@ -79,10 +80,11 @@ public Evaluation(InputData data, IDictionary ev /// Evaluation's properties. Unlike tags, properties are add-only. Once added, a property cannot be removed. /// Evaluators to be used for the evaluation. /// Keeps track of any properties unknown to the library. - internal Evaluation(string id, InputData data, string displayName, string description, SystemData systemData, string status, IDictionary tags, IDictionary properties, IDictionary evaluators, IDictionary serializedAdditionalRawData) + internal Evaluation(string id, InputData data, EvaluationTarget target, string displayName, string description, SystemData systemData, string status, IDictionary tags, IDictionary properties, IDictionary evaluators, IDictionary serializedAdditionalRawData) { Id = id; Data = data; + Target = target; DisplayName = displayName; Description = description; SystemData = systemData; @@ -106,6 +108,8 @@ internal Evaluation() /// The available derived classes include and . /// public InputData Data { get; set; } + /// Evaluation target specifying the model config and parameters. + public EvaluationTarget Target { get; set; } /// Display Name for evaluation. It helps to find the evaluation easily in AI Foundry. It does not need to be unique. public string DisplayName { get; set; } /// Description of the evaluation. It can be used to store additional information about the evaluation and is mutable. diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationTarget.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationTarget.Serialization.cs new file mode 100644 index 000000000000..8a494c7146f8 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationTarget.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class EvaluationTarget : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EvaluationTarget)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("systemMessage"u8); + writer.WriteStringValue(SystemMessage); + writer.WritePropertyName("modelConfig"u8); + writer.WriteObjectValue(ModelConfig, options); + if (Optional.IsCollectionDefined(ModelParams)) + { + writer.WritePropertyName("modelParams"u8); + writer.WriteStartObject(); + foreach (var item in ModelParams) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EvaluationTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EvaluationTarget)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEvaluationTarget(document.RootElement, options); + } + + internal static EvaluationTarget DeserializeEvaluationTarget(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string systemMessage = default; + TargetModelConfig modelConfig = default; + IDictionary modelParams = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("systemMessage"u8)) + { + systemMessage = property.Value.GetString(); + continue; + } + if (property.NameEquals("modelConfig"u8)) + { + modelConfig = TargetModelConfig.DeserializeTargetModelConfig(property.Value, options); + continue; + } + if (property.NameEquals("modelParams"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + modelParams = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EvaluationTarget(systemMessage, modelConfig, modelParams ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EvaluationTarget)} does not support writing '{options.Format}' format."); + } + } + + EvaluationTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeEvaluationTarget(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EvaluationTarget)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static EvaluationTarget FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeEvaluationTarget(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationTarget.cs b/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationTarget.cs new file mode 100644 index 000000000000..0e34a83c1531 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/EvaluationTarget.cs @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Target for the evaluation process. + public partial class EvaluationTarget + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// System message related to the evaluation target. + /// + /// Model configuration for the evaluation. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// or is null. + public EvaluationTarget(string systemMessage, TargetModelConfig modelConfig) + { + Argument.AssertNotNull(systemMessage, nameof(systemMessage)); + Argument.AssertNotNull(modelConfig, nameof(modelConfig)); + + SystemMessage = systemMessage; + ModelConfig = modelConfig; + ModelParams = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// System message related to the evaluation target. + /// + /// Model configuration for the evaluation. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A dictionary of parameters for the model. + /// Keeps track of any properties unknown to the library. + internal EvaluationTarget(string systemMessage, TargetModelConfig modelConfig, IDictionary modelParams, IDictionary serializedAdditionalRawData) + { + SystemMessage = systemMessage; + ModelConfig = modelConfig; + ModelParams = modelParams; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EvaluationTarget() + { + } + + /// System message related to the evaluation target. + public string SystemMessage { get; set; } + /// + /// Model configuration for the evaluation. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public TargetModelConfig ModelConfig { get; set; } + /// + /// A dictionary of parameters for the model. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IDictionary ModelParams { get; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/InternalConnectionPropertiesCustomAuth.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/InternalConnectionPropertiesCustomAuth.Serialization.cs new file mode 100644 index 000000000000..dc277ff52eba --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/InternalConnectionPropertiesCustomAuth.Serialization.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class InternalConnectionPropertiesCustomAuth : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalConnectionPropertiesCustomAuth)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + InternalConnectionPropertiesCustomAuth IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalConnectionPropertiesCustomAuth)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalConnectionPropertiesCustomAuth(document.RootElement, options); + } + + internal static InternalConnectionPropertiesCustomAuth DeserializeInternalConnectionPropertiesCustomAuth(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AuthenticationType authType = default; + ConnectionType category = default; + string target = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("authType"u8)) + { + authType = property.Value.GetString().ToAuthenticationType(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString().ToConnectionType(); + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalConnectionPropertiesCustomAuth(authType, category, target, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalConnectionPropertiesCustomAuth)} does not support writing '{options.Format}' format."); + } + } + + InternalConnectionPropertiesCustomAuth IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalConnectionPropertiesCustomAuth(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalConnectionPropertiesCustomAuth)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new InternalConnectionPropertiesCustomAuth FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalConnectionPropertiesCustomAuth(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/InternalConnectionPropertiesCustomAuth.cs b/sdk/ai/Azure.AI.Projects/src/Generated/InternalConnectionPropertiesCustomAuth.cs new file mode 100644 index 000000000000..ec5553dbe294 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/InternalConnectionPropertiesCustomAuth.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Connection properties for connections with Custom authentication. + public partial class InternalConnectionPropertiesCustomAuth : ConnectionProperties + { + /// Initializes a new instance of . + /// Category of the connection. + /// The connection URL to be used for this service. + /// is null. + internal InternalConnectionPropertiesCustomAuth(ConnectionType category, string target) : base(category, target) + { + Argument.AssertNotNull(target, nameof(target)); + + AuthType = AuthenticationType.Custom; + } + + /// Initializes a new instance of . + /// Authentication type of the connection target. + /// Category of the connection. + /// The connection URL to be used for this service. + /// Keeps track of any properties unknown to the library. + internal InternalConnectionPropertiesCustomAuth(AuthenticationType authType, ConnectionType category, string target, IDictionary serializedAdditionalRawData) : base(authType, category, target, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal InternalConnectionPropertiesCustomAuth() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MAASModelConfig.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MAASModelConfig.Serialization.cs new file mode 100644 index 000000000000..efd0bef44562 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/MAASModelConfig.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + public partial class MAASModelConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MAASModelConfig)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("azureEndpoint"u8); + writer.WriteStringValue(AzureEndpoint); + writer.WritePropertyName("apiKey"u8); + writer.WriteStringValue(ApiKey); + } + + MAASModelConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(MAASModelConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMAASModelConfig(document.RootElement, options); + } + + internal static MAASModelConfig DeserializeMAASModelConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string azureEndpoint = default; + string apiKey = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureEndpoint"u8)) + { + azureEndpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("apiKey"u8)) + { + apiKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MAASModelConfig(type, serializedAdditionalRawData, azureEndpoint, apiKey); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(MAASModelConfig)} does not support writing '{options.Format}' format."); + } + } + + MAASModelConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMAASModelConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MAASModelConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new MAASModelConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeMAASModelConfig(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/MAASModelConfig.cs b/sdk/ai/Azure.AI.Projects/src/Generated/MAASModelConfig.cs new file mode 100644 index 000000000000..024f0dd9bb72 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/MAASModelConfig.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// MaaS model configuration. The API version would be selected by the service for querying the model. + public partial class MAASModelConfig : TargetModelConfig + { + /// Initializes a new instance of . + /// Endpoint URL for MAAS model. + /// API Key for MAAS model. + /// or is null. + public MAASModelConfig(string azureEndpoint, string apiKey) + { + Argument.AssertNotNull(azureEndpoint, nameof(azureEndpoint)); + Argument.AssertNotNull(apiKey, nameof(apiKey)); + + Type = "MAAS"; + AzureEndpoint = azureEndpoint; + ApiKey = apiKey; + } + + /// Initializes a new instance of . + /// Type of the model configuration. + /// Keeps track of any properties unknown to the library. + /// Endpoint URL for MAAS model. + /// API Key for MAAS model. + internal MAASModelConfig(string type, IDictionary serializedAdditionalRawData, string azureEndpoint, string apiKey) : base(type, serializedAdditionalRawData) + { + AzureEndpoint = azureEndpoint; + ApiKey = apiKey; + } + + /// Initializes a new instance of for deserialization. + internal MAASModelConfig() + { + } + + /// Endpoint URL for MAAS model. + public string AzureEndpoint { get; set; } + /// API Key for MAAS model. + public string ApiKey { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/TargetModelConfig.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/TargetModelConfig.Serialization.cs new file mode 100644 index 000000000000..7dc24d6f05cc --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/TargetModelConfig.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + [PersistableModelProxy(typeof(UnknownTargetModelConfig))] + public partial class TargetModelConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetModelConfig)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TargetModelConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetModelConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetModelConfig(document.RootElement, options); + } + + internal static TargetModelConfig DeserializeTargetModelConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "AOAI": return AOAIModelConfig.DeserializeAOAIModelConfig(element, options); + case "MAAS": return MAASModelConfig.DeserializeMAASModelConfig(element, options); + } + } + return UnknownTargetModelConfig.DeserializeUnknownTargetModelConfig(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetModelConfig)} does not support writing '{options.Format}' format."); + } + } + + TargetModelConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTargetModelConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetModelConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static TargetModelConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTargetModelConfig(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/TargetModelConfig.cs b/sdk/ai/Azure.AI.Projects/src/Generated/TargetModelConfig.cs new file mode 100644 index 000000000000..a8f5c27ef5ea --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/TargetModelConfig.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// + /// Abstract class for model configuration. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class TargetModelConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected TargetModelConfig() + { + } + + /// Initializes a new instance of . + /// Type of the model configuration. + /// Keeps track of any properties unknown to the library. + internal TargetModelConfig(string type, IDictionary serializedAdditionalRawData) + { + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Type of the model configuration. + internal string Type { get; set; } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownTargetModelConfig.Serialization.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownTargetModelConfig.Serialization.cs new file mode 100644 index 000000000000..59983ae181b4 --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownTargetModelConfig.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.AI.Projects +{ + internal partial class UnknownTargetModelConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetModelConfig)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + TargetModelConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetModelConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetModelConfig(document.RootElement, options); + } + + internal static UnknownTargetModelConfig DeserializeUnknownTargetModelConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownTargetModelConfig(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TargetModelConfig)} does not support writing '{options.Format}' format."); + } + } + + TargetModelConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTargetModelConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetModelConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownTargetModelConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownTargetModelConfig(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/src/Generated/UnknownTargetModelConfig.cs b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownTargetModelConfig.cs new file mode 100644 index 000000000000..b7130f7a857a --- /dev/null +++ b/sdk/ai/Azure.AI.Projects/src/Generated/UnknownTargetModelConfig.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Projects +{ + /// Unknown version of TargetModelConfig. + internal partial class UnknownTargetModelConfig : TargetModelConfig + { + /// Initializes a new instance of . + /// Type of the model configuration. + /// Keeps track of any properties unknown to the library. + internal UnknownTargetModelConfig(string type, IDictionary serializedAdditionalRawData) : base(type, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownTargetModelConfig() + { + } + } +} diff --git a/sdk/ai/Azure.AI.Projects/tsp-location.yaml b/sdk/ai/Azure.AI.Projects/tsp-location.yaml index 19ff923da45e..f4da1987ef4a 100644 --- a/sdk/ai/Azure.AI.Projects/tsp-location.yaml +++ b/sdk/ai/Azure.AI.Projects/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai/Azure.AI.Projects -commit: 7f368fe6ce535a31db2657aafc692682dce8cef8 +commit: 2578f7b2f8e3ffef0f701d191298595fbfb2b005 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: