UNPKG

taskforce-aiagent

Version:

TaskForce is a modular, open-source, production-ready TypeScript agent framework for orchestrating AI agents, LLM-powered autonomous agents, task pipelines, dynamic toolchains, RAG workflows and memory/retrieval systems.

27 lines (26 loc) 1.04 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.HuggingFaceEmbeddingProvider = void 0; const axios_1 = __importDefault(require("axios")); class HuggingFaceEmbeddingProvider { constructor(apiUrl = "http://localhost:1234/v1/embeddings", model = "sentence-transformers/all-MiniLM-L12-v2") { this.apiUrl = apiUrl; this.model = model; } async getEmbedding(text) { const response = await axios_1.default.post(this.apiUrl, { model: this.model, input: text, }); if (!response.data || !response.data.data || !Array.isArray(response.data.data[0]?.embedding)) { throw new Error("Invalid embedding response from LM Studio"); } return response.data.data[0].embedding; } } exports.HuggingFaceEmbeddingProvider = HuggingFaceEmbeddingProvider;