This commit is contained in:
seb
2026-10-16 17:05:43 +02:00
parent 7f28a05ed3
commit 99ac40e6fa
2 changed files with 45 additions and 21 deletions

View File

@@ -1,14 +1,16 @@
import { defineTool } from 'libllmorbiter'; import { defineTool } from 'libllmorbiter';
import { TOOL_DESCRIPTIONS, TOOL_PARAMETER_DESCRIPTIONS } from './prompts.js';
/** /**
* Creates the draft_delivery_manifest tool. * Creates the draft_delivery_manifest tool.
* Stores extracted invoice/delivery-note data: header metadata (basedata), notes, and product line items. * Stores extracted invoice/delivery-note data: header metadata (basedata), notes, and product line items.
*/ */
export function createDraftDeliveryManifestTool() { export function createDraftDeliveryManifestTool() {
const P = TOOL_PARAMETER_DESCRIPTIONS.draft_delivery_manifest;
return defineTool({ return defineTool({
name: 'draft_delivery_manifest', name: 'draft_delivery_manifest',
description: description: TOOL_DESCRIPTIONS.draft_delivery_manifest,
'Stores extracted invoice/delivery-note data: header metadata (basedata), notes, and product line items. Each component is strictly optional — only include the ones that carry new data.',
strict: false, strict: false,
parameters: { parameters: {
type: 'object', type: 'object',
@@ -21,29 +23,29 @@ export function createDraftDeliveryManifestTool() {
type: 'object', type: 'object',
additionalProperties: false, additionalProperties: false,
properties: { properties: {
date: { type: ['string', 'null'], description: 'Document date (ISO 8601)' }, date: { type: ['string', 'null'], description: P.date },
lieferant_id: { type: ['number', 'null'], description: 'Lieferant ID' }, lieferant_id: { type: ['number', 'null'], description: P.lieferant_id },
lieferantName: { type: 'string', description: 'Lieferant name' }, lieferantName: { type: 'string', description: P.lieferantName },
manifestNr: { type: ['string', 'null'], description: 'Lieferscheinnummer or Rechnungsnummer' }, manifestNr: { type: ['string', 'null'], description: P.manifestNr },
manifestType: { manifestType: {
anyOf: [ anyOf: [
{ type: 'string', enum: ['rechnung', 'lieferschein'] }, { type: 'string', enum: ['rechnung', 'lieferschein'] },
{ type: 'null' }, { type: 'null' },
], ],
description: 'Document type', description: P.manifestType,
}, },
}, },
}, },
{ type: 'null' }, { type: 'null' },
], ],
description: 'Header/metadata. Only include fields that are currently missing or changed.', description: P.basedata,
}, },
notes: { notes: {
anyOf: [ anyOf: [
{ type: 'array', items: { type: 'string' } }, { type: 'array', items: { type: 'string' } },
{ type: 'null' }, { type: 'null' },
], ],
description: 'New noteworthy details (in German), for a human to double-check the result.', description: P.notes,
}, },
items: { items: {
anyOf: [ anyOf: [
@@ -51,26 +53,25 @@ export function createDraftDeliveryManifestTool() {
type: 'object', type: 'object',
additionalProperties: false, additionalProperties: false,
properties: { properties: {
numberOfItemsToAdd: { type: 'number', description: 'Number of NEW line items being added in this call.' }, numberOfItemsToAdd: { type: 'number', description: P.numberOfItemsToAdd },
items: { items: {
type: 'array', type: 'array',
description: 'Invoice/delivery product line items', description: P.items_list,
items: { items: {
type: 'object', type: 'object',
additionalProperties: false, additionalProperties: false,
required: ['position', 'count', 'vpe', 'unit', 'articleName', 'liefArtNr', 'mwst', 'eknetto'], required: ['position', 'count', 'vpe', 'unit', 'articleName', 'liefArtNr', 'mwst', 'eknetto'],
properties: { properties: {
position: { type: 'number', description: 'Position' }, position: { type: 'number', description: P.position },
count: { type: 'number', description: 'Quantity (Menge)' }, count: { type: 'number', description: P.count },
vpe: { type: 'number', description: 'Packaging unit size (VPE). Default: 1.' }, vpe: { type: 'number', description: P.vpe },
unit: { type: 'string', description: 'Unit of the individual sellable item. NEVER "VE" or "VPE".' }, articleName: { type: 'string', description: P.articleName },
articleName: { type: 'string', description: 'Article name' }, liefArtNr: { type: 'string', description: P.liefArtNr },
liefArtNr: { type: 'string', description: 'Supplier article number' }, mwst: { // todo those needs to come from company settings.
mwst: {
anyOf: [{ type: 'string', enum: ['7', '19'] }, { type: 'null' }], anyOf: [{ type: 'string', enum: ['7', '19'] }, { type: 'null' }],
description: 'VAT rate; null if missing', description: P.mwst,
}, },
eknetto: { type: ['number', 'null'], description: 'Net price per vpe in euro cents; null if missing' }, eknetto: { type: ['number', 'null'], description: P.eknetto },
}, },
}, },
}, },
@@ -78,7 +79,7 @@ export function createDraftDeliveryManifestTool() {
}, },
{ type: 'null' }, { type: 'null' },
], ],
description: 'New product line items.', description: P.items,
}, },
}, },
}, },

View File

@@ -105,6 +105,9 @@ export const TOOL_DESCRIPTIONS = {
'Subagents can call all tools you can call except subagent, ask_user, and set_user_route. ' + 'Subagents can call all tools you can call except subagent, ask_user, and set_user_route. ' +
'To efficiently communicate with subagents, store the input and output data in VFS files ' + 'To efficiently communicate with subagents, store the input and output data in VFS files ' +
'and provide these paths in the subagent instructions.', 'and provide these paths in the subagent instructions.',
draft_delivery_manifest:
'Stores extracted invoice/delivery-note data: header metadata (basedata), notes, and product line items. Each component is strictly optional — only include the ones that carry new data.',
}; };
// #endregion // #endregion
@@ -258,6 +261,26 @@ export const TOOL_PARAMETER_DESCRIPTIONS = {
conversation_id: 'Existing subagent conversation ID to follow up on, or null to create a new one.', conversation_id: 'Existing subagent conversation ID to follow up on, or null to create a new one.',
max_iterations: 'Safety bound on tool loops (default 15, max 30).', max_iterations: 'Safety bound on tool loops (default 15, max 30).',
}, },
draft_delivery_manifest: {
basedata: 'Header/metadata. Only include fields that are currently missing or changed.',
date: 'Document date (ISO 8601).',
lieferant_id: 'Lieferant ID.',
lieferantName: 'Lieferant name.',
manifestNr: 'Lieferscheinnummer or Rechnungsnummer.',
manifestType: 'Document type.',
notes: 'New noteworthy details (in German), for a human to double-check the result.',
items: 'New product line items.',
numberOfItemsToAdd: 'Number of NEW line items being added in this call.',
items_list: 'Invoice/delivery product line items.',
position: 'Position.',
count: 'Quantity (Menge).',
vpe: 'Packaging unit size (VPE). Default: 1.',
articleName: 'Article name.',
liefArtNr: 'Supplier article number.',
mwst: 'VAT rate; null if missing.',
eknetto: 'Net price per vpe in euro cents; null if missing.',
},
}; };
export const PATCH_PARAMETER_DESCRIPTIONS = TOOL_PARAMETER_DESCRIPTIONS.patch; export const PATCH_PARAMETER_DESCRIPTIONS = TOOL_PARAMETER_DESCRIPTIONS.patch;