UNPKG

@unified-llm/core

Version:

Unified LLM interface (in-memory).

51 lines 1.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.callAnotherClient = void 0; exports.setTools = setTools; const llm_client_js_1 = require("../llm-client.js"); const unified_api_js_1 = require("../types/unified-api.js"); // Tools will be injected at runtime to avoid circular dependency let injectedTools; function setTools(tools) { injectedTools = tools; } exports.callAnotherClient = (0, unified_api_js_1.defineTool)({ type: 'function', function: { name: 'callAnotherClient', description: 'Call another LLM client with specified ID and thread', parameters: { type: 'object', properties: { id: { type: 'string', description: 'The ID of the LLM client to call' }, threadId: { type: 'string', description: 'The thread ID for the conversation' } }, required: ['id', 'threadId'] } }, handler: async (args) => { const client = new llm_client_js_1.LLMClient({ id: args.id, provider: 'anthropic', apiKey: process.env.ANTHROPIC_API_KEY || '', tools: injectedTools }); const response = await client.chat({ messages: [{ id: 'msg-1', role: 'user', content: [{ type: 'text', text: '' }], created_at: new Date() }], model: 'claude-3-haiku-20240307' }); return response; } }); //# sourceMappingURL=callAnotherClient.js.map