@unified-llm/core
Version:
Unified LLM interface.
33 lines • 995 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// 抽象基底クラス
class BaseProvider {
// Public getter for model
get modelName() {
return this.model;
}
constructor({ model, tools }) {
this.model = model || undefined;
this.tools = tools;
}
// 共通のヘルパーメソッド
generateMessageId() {
return `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
}
normalizeContent(content) {
if (typeof content === 'string') {
return [{ type: 'text', text: content }];
}
return content;
}
// ツール呼び出しがあるかチェック
hasToolCalls(content) {
return content.some(c => c.type === 'tool_use');
}
// ツール呼び出しを抽出
extractToolCalls(content) {
return content.filter(c => c.type === 'tool_use');
}
}
exports.default = BaseProvider;
//# sourceMappingURL=base-provider.js.map