2025-02-03 04:02:36 +00:00
|
|
|
using BotSharp.Abstraction.Realtime.Models;
|
|
|
|
|
|
|
|
|
|
namespace BotSharp.Abstraction.MLTasks;
|
|
|
|
|
|
|
|
|
|
public interface IRealTimeCompletion
|
|
|
|
|
{
|
|
|
|
|
string Provider { get; }
|
2025-02-07 22:40:57 +00:00
|
|
|
string Model { get; }
|
2025-02-03 04:02:36 +00:00
|
|
|
void SetModelName(string model);
|
2025-02-09 23:31:46 +00:00
|
|
|
|
|
|
|
|
Task Connect(RealtimeHubConnection conn,
|
|
|
|
|
Action onModelReady,
|
2025-03-06 09:03:30 +00:00
|
|
|
Action<string, string> onModelAudioDeltaReceived,
|
2025-02-09 23:31:46 +00:00
|
|
|
Action onModelAudioResponseDone,
|
|
|
|
|
Action<string> onAudioTranscriptDone,
|
2025-02-11 23:27:07 +00:00
|
|
|
Action<List<RoleDialogModel>> onModelResponseDone,
|
|
|
|
|
Action<string> onConversationItemCreated,
|
|
|
|
|
Action<RoleDialogModel> onInputAudioTranscriptionCompleted,
|
2025-02-09 23:31:46 +00:00
|
|
|
Action onUserInterrupted);
|
|
|
|
|
Task AppenAudioBuffer(string message);
|
|
|
|
|
|
|
|
|
|
Task SendEventToModel(object message);
|
|
|
|
|
Task Disconnect();
|
|
|
|
|
|
2025-03-15 02:06:40 +00:00
|
|
|
Task<string> UpdateSession(RealtimeHubConnection conn, bool interruptResponse = true);
|
2025-02-11 23:27:07 +00:00
|
|
|
Task InsertConversationItem(RoleDialogModel message);
|
2025-03-01 00:19:44 +00:00
|
|
|
Task RemoveConversationItem(string itemId);
|
2025-02-10 21:52:10 +00:00
|
|
|
Task TriggerModelInference(string? instructions = null);
|
2025-03-01 00:19:44 +00:00
|
|
|
Task CancelModelResponse();
|
2025-02-09 23:31:46 +00:00
|
|
|
Task<List<RoleDialogModel>> OnResponsedDone(RealtimeHubConnection conn, string response);
|
2025-02-11 23:27:07 +00:00
|
|
|
Task<RoleDialogModel> OnConversationItemCreated(RealtimeHubConnection conn, string response);
|
2025-02-03 04:02:36 +00:00
|
|
|
}
|