-
Notifications
You must be signed in to change notification settings - Fork 854
Realtime Client Proposal #7285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Realtime Client Proposal #7285
Changes from all commits
4c04354
d6d6671
07947cc
f2fe352
4f9f05d
ff14b19
770fa28
3cbb1d2
5511b8d
fbdc7cb
f33e790
7dad147
d66e6fe
fc5341e
77449ba
f7fe2ef
a6b4ccd
03d7648
5845991
63531b5
f333eaa
4a6947e
29bbdca
ab0e74d
39a042d
46ae23d
156b376
f59afd6
e8393c1
6aae7d3
c7f041b
cde880a
d2516c2
1d15400
0ca0a17
03014ce
02fd006
aa17989
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,144 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids --> | ||
| <Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_ModelId</Target> | ||
| <Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_SpeechLanguage</Target> | ||
| <Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_ModelId(System.String)</Target> | ||
| <Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_SpeechLanguage(System.String)</Target> | ||
| <Left>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net10.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_ModelId</Target> | ||
| <Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_SpeechLanguage</Target> | ||
| <Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_ModelId(System.String)</Target> | ||
| <Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_SpeechLanguage(System.String)</Target> | ||
| <Left>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net462/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_ModelId</Target> | ||
| <Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_SpeechLanguage</Target> | ||
| <Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_ModelId(System.String)</Target> | ||
| <Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_SpeechLanguage(System.String)</Target> | ||
| <Left>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net8.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_ModelId</Target> | ||
| <Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_SpeechLanguage</Target> | ||
| <Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_ModelId(System.String)</Target> | ||
| <Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_SpeechLanguage(System.String)</Target> | ||
| <Left>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/net9.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_ModelId</Target> | ||
| <Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.get_SpeechLanguage</Target> | ||
| <Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_ModelId(System.String)</Target> | ||
| <Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| <Suppression> | ||
| <DiagnosticId>CP0002</DiagnosticId> | ||
| <Target>M:Microsoft.Extensions.AI.SpeechToTextOptions.set_SpeechLanguage(System.String)</Target> | ||
| <Left>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Left> | ||
| <Right>lib/netstandard2.0/Microsoft.Extensions.AI.Abstractions.dll</Right> | ||
| <IsBaselineSuppression>true</IsBaselineSuppression> | ||
| </Suppression> | ||
| </Suppressions> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.Shared.DiagnosticIds; | ||
| using Microsoft.Shared.Diagnostics; | ||
|
|
||
| namespace Microsoft.Extensions.AI; | ||
|
|
||
| /// <summary> | ||
| /// Provides an optional base class for an <see cref="IRealtimeSession"/> that passes through calls to another instance. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// This is recommended as a base type when building sessions that can be chained around an underlying <see cref="IRealtimeSession"/>. | ||
| /// The default implementation simply passes each call to the inner session instance. | ||
| /// </remarks> | ||
| [Experimental(DiagnosticIds.Experiments.AIRealTime, UrlFormat = DiagnosticIds.UrlFormat)] | ||
| public class DelegatingRealtimeSession : IRealtimeSession | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="DelegatingRealtimeSession"/> class. | ||
| /// </summary> | ||
| /// <param name="innerSession">The wrapped session instance.</param> | ||
| /// <exception cref="ArgumentNullException"><paramref name="innerSession"/> is <see langword="null"/>.</exception> | ||
| protected DelegatingRealtimeSession(IRealtimeSession innerSession) | ||
| { | ||
| InnerSession = Throw.IfNull(innerSession); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public void Dispose() | ||
| { | ||
| Dispose(disposing: true); | ||
| GC.SuppressFinalize(this); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public async ValueTask DisposeAsync() | ||
| { | ||
| await DisposeAsyncCore().ConfigureAwait(false); | ||
| GC.SuppressFinalize(this); | ||
| } | ||
|
|
||
| /// <summary>Performs async cleanup of managed resources.</summary> | ||
| /// <returns>A task representing the asynchronous dispose operation.</returns> | ||
| #pragma warning disable EA0014 // The async method doesn't support cancellation | ||
| protected virtual async ValueTask DisposeAsyncCore() | ||
| #pragma warning restore EA0014 | ||
| { | ||
| if (InnerSession is IAsyncDisposable asyncDisposable) | ||
| { | ||
| await asyncDisposable.DisposeAsync().ConfigureAwait(false); | ||
| } | ||
| else | ||
| { | ||
| InnerSession.Dispose(); | ||
| } | ||
| } | ||
|
|
||
| /// <summary>Gets the inner <see cref="IRealtimeSession" />.</summary> | ||
| protected IRealtimeSession InnerSession { get; } | ||
|
|
||
| /// <inheritdoc /> | ||
| public virtual RealtimeSessionOptions? Options => InnerSession.Options; | ||
|
|
||
| /// <inheritdoc /> | ||
| public virtual Task SendClientMessageAsync(RealtimeClientMessage message, CancellationToken cancellationToken = default) => | ||
| InnerSession.SendClientMessageAsync(message, cancellationToken); | ||
|
|
||
| /// <inheritdoc /> | ||
| public virtual Task UpdateAsync(RealtimeSessionOptions options, CancellationToken cancellationToken = default) => | ||
| InnerSession.UpdateAsync(options, cancellationToken); | ||
|
|
||
| /// <inheritdoc /> | ||
| public virtual IAsyncEnumerable<RealtimeServerMessage> GetStreamingResponseAsync( | ||
| CancellationToken cancellationToken = default) => | ||
| InnerSession.GetStreamingResponseAsync(cancellationToken); | ||
|
|
||
| /// <inheritdoc /> | ||
| public virtual object? GetService(Type serviceType, object? serviceKey = null) | ||
| { | ||
| _ = Throw.IfNull(serviceType); | ||
|
|
||
| // If the key is non-null, we don't know what it means so pass through to the inner service. | ||
| return | ||
| serviceKey is null && serviceType.IsInstanceOfType(this) ? this : | ||
| InnerSession.GetService(serviceType, serviceKey); | ||
| } | ||
|
|
||
| /// <summary>Provides a mechanism for releasing unmanaged resources.</summary> | ||
| /// <param name="disposing"><see langword="true"/> if being called from <see cref="Dispose()"/>; otherwise, <see langword="false"/>.</param> | ||
| protected virtual void Dispose(bool disposing) | ||
| { | ||
| if (disposing) | ||
| { | ||
| InnerSession.Dispose(); | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.Shared.DiagnosticIds; | ||
|
|
||
| namespace Microsoft.Extensions.AI; | ||
|
|
||
| /// <summary>Represents a real-time client.</summary> | ||
| /// <remarks>This interface provides methods to create and manage real-time sessions.</remarks> | ||
| [Experimental(DiagnosticIds.Experiments.AIRealTime, UrlFormat = DiagnosticIds.UrlFormat)] | ||
| public interface IRealtimeClient : IDisposable | ||
| { | ||
| /// <summary>Creates a new real-time session with the specified options.</summary> | ||
| /// <param name="options">The session options.</param> | ||
| /// <param name="cancellationToken">A token to cancel the operation.</param> | ||
| /// <returns>The created real-time session.</returns> | ||
| Task<IRealtimeSession?> CreateSessionAsync(RealtimeSessionOptions? options = null, CancellationToken cancellationToken = default); | ||
|
|
||
| /// <summary>Asks the <see cref="IRealtimeClient"/> for an object of the specified type <paramref name="serviceType"/>.</summary> | ||
| /// <param name="serviceType">The type of object being requested.</param> | ||
| /// <param name="serviceKey">An optional key that can be used to help identify the target service.</param> | ||
| /// <returns>The found object, otherwise <see langword="null"/>.</returns> | ||
| /// <exception cref="ArgumentNullException"><paramref name="serviceType"/> is <see langword="null"/>.</exception> | ||
| /// <remarks> | ||
| /// The purpose of this method is to allow for the retrieval of strongly typed services that might be provided by the <see cref="IRealtimeClient"/>, | ||
| /// including itself or any services it might be wrapping. | ||
| /// </remarks> | ||
| object? GetService(Type serviceType, object? serviceKey = null); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System; | ||
| using System.Collections.Generic; | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Threading; | ||
| using System.Threading.Tasks; | ||
| using Microsoft.Shared.DiagnosticIds; | ||
|
|
||
| namespace Microsoft.Extensions.AI; | ||
|
|
||
| /// <summary>Represents a real-time session.</summary> | ||
| /// <remarks>This interface provides methods to manage a real-time session and to interact with the real-time model.</remarks> | ||
| [Experimental(DiagnosticIds.Experiments.AIRealTime, UrlFormat = DiagnosticIds.UrlFormat)] | ||
| public interface IRealtimeSession : IDisposable, IAsyncDisposable | ||
| { | ||
| /// <summary>Updates the session with new options.</summary> | ||
| /// <param name="options">The new session options.</param> | ||
| /// <param name="cancellationToken">A token to cancel the operation.</param> | ||
| /// <returns>A task that represents the asynchronous update operation.</returns> | ||
| Task UpdateAsync(RealtimeSessionOptions options, CancellationToken cancellationToken = default); | ||
|
|
||
| /// <summary> | ||
| /// Gets the current session options. | ||
| /// </summary> | ||
| RealtimeSessionOptions? Options { get; } | ||
|
|
||
| /// <summary> | ||
| /// Sends a client message to the session. | ||
| /// </summary> | ||
| /// <param name="message">The client message to send.</param> | ||
| /// <param name="cancellationToken">A token to cancel the operation.</param> | ||
| /// <returns>A task that represents the asynchronous send operation.</returns> | ||
| /// <remarks> | ||
| /// This method allows for sending client messages to the session at any time, which can be used to influence the session's behavior or state. | ||
| /// </remarks> | ||
| Task SendClientMessageAsync(RealtimeClientMessage message, CancellationToken cancellationToken = default); | ||
|
|
||
| /// <summary>Streams the response from the real-time session.</summary> | ||
| /// <param name="cancellationToken">A token to cancel the operation.</param> | ||
| /// <returns>The response messages generated by the session.</returns> | ||
| /// <remarks> | ||
| /// This method cannot be called multiple times concurrently on the same session instance. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the session itself be enumerable?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did consider that, but I believe keeping
Overall, keeping |
||
| /// </remarks> | ||
| IAsyncEnumerable<RealtimeServerMessage> GetStreamingResponseAsync( | ||
| CancellationToken cancellationToken = default); | ||
|
|
||
| /// <summary>Asks the <see cref="IRealtimeSession"/> for an object of the specified type <paramref name="serviceType"/>.</summary> | ||
| /// <param name="serviceType">The type of object being requested.</param> | ||
| /// <param name="serviceKey">An optional key that can be used to help identify the target service.</param> | ||
| /// <returns>The found object, otherwise <see langword="null"/>.</returns> | ||
| /// <exception cref="ArgumentNullException"><paramref name="serviceType"/> is <see langword="null"/>.</exception> | ||
| /// <remarks> | ||
| /// The purpose of this method is to allow for the retrieval of strongly typed services that might be provided by the <see cref="IRealtimeSession"/>, | ||
| /// including itself or any services it might be wrapping. | ||
| /// </remarks> | ||
| object? GetService(Type serviceType, object? serviceKey = null); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Diagnostics.CodeAnalysis; | ||
| using Microsoft.Shared.DiagnosticIds; | ||
|
|
||
| namespace Microsoft.Extensions.AI; | ||
|
|
||
| /// <summary> | ||
| /// Represents options for configuring a real-time session. | ||
| /// </summary> | ||
| [Experimental(DiagnosticIds.Experiments.AIRealTime, UrlFormat = DiagnosticIds.UrlFormat)] | ||
| public enum NoiseReductionOptions | ||
| { | ||
| /// <summary> | ||
| /// No noise reduction applied. | ||
| /// </summary> | ||
| None, | ||
|
|
||
| /// <summary> | ||
| /// for close-talking microphones. | ||
| /// </summary> | ||
| NearField, | ||
|
|
||
| /// <summary> | ||
| /// For far-field microphones. | ||
| /// </summary> | ||
| FarField | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do any providers have the notion of "Auto"?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did some research and not seeing |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unclear as to the semantic of this. RealtimeSessionOptions is a mutable class. If I start setting properties on that while the session is active, is that going to result in immediate changes in behavior?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the abstraction includes an Update Session operation that must be called to update the session. I need a type to use when updating the session (it must be a writable object), and I also want to expose the same information to anyone requesting it at any time, in that case, it can be read-only.
The reason is that, in the middleware layer, I need access to the session properties. OpenAI models allow updating the session after it has been created, but I believe not all providers allow that. Therefore, in most scenarios, I expect that once the session is created with the desired configuration, it will not change much afterward.
I am trying to avoid having two types for that. Do you have a better idea handling that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can make the session options using
initinstead of setters. This will make the object immutable. I believe this will solve the confusion and will be a clearer design. I'll try that and see how it goes.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve made the
RealtimeSessionOptionsproperties non-settable so the object is immutable after creation. This makes the design clearer — the only way to modify session settings now is throughUpdateAsync.