Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .dotnet/api/OpenAI.netstandard2.0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<TranscribedWord> words = null, IEnumerable<TranscribedSegment> segments = null);
public static AudioTranslation AudioTranslation(string language = null, TimeSpan? duration = null, string text = null, IEnumerable<TranscribedSegment> segments = null);
public static TranscribedSegment TranscribedSegment(int id = 0, long seekOffset = 0, TimeSpan start = default, TimeSpan end = default, string text = null, IEnumerable<long> 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<SpeechGenerationOptions>, IPersistableModel<SpeechGenerationOptions> {
public GeneratedSpeechFormat? ResponseFormat { get; set; }
public float? Speed { get; set; }
Expand Down Expand Up @@ -1593,6 +1599,11 @@ public class EmbeddingTokenUsage : IJsonModel<EmbeddingTokenUsage>, IPersistable
string IPersistableModel<EmbeddingTokenUsage>.GetFormatFromOptions(ModelReaderWriterOptions options);
BinaryData IPersistableModel<EmbeddingTokenUsage>.Write(ModelReaderWriterOptions options);
}
public static class OpenAIEmbeddingsModelFactory {
public static Embedding Embedding(int index = 0, IEnumerable<float> vector = null);
public static EmbeddingCollection EmbeddingCollection(IEnumerable<Embedding> items = null, string model = null, EmbeddingTokenUsage usage = null);
public static EmbeddingTokenUsage EmbeddingTokenUsage(int inputTokens = 0, int totalTokens = 0);
}
}
namespace OpenAI.Files {
public class FileClient {
Expand Down Expand Up @@ -1868,6 +1879,10 @@ public class ImageVariationOptions : IJsonModel<ImageVariationOptions>, IPersist
string IPersistableModel<ImageVariationOptions>.GetFormatFromOptions(ModelReaderWriterOptions options);
BinaryData IPersistableModel<ImageVariationOptions>.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<GeneratedImage> items = null);
}
}
namespace OpenAI.Models {
public class ModelClient {
Expand Down
2 changes: 1 addition & 1 deletion .dotnet/tests/Assistants/AssistantTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions .dotnet/tests/Telemetry/TestActivityListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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"));
Expand Down
4 changes: 2 additions & 2 deletions .dotnet/tests/Telemetry/TestMeterListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]);
Expand All @@ -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"));
Expand Down
35 changes: 25 additions & 10 deletions .scripts/Export-API.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""
Expand Down