Added official file support
Publish Library / Build NPM Project (push) Successful in 58s
Publish Library / Tag Version (push) Successful in 13s

This commit is contained in:
2026-08-16 15:40:50 -04:00
parent 7308927a3c
commit 797a40a566
5 changed files with 488 additions and 212 deletions
+8 -1
View File
@@ -24,6 +24,13 @@ export class Anthropic extends LLMProvider {
return client;
}
private toWireContent(content: any): any {
if(!Array.isArray(content)) return content;
return content.map(c => c.type === 'image'
? {type: 'image', source: {type: 'base64', media_type: c.mime, data: c.data}}
: {type: 'text', text: c.text});
}
/** Convert standard history -> Anthropic wire format */
private toWire(history: LLMMessage[]): any[] {
const wire: any[] = [];
@@ -34,7 +41,7 @@ export class Anthropic extends LLMProvider {
{role: 'user', content: [{type: 'tool_result', tool_use_id: h.id, is_error: !!h.error, content: h.error || h.content || ''}]}
);
} else {
wire.push({role: h.role, content: h.content});
wire.push({role: h.role, content: this.toWireContent(h.content)});
}
}
return wire;