Skip to content

Commit 34fc480

Browse files
committed
add autocompleted analytics to tool calls
1 parent 9c10f8b commit 34fc480

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

backend/src/xml-stream-parser.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export async function* processStreamWithTags(
4848
): AsyncGenerator<string> {
4949
let streamCompleted = false
5050
let buffer = ''
51+
let autocompleted = false
5152

5253
function extractToolCalls(): string[] {
5354
const matches: string[] = []
@@ -73,6 +74,7 @@ export async function* processStreamWithTags(
7374
contents,
7475
model: loggerOptions?.model,
7576
agent: loggerOptions?.agentName,
77+
autocompleted,
7678
}
7779
)
7880
const shortenedContents =
@@ -96,6 +98,7 @@ export async function* processStreamWithTags(
9698
toolName,
9799
model: loggerOptions?.model,
98100
agent: loggerOptions?.agentName,
101+
autocompleted,
99102
}
100103
)
101104
onError(toolName, `Tool not found: ${toolName}`)
@@ -106,6 +109,7 @@ export async function* processStreamWithTags(
106109
toolName,
107110
contents,
108111
parsedParams,
112+
autocompleted,
109113
model: loggerOptions?.model,
110114
agent: loggerOptions?.agentName,
111115
})
@@ -131,6 +135,7 @@ export async function* processStreamWithTags(
131135
if (buffer) {
132136
buffer += completionSuffix
133137
chunk = completionSuffix
138+
autocompleted = true
134139
}
135140
extractToolsFromBufferAndProcess()
136141
}

0 commit comments

Comments
 (0)