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
|
|
|
|
2025-04-25 14:58:04 +00:00
|
|
|
Task Connect(
|
|
|
|
|
RealtimeHubConnection conn,
|
2025-05-13 20:43:08 +00:00
|
|
|
Func<Task> onModelReady,
|
|
|
|
|
Func<string, string, Task> onModelAudioDeltaReceived,
|
|
|
|
|
Func<Task> onModelAudioResponseDone,
|
|
|
|
|
Func<string, Task> onModelAudioTranscriptDone,
|
2025-05-19 20:44:20 +00:00
|
|
|
Func<List<RoleDialogModel>, Task> onModelResponseDone,
|
2025-05-13 20:43:08 +00:00
|
|
|
Func<string, Task> onConversationItemCreated,
|
|
|
|
|
Func<RoleDialogModel, Task> onInputAudioTranscriptionDone,
|
|
|
|
|
Func<Task> onInterruptionDetected);
|
2025-05-14 23:14:01 +00:00
|
|
|
|
2025-05-19 19:54:40 +00:00
|
|
|
Task Reconnect(RealtimeHubConnection conn);
|
|
|
|
|
|
2025-02-09 23:31:46 +00:00
|
|
|
Task AppenAudioBuffer(string message);
|
2025-04-07 04:15:27 +00:00
|
|
|
Task AppenAudioBuffer(ArraySegment<byte> data, int length);
|
2025-02-09 23:31:46 +00:00
|
|
|
|
|
|
|
|
Task SendEventToModel(object message);
|
|
|
|
|
Task Disconnect();
|
|
|
|
|
|
2025-04-28 22:23:25 +00:00
|
|
|
Task<string> UpdateSession(RealtimeHubConnection conn, bool isInit = false);
|
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-03 04:02:36 +00:00
|
|
|
}
|