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
4 changes: 3 additions & 1 deletion OpenAI-DotNet-Proxy/OpenAI-DotNet-Proxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
<IncludeSymbols>true</IncludeSymbols>
<SignAssembly>false</SignAssembly>
<ImplicitUsings>false</ImplicitUsings>
<Version>8.8.2</Version>
<Version>8.8.6</Version>
<PackageReleaseNotes>
Version 8.8.6
- Fix unimplemented routePrefix in OpenAIProxyStartup.CreateWebApplication
Version 8.8.2
- Updated forwarded request headers
Version 8.8.0
Expand Down
8 changes: 6 additions & 2 deletions OpenAI-DotNet-Proxy/Proxy/OpenAIProxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ namespace OpenAI.Proxy
/// </summary>
public class OpenAIProxy
{
private string routePrefix = "";
private OpenAIClient openAIClient;
private IAuthenticationFilter authenticationFilter;

Expand Down Expand Up @@ -46,7 +47,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
app.UseEndpoints(endpoints =>
{
endpoints.MapGet("/health", HealthEndpoint);
endpoints.MapOpenAIEndpoints(openAIClient, authenticationFilter);
endpoints.MapOpenAIEndpoints(openAIClient, authenticationFilter, routePrefix);
});
}

Expand Down Expand Up @@ -92,7 +93,10 @@ public static WebApplication CreateWebApplication<T>(string[] args, OpenAIClient
builder.Services.AddSingleton(openAIClient);
builder.Services.AddSingleton<IAuthenticationFilter, T>();
var app = builder.Build();
var startup = new OpenAIProxy();
var startup = new OpenAIProxy
{
routePrefix = routePrefix
};
startup.Configure(app, app.Environment);
return app;
}
Expand Down
1 change: 1 addition & 0 deletions OpenAI-DotNet-Tests-Proxy/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public partial class Program
{
private const string TestUserToken = "aAbBcCdDeE123456789";

// ReSharper disable once ClassNeverInstantiated.Local
private class AuthenticationFilter : AbstractAuthenticationFilter
{
/// <inheritdoc />
Expand Down
1 change: 1 addition & 0 deletions OpenAI-DotNet-Tests/TestFixture_13_Realtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public async Task Test_01_01_RealtimeSession()
await session.SendAsync(new ConversationItemCreateRequest("Hello!"), cts.Token);
await session.SendAsync(new CreateResponseRequest(), cts.Token);
await session.SendAsync(new InputAudioBufferAppendRequest(new ReadOnlyMemory<byte>(new byte[1024 * 4])), cts.Token);
await session.SendAsync(new UpdateSessionRequest(new SessionConfiguration(model: Model.Transcribe_GPT_4o_Mini, instructions: "You are a fearsome dinosaur. Rawr!", tools: tools)), cts.Token);
await session.SendAsync(new ConversationItemCreateRequest("Goodbye!"), cts.Token);
await session.SendAsync(new CreateResponseRequest(), cts.Token);

Expand Down
4 changes: 3 additions & 1 deletion OpenAI-DotNet/OpenAI-DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ More context [on Roger Pincombe's blog](https://rogerpincombe.com/openai-dotnet-
<AssemblyOriginatorKeyFile>OpenAI-DotNet.pfx</AssemblyOriginatorKeyFile>
<IncludeSymbols>true</IncludeSymbols>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>8.8.4</Version>
<Version>8.8.6</Version>
<PackageReleaseNotes>
Version 8.8.6
- Fix Realtime.UpdateSessionRequests failing to update session due to extra client secret data
Version 8.8.4
- Fix RealtimeSessionConfiguration and CreateResponseRequest model parameter overriding prompt settings
- Fix Threads.MessageResponse.Status not being properly set to Completed
Expand Down
2 changes: 1 addition & 1 deletion OpenAI-DotNet/OpenAIClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ private void Dispose(bool disposing)
internal static JsonSerializerOptions JsonSerializationOptions { get; } = new()
{
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
ReferenceHandler = ReferenceHandler.IgnoreCycles,
Converters =
{
new JsonStringEnumConverterFactory(),
Expand All @@ -129,7 +130,6 @@ private void Dispose(bool disposing)
new FilterConverter(),
new ToolConverter(),
},
ReferenceHandler = ReferenceHandler.IgnoreCycles
};

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion OpenAI-DotNet/Realtime/SessionConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ internal SessionConfiguration(
[JsonInclude]
[JsonPropertyName("client_secret")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public ClientSecret ClientSecret { get; private set; }
public ClientSecret ClientSecret { get; internal set; }

/// <summary>
/// The set of modalities the model can respond with.
Expand Down
1 change: 1 addition & 0 deletions OpenAI-DotNet/Realtime/UpdateSessionRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public UpdateSessionRequest() { }
public UpdateSessionRequest(SessionConfiguration configuration)
{
Configuration = configuration;
Configuration.ClientSecret = null;
}

/// <inheritdoc />
Expand Down
Loading