UNPKG

@botonic/plugin-knowledge-bases

Version:

Botonic plugin for **knowledge base** features (retrieval, grounding, etc.) on the **current** framework line.

26 lines 1.1 kB
import { __awaiter } from "tslib"; import { HubtypeApiService } from './hubtype-knowledge-api-service'; export class BotonicPluginKnowledgeBases { constructor(options) { this.apiService = new HubtypeApiService(options.host, options.timeout); } pre(_botonicContext) { return __awaiter(this, void 0, void 0, function* () { return; }); } getInference(botonicContext, sources, instructions, messageId, memoryLength) { return __awaiter(this, void 0, void 0, function* () { const authToken = botonicContext.secrets.hubtypeAccessToken; const response = yield this.apiService.inferenceV2(authToken, sources, instructions, messageId, memoryLength); return { inferenceId: response.data.inference_id, chunkIds: response.data.chunks.map(chunk => chunk.id), hasKnowledge: response.data.has_knowledge, isFaithful: response.data.is_faithful, answer: response.data.answer, }; }); } } //# sourceMappingURL=index.js.map