diff --git a/.dotnet/api/OpenAI.netstandard2.0.cs b/.dotnet/api/OpenAI.netstandard2.0.cs index 24d7c45a5..2504700eb 100644 --- a/.dotnet/api/OpenAI.netstandard2.0.cs +++ b/.dotnet/api/OpenAI.netstandard2.0.cs @@ -1088,6 +1088,12 @@ public enum GeneratedSpeechVoice { Nova = 4, Shimmer = 5 } + public static class OpenAIAudioModelFactory { + public static AudioTranscription AudioTranscription(string language = null, TimeSpan? duration = null, string text = null, IEnumerable words = null, IEnumerable segments = null); + public static AudioTranslation AudioTranslation(string language = null, TimeSpan? duration = null, string text = null, IEnumerable segments = null); + public static TranscribedSegment TranscribedSegment(int id = 0, long seekOffset = 0, TimeSpan start = default, TimeSpan end = default, string text = null, IEnumerable tokenIds = null, float temperature = 0, double averageLogProbability = 0, float compressionRatio = 0, double noSpeechProbability = 0); + public static TranscribedWord TranscribedWord(string word = null, TimeSpan start = default, TimeSpan end = default); + } public class SpeechGenerationOptions : IJsonModel, IPersistableModel { public GeneratedSpeechFormat? ResponseFormat { get; set; } public float? Speed { get; set; } @@ -1593,6 +1599,11 @@ public class EmbeddingTokenUsage : IJsonModel, IPersistable string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options); BinaryData IPersistableModel.Write(ModelReaderWriterOptions options); } + public static class OpenAIEmbeddingsModelFactory { + public static Embedding Embedding(int index = 0, IEnumerable vector = null); + public static EmbeddingCollection EmbeddingCollection(IEnumerable items = null, string model = null, EmbeddingTokenUsage usage = null); + public static EmbeddingTokenUsage EmbeddingTokenUsage(int inputTokens = 0, int totalTokens = 0); + } } namespace OpenAI.Files { public class FileClient { @@ -1868,6 +1879,10 @@ public class ImageVariationOptions : IJsonModel, IPersist string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options); BinaryData IPersistableModel.Write(ModelReaderWriterOptions options); } + public static class OpenAIImagesModelFactory { + public static GeneratedImage GeneratedImage(BinaryData imageBytes = null, Uri imageUri = null, string revisedPrompt = null); + public static GeneratedImageCollection GeneratedImageCollection(DateTimeOffset createdAt = default, IEnumerable items = null); + } } namespace OpenAI.Models { public class ModelClient { diff --git a/.dotnet/tests/Assistants/AssistantTests.cs b/.dotnet/tests/Assistants/AssistantTests.cs index 662707963..b38e4e5cf 100644 --- a/.dotnet/tests/Assistants/AssistantTests.cs +++ b/.dotnet/tests/Assistants/AssistantTests.cs @@ -24,7 +24,7 @@ public partial class AssistantTests protected void Cleanup() { // Skip cleanup if there is no API key (e.g., if we are not running live tests). - if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("OPEN_API_KEY"))) + if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("OPENAI_API_KEY"))) { return; } diff --git a/.dotnet/tests/Telemetry/TestActivityListener.cs b/.dotnet/tests/Telemetry/TestActivityListener.cs index a236691b7..f7a5208a3 100644 --- a/.dotnet/tests/Telemetry/TestActivityListener.cs +++ b/.dotnet/tests/Telemetry/TestActivityListener.cs @@ -35,7 +35,7 @@ public void Dispose() _listener.Dispose(); } - public static void ValidateChatActivity(Activity activity, ChatCompletion response, string requestModel = "gpt-3.5-turbo", string host = "api.openai.com", int port = 443) + public static void ValidateChatActivity(Activity activity, ChatCompletion response, string requestModel = "gpt-4o-mini", string host = "api.openai.com", int port = 443) { Assert.NotNull(activity); Assert.AreEqual($"chat {requestModel}", activity.DisplayName); @@ -64,7 +64,7 @@ public static void ValidateChatActivity(Activity activity, ChatCompletion respon } } - public static void ValidateChatActivity(Activity activity, Exception ex, string requestModel = "gpt-3.5-turbo", string host = "api.openai.com", int port = 443) + public static void ValidateChatActivity(Activity activity, Exception ex, string requestModel = "gpt-4o-mini", string host = "api.openai.com", int port = 443) { ValidateChatActivity(activity, (ChatCompletion)null, requestModel, host, port); Assert.AreEqual(ex.GetType().FullName, activity.GetTagItem("error.type")); diff --git a/.dotnet/tests/Telemetry/TestMeterListener.cs b/.dotnet/tests/Telemetry/TestMeterListener.cs index 187f94015..b918beb7f 100644 --- a/.dotnet/tests/Telemetry/TestMeterListener.cs +++ b/.dotnet/tests/Telemetry/TestMeterListener.cs @@ -60,7 +60,7 @@ public void Dispose() _listener.Dispose(); } - public static void ValidateChatMetricTags(TestMeasurement measurement, ChatCompletion response, string requestModel = "gpt-3.5-turbo", string host = "api.openai.com", int port = 443) + public static void ValidateChatMetricTags(TestMeasurement measurement, ChatCompletion response, string requestModel = "gpt-4o-mini", string host = "api.openai.com", int port = 443) { Assert.AreEqual("openai", measurement.tags["gen_ai.system"]); Assert.AreEqual("chat", measurement.tags["gen_ai.operation.name"]); @@ -75,7 +75,7 @@ public static void ValidateChatMetricTags(TestMeasurement measurement, ChatCompl } } - public static void ValidateChatMetricTags(TestMeasurement measurement, Exception ex, string requestModel = "gpt-3.5-turbo", string host = "api.openai.com", int port = 443) + public static void ValidateChatMetricTags(TestMeasurement measurement, Exception ex, string requestModel = "gpt-4o-mini", string host = "api.openai.com", int port = 443) { ValidateChatMetricTags(measurement, (ChatCompletion)null, requestModel, host, port); Assert.True(measurement.tags.ContainsKey("error.type")); diff --git a/.scripts/Export-API.ps1 b/.scripts/Export-API.ps1 index b9129d003..03b1e5d27 100644 --- a/.scripts/Export-API.ps1 +++ b/.scripts/Export-API.ps1 @@ -19,29 +19,44 @@ Write-Output "" $net80ref = Get-ChildItem -Recurse ` -Path "$($env:ProgramFiles)\dotnet\packs\Microsoft.NETCore.App.Ref" ` -Include "net8.0" | Select-Object -Last 1 +$systemClientModelRef = Get-ChildItem -Recurse ` + -Path "$($env:UserProfile)\.nuget\packages\system.clientmodel\1.1.0-beta.5" ` + -Include "netstandard2.0" | Select-Object -Last 1 $systemMemoryDataRef = Get-ChildItem -Recurse ` - -Path "$($env:UserProfile)\.nuget\packages\system.memory.data" ` + -Path "$($env:UserProfile)\.nuget\packages\system.memory.data\1.0.2" ` -Include "netstandard2.0" | Select-Object -Last 1 -$systemClientmodelRef = Get-ChildItem -Recurse ` - -Path "$($env:UserProfile)\.nuget\packages\system.clientmodel" ` +$systemDiagnosticsDiagnosticSourceRef = Get-ChildItem -Recurse ` + -Path "$($env:UserProfile)\.nuget\packages\system.diagnostics.diagnosticsource\8.0.1" ` -Include "netstandard2.0" | Select-Object -Last 1 -$microsoftBclAsyncinterfacesRef = Get-ChildItem -Recurse ` +$microsoftBclAsyncInterfacesRef = Get-ChildItem -Recurse ` -Path "$($env:UserProfile)\.nuget\packages\microsoft.bcl.asyncinterfaces\1.1.0" ` -Include "netstandard2.0" | Select-Object -Last 1 Write-Output "Assembly reference paths:" -Write-Output "* NETCore: $($net80ref)" -Write-Output "* System.Memory.Data: $($systemMemoryDataRef)" -Write-Output "* System.ClientModel: $($systemClientmodelRef)" -Write-Output "* Microsoft.Bcl.AsyncInterfaces: $($microsoftBclAsyncinterfacesRef)" +Write-Output "* NETCore:" +Write-Output " $($net80ref)" +Write-Output "" +Write-Output "* System.ClientModel:" +Write-Output " $($systemClientModelRef)" +Write-Output "" +Write-Output "* System.Memory.Data:" +Write-Output " $($systemMemoryDataRef)" +Write-Output "" +Write-Output "* System.Diagnostics.DiagnosticSource:" +Write-Output " $($systemDiagnosticsDiagnosticSourceRef)" +Write-Output "" +Write-Output "* Microsoft.Bcl.AsyncInterfaces:" +Write-Output " $($microsoftBclAsyncInterfacesRef)" +Write-Output "" Write-Output "NOTE: if any of the above are empty, tool output may be inaccurate." Write-Output "" genapi --assembly $assemblyPath --output-path $outputPath ` --assembly-reference $net80ref ` + --assembly-reference $systemClientModelRef ` --assembly-reference $systemMemoryDataRef ` - --assembly-reference $systemClientmodelRef ` - --assembly-reference $microsoftBclAsyncinterfacesRef + --assembly-reference $systemDiagnosticsDiagnosticSourceRef ` + --assembly-reference $microsoftBclAsyncInterfacesRef Write-Output "Cleaning up OpenAI.netstandard2.0.cs..." Write-Output ""