Skip to content

Commit 352ac92

Browse files
renal128cursoragent
andcommitted
refactor: simplify client tool callback name
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent 622f5ae commit 352ac92

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

Sources/ElevenLabs/Internal/Conversation/Conversation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ final class Conversation: ObservableObject {
538538
try? await publish(pong)
539539

540540
case let .clientToolCall(toolCall):
541-
callbacks.onUnhandledClientToolCall?(toolCall)
541+
callbacks.onClientToolCall?(toolCall)
542542
pendingToolCalls.append(toolCall)
543543

544544
case let .vadScore(vad):

Sources/ElevenLabs/Public/Conversation/ConversationCallbacks.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public struct ConversationCallbacks: Sendable {
4949
public var onCanSendFeedbackChange: (@Sendable (Bool) -> Void)?
5050

5151
/// Called when a client tool call is received without a registered handler.
52-
public var onUnhandledClientToolCall: (@Sendable (ClientToolCallEvent) -> Void)?
52+
public var onClientToolCall: (@Sendable (ClientToolCallEvent) -> Void)?
5353

5454
/// Called whenever the agent state changes (event-based mode only).
5555
public var onAgentStateChange: (@Sendable (ElevenLabs.AgentState) -> Void)?
@@ -70,7 +70,7 @@ public struct ConversationCallbacks: Sendable {
7070
onVadScore: (@Sendable (_ score: Double) -> Void)? = nil,
7171
onAudioAlignment: (@Sendable (AudioAlignment) -> Void)? = nil,
7272
onCanSendFeedbackChange: (@Sendable (Bool) -> Void)? = nil,
73-
onUnhandledClientToolCall: (@Sendable (ClientToolCallEvent) -> Void)? = nil,
73+
onClientToolCall: (@Sendable (ClientToolCallEvent) -> Void)? = nil,
7474
onAgentStateChange: (@Sendable (ElevenLabs.AgentState) -> Void)? = nil
7575
) {
7676
self.onAgentReady = onAgentReady
@@ -88,7 +88,7 @@ public struct ConversationCallbacks: Sendable {
8888
self.onVadScore = onVadScore
8989
self.onAudioAlignment = onAudioAlignment
9090
self.onCanSendFeedbackChange = onCanSendFeedbackChange
91-
self.onUnhandledClientToolCall = onUnhandledClientToolCall
91+
self.onClientToolCall = onClientToolCall
9292
self.onAgentStateChange = onAgentStateChange
9393
}
9494
}

0 commit comments

Comments
 (0)