Spaces:
Running
Running
| import test from 'node:test'; | |
| import assert from 'node:assert/strict'; | |
| import { convertAnthropicToGoogle } from '../../src/format/request-converter.js'; | |
| test('googleSearch is a built-in tool, not a function declaration', () => { | |
| const google = convertAnthropicToGoogle({ | |
| model: 'gemini-3.5-flash-low', | |
| messages: [{ role: 'user', content: 'latest news' }], | |
| tools: [ | |
| { googleSearch: {} }, | |
| { | |
| name: 'lookup_record', | |
| description: 'Look up a record', | |
| input_schema: { type: 'object', properties: { id: { type: 'string' } } } | |
| } | |
| ] | |
| }); | |
| assert.equal(google.tools.some(tool => tool.googleSearch), true); | |
| const declarations = google.tools.find(tool => tool.functionDeclarations)?.functionDeclarations || []; | |
| assert.deepEqual(declarations.map(item => item.name), ['lookup_record']); | |
| }); | |