@@ -55,6 +55,28 @@ test('finalize drops duplicate name+args when ids differ', () => {
|
||||
assert.equal(out.length, 1)
|
||||
})
|
||||
|
||||
test('extract hermes <tool_call> JSON from assistant text', () => {
|
||||
const { bareAgentExtractToolCallsFromText, bareAgentStripToolCallsFromText } =
|
||||
loadToolCallFns()
|
||||
const text =
|
||||
'Working.\n<tool_call>{"name":"read_file","arguments":{"path":"/home/guest/x"}}</tool_call>'
|
||||
const out = bareAgentExtractToolCallsFromText(text)
|
||||
assert.equal(out.length, 1)
|
||||
assert.equal(out[0].function.name, 'read_file')
|
||||
assert.ok(String(out[0].function.arguments).includes('/home/guest/x'))
|
||||
assert.equal(bareAgentStripToolCallsFromText(text), 'Working.')
|
||||
})
|
||||
|
||||
test('extract qwen3.5 XML tool_call from assistant text', () => {
|
||||
const { bareAgentExtractToolCallsFromText } = loadToolCallFns()
|
||||
const text =
|
||||
'<tool_call><function=list_directory><parameter=path>/home</parameter></function></tool_call>'
|
||||
const out = bareAgentExtractToolCallsFromText(text)
|
||||
assert.equal(out.length, 1)
|
||||
assert.equal(out[0].function.name, 'list_directory')
|
||||
assert.equal(JSON.parse(out[0].function.arguments).path, '/home')
|
||||
})
|
||||
|
||||
test('finalize keeps same tool with different args', () => {
|
||||
const { bareAgentMergeToolCallDelta, bareAgentFinalizeToolCalls } = loadToolCallFns()
|
||||
const acc = new Map()
|
||||
|
||||
Reference in New Issue
Block a user