@unified-llm/core
Version:
Unified LLM interface (in-memory).
31 lines • 915 B
JavaScript
// 抽象基底クラス
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');
}
}
export default BaseProvider;
//# sourceMappingURL=base-provider.js.map