UNPKG

genkitx-github

Version:

Firebase Genkit AI framework plugin for GitHub Models APIs.

99 lines 12.2 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.deepseekR1 = exports.jais30bChat = exports.microsoftMaiDsR1 = exports.microsoftPhi4MiniInstruct = exports.microsoftPhi4MultimodalInstruct = exports.microsoftPhi4 = exports.microsoftPhi35Vision128kInstruct = exports.microsoftPhi35MoE128kInstruct = exports.microsoftPhi35Mini128kInstruct = exports.microsoftPhi3Medium128kInstruct = exports.microsoftPhi3Medium4kInstruct = exports.microsoftPhi3Small128kInstruct = exports.microsoftPhi3Small8kInstruct = exports.microsoftPhi3Mini128kInstruct = exports.microsoftPhi3Mini4kInstruct = exports.ai21Jamba15Large = exports.ai21Jamba15Mini = exports.ministral3B = exports.mistralNemo = exports.mistralCodestral2501 = exports.mistralLarge2411 = exports.mistralLarge2407 = exports.mistralLarge = exports.mistralSmall = exports.cohereCommandRPlus082024 = exports.cohereCommandR082024 = exports.cohereCommandR = exports.cohereCommandRPlus = exports.cohereCommandA = exports.metaLlama4Maverick17bInstruct = exports.metaLlama4Scout17bInstruct = exports.metaLlama3370bInstruct = exports.metaLlama3290bVisionInstruct = exports.metaLlama3211bVisionInstruct = exports.metaLlama318bInstruct = exports.metaLlama3170bInstruct = exports.metaLlama31405bInstruct = exports.metaLlama38bInstruct = exports.metaLlama370bInstruct = exports.openAIO4Mini = exports.openAIO3 = exports.openAIO3Mini = exports.openAIO1 = exports.openAIO1Mini = exports.openAIO1Preview = exports.openAIGpt4oMini = exports.openAIGpt4o = exports.openAIGpt41Nano = exports.openAIGpt41Mini = exports.openAIGpt41 = void 0; exports.cohereEmbedv4 = exports.cohereEmbedv3Multilingual = exports.cohereEmbedv3English = exports.openAITextEmbedding3Large = exports.openAITextEmbedding3Small = void 0; exports.github = github; const plugin_1 = require("genkit/plugin"); const ai_inference_1 = __importDefault(require("@azure-rest/ai-inference")); const core_auth_1 = require("@azure/core-auth"); const github_llms_js_1 = require("./github_llms.js"); Object.defineProperty(exports, "openAIGpt41", { enumerable: true, get: function () { return github_llms_js_1.openAIGpt41; } }); Object.defineProperty(exports, "openAIGpt41Mini", { enumerable: true, get: function () { return github_llms_js_1.openAIGpt41Mini; } }); Object.defineProperty(exports, "openAIGpt41Nano", { enumerable: true, get: function () { return github_llms_js_1.openAIGpt41Nano; } }); Object.defineProperty(exports, "openAIGpt4o", { enumerable: true, get: function () { return github_llms_js_1.openAIGpt4o; } }); Object.defineProperty(exports, "openAIGpt4oMini", { enumerable: true, get: function () { return github_llms_js_1.openAIGpt4oMini; } }); Object.defineProperty(exports, "openAIO1Preview", { enumerable: true, get: function () { return github_llms_js_1.openAIO1Preview; } }); Object.defineProperty(exports, "openAIO1Mini", { enumerable: true, get: function () { return github_llms_js_1.openAIO1Mini; } }); Object.defineProperty(exports, "openAIO1", { enumerable: true, get: function () { return github_llms_js_1.openAIO1; } }); Object.defineProperty(exports, "openAIO3Mini", { enumerable: true, get: function () { return github_llms_js_1.openAIO3Mini; } }); Object.defineProperty(exports, "openAIO3", { enumerable: true, get: function () { return github_llms_js_1.openAIO3; } }); Object.defineProperty(exports, "openAIO4Mini", { enumerable: true, get: function () { return github_llms_js_1.openAIO4Mini; } }); Object.defineProperty(exports, "metaLlama370bInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama370bInstruct; } }); Object.defineProperty(exports, "metaLlama38bInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama38bInstruct; } }); Object.defineProperty(exports, "metaLlama31405bInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama31405bInstruct; } }); Object.defineProperty(exports, "metaLlama3170bInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama3170bInstruct; } }); Object.defineProperty(exports, "metaLlama318bInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama318bInstruct; } }); Object.defineProperty(exports, "metaLlama3211bVisionInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama3211bVisionInstruct; } }); Object.defineProperty(exports, "metaLlama3290bVisionInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama3290bVisionInstruct; } }); Object.defineProperty(exports, "metaLlama3370bInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama3370bInstruct; } }); Object.defineProperty(exports, "metaLlama4Scout17bInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama4Scout17bInstruct; } }); Object.defineProperty(exports, "metaLlama4Maverick17bInstruct", { enumerable: true, get: function () { return github_llms_js_1.metaLlama4Maverick17bInstruct; } }); Object.defineProperty(exports, "cohereCommandA", { enumerable: true, get: function () { return github_llms_js_1.cohereCommandA; } }); Object.defineProperty(exports, "cohereCommandR", { enumerable: true, get: function () { return github_llms_js_1.cohereCommandR; } }); Object.defineProperty(exports, "cohereCommandRPlus", { enumerable: true, get: function () { return github_llms_js_1.cohereCommandRPlus; } }); Object.defineProperty(exports, "cohereCommandR082024", { enumerable: true, get: function () { return github_llms_js_1.cohereCommandR082024; } }); Object.defineProperty(exports, "cohereCommandRPlus082024", { enumerable: true, get: function () { return github_llms_js_1.cohereCommandRPlus082024; } }); Object.defineProperty(exports, "mistralSmall", { enumerable: true, get: function () { return github_llms_js_1.mistralSmall; } }); Object.defineProperty(exports, "mistralLarge", { enumerable: true, get: function () { return github_llms_js_1.mistralLarge; } }); Object.defineProperty(exports, "mistralLarge2407", { enumerable: true, get: function () { return github_llms_js_1.mistralLarge2407; } }); Object.defineProperty(exports, "mistralLarge2411", { enumerable: true, get: function () { return github_llms_js_1.mistralLarge2411; } }); Object.defineProperty(exports, "mistralNemo", { enumerable: true, get: function () { return github_llms_js_1.mistralNemo; } }); Object.defineProperty(exports, "mistralCodestral2501", { enumerable: true, get: function () { return github_llms_js_1.mistralCodestral2501; } }); Object.defineProperty(exports, "ministral3B", { enumerable: true, get: function () { return github_llms_js_1.ministral3B; } }); Object.defineProperty(exports, "ai21Jamba15Mini", { enumerable: true, get: function () { return github_llms_js_1.ai21Jamba15Mini; } }); Object.defineProperty(exports, "ai21Jamba15Large", { enumerable: true, get: function () { return github_llms_js_1.ai21Jamba15Large; } }); Object.defineProperty(exports, "microsoftPhi3Mini4kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi3Mini4kInstruct; } }); Object.defineProperty(exports, "microsoftPhi3Mini128kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi3Mini128kInstruct; } }); Object.defineProperty(exports, "microsoftPhi3Small8kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi3Small8kInstruct; } }); Object.defineProperty(exports, "microsoftPhi3Small128kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi3Small128kInstruct; } }); Object.defineProperty(exports, "microsoftPhi3Medium4kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi3Medium4kInstruct; } }); Object.defineProperty(exports, "microsoftPhi3Medium128kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi3Medium128kInstruct; } }); Object.defineProperty(exports, "microsoftPhi35Mini128kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi35Mini128kInstruct; } }); Object.defineProperty(exports, "microsoftPhi35MoE128kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi35MoE128kInstruct; } }); Object.defineProperty(exports, "microsoftPhi35Vision128kInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi35Vision128kInstruct; } }); Object.defineProperty(exports, "microsoftPhi4", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi4; } }); Object.defineProperty(exports, "microsoftPhi4MultimodalInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi4MultimodalInstruct; } }); Object.defineProperty(exports, "microsoftPhi4MiniInstruct", { enumerable: true, get: function () { return github_llms_js_1.microsoftPhi4MiniInstruct; } }); Object.defineProperty(exports, "microsoftMaiDsR1", { enumerable: true, get: function () { return github_llms_js_1.microsoftMaiDsR1; } }); Object.defineProperty(exports, "jais30bChat", { enumerable: true, get: function () { return github_llms_js_1.jais30bChat; } }); Object.defineProperty(exports, "deepseekR1", { enumerable: true, get: function () { return github_llms_js_1.deepseekR1; } }); const github_embedders_js_1 = require("./github_embedders.js"); Object.defineProperty(exports, "cohereEmbedv3English", { enumerable: true, get: function () { return github_embedders_js_1.cohereEmbedv3English; } }); Object.defineProperty(exports, "cohereEmbedv3Multilingual", { enumerable: true, get: function () { return github_embedders_js_1.cohereEmbedv3Multilingual; } }); Object.defineProperty(exports, "cohereEmbedv4", { enumerable: true, get: function () { return github_embedders_js_1.cohereEmbedv4; } }); Object.defineProperty(exports, "openAITextEmbedding3Large", { enumerable: true, get: function () { return github_embedders_js_1.openAITextEmbedding3Large; } }); Object.defineProperty(exports, "openAITextEmbedding3Small", { enumerable: true, get: function () { return github_embedders_js_1.openAITextEmbedding3Small; } }); function github(options) { return (0, plugin_1.genkitPlugin)("github", (ai) => __awaiter(this, void 0, void 0, function* () { const token = (options === null || options === void 0 ? void 0 : options.githubToken) || process.env.GITHUB_TOKEN; let endpoint = (options === null || options === void 0 ? void 0 : options.endpoint) || process.env.GITHUB_ENDPOINT; const apiVersion = (options === null || options === void 0 ? void 0 : options.apiVersion) || "2024-12-01-preview"; if (!token) { throw new Error("Please pass in the TOKEN key or set the GITHUB_TOKEN environment variable"); } if (!endpoint) { endpoint = "https://models.inference.ai.azure.com"; } const client = (0, ai_inference_1.default)(endpoint, new core_auth_1.AzureKeyCredential(token), { apiVersion: apiVersion, }); Object.keys(github_llms_js_1.SUPPORTED_GITHUB_MODELS).forEach((name) => { (0, github_llms_js_1.githubModel)(name, client, ai); }); Object.keys(github_embedders_js_1.SUPPORTED_EMBEDDING_MODELS).forEach((name) => (0, github_embedders_js_1.githubEmbedder)(name, ai, options)); })); } exports.default = github; //# sourceMappingURL=index.js.map