feat(test): enable native tool calling for GPT-OSS invoice extraction

- Update smartai to v0.13.2 (native tool calling support)
- Update smartagent to v1.5.1 (useNativeToolCalling option)
- Enable think: true for GPT-OSS reasoning mode in Ollama config
- Enable useNativeToolCalling: true in DualAgentOrchestrator
- Simplify driver system message (native tools don't need XML instructions)

Native tool calling uses Ollama's built-in Harmony format parser
instead of requiring XML generation, which is more efficient for GPT-OSS models.
This commit is contained in:
2026-01-20 02:51:52 +00:00
parent cf282b2437
commit 9bc1f74978
3 changed files with 22 additions and 27 deletions

View File

@@ -30,8 +30,10 @@ const smartAi = new SmartAi({
baseUrl: OLLAMA_URL,
model: EXTRACTION_MODEL,
defaultOptions: {
num_ctx: 32768, // Larger context for long invoices + thinking
temperature: 0, // Deterministic for JSON extraction
num_ctx: 65536, // 64K context for long invoices + reasoning chains
temperature: 0, // Deterministic for JSON extraction
repeat_penalty: 1.3, // Penalty to prevent repetition loops
think: true, // Enable thinking mode for GPT-OSS reasoning
},
defaultTimeout: 600000, // 10 minute timeout for large documents
},
@@ -636,7 +638,7 @@ tap.test('Stage 2: Setup Ollama + GPT-OSS 20B', async () => {
console.log(' [SmartAgent] Starting SmartAi...');
await smartAi.start();
console.log(' [SmartAgent] Creating DualAgentOrchestrator...');
console.log(' [SmartAgent] Creating DualAgentOrchestrator with native tool calling...');
orchestrator = new DualAgentOrchestrator({
smartAiInstance: smartAi,
defaultProvider: 'ollama',
@@ -652,18 +654,11 @@ tap.test('Stage 2: Setup Ollama + GPT-OSS 20B', async () => {
CRITICAL RULES:
1. Output valid JSON with the exact format requested
2. If you cannot find a value, use empty string "" or 0 for numbers
3. IMPORTANT: Before completing, validate your JSON using the json.validate tool:
<tool_call>
<tool>json</tool>
<action>validate</action>
<params>{"jsonString": "YOUR_JSON", "requiredFields": ["invoice_number", "invoice_date", "vendor_name", "currency", "net_amount", "vat_amount", "total_amount"]}</params>
</tool_call>
4. Only complete after validation passes
When done, wrap your JSON in <task_complete></task_complete> tags.`,
3. Before completing, validate your JSON using the json_validate tool
4. Only complete after validation passes`,
maxIterations: 5,
// Enable native tool calling for GPT-OSS (uses Harmony format instead of XML)
useNativeToolCalling: true,
// Enable streaming for real-time progress visibility
onToken: (token, source) => {
if (source === 'driver') {