genkitx-patientseek
Version:
A community plugin for Firebase Genkit to integrate DeepSeek medical models.
50 lines • 2.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PatientSeek = exports.PatientSeekChat = void 0;
exports.deepseekModel = deepseekModel;
const plugin_1 = require("genkit/plugin");
const openai_1 = require("openai");
const model_1 = require("genkit/model");
const runner_js_1 = require("./runner.js");
const models_js_1 = require("./models.js");
const models_js_2 = require("./models.js");
Object.defineProperty(exports, "PatientSeekChat", { enumerable: true, get: function () { return models_js_2.PatientSeekChat; } });
const PatientSeek = (options) => (0, plugin_1.genkitPlugin)("deepseek", async (ai) => {
const baseURL = options?.baseURL ||
process.env.PATIENT_SEEK_API_URL ||
"https://sjp8h5vzufpc6woi.us-east-1.aws.endpoints.huggingface.cloud/v1/";
const { apiKey } = options;
const client = new openai_1.OpenAI({ apiKey, baseURL });
for (const name of Object.keys(models_js_1.SUPPORTED_DEEPSEEK_MODELS)) {
deepseekModel(ai, name, client);
}
options.models?.forEach((model) => {
if (!model.name || !model.info) {
throw new Error(`Model ${model.name} is missing required fields`);
}
deepseekModel(ai, model.name, client, model.info, model.configSchema);
});
});
exports.PatientSeek = PatientSeek;
function deepseekModel(ai, name, client, modelInfo, modelConfig) {
const modelId = `deepseek/${name}`;
const model = models_js_1.SUPPORTED_DEEPSEEK_MODELS[name];
if (!model) {
models_js_1.SUPPORTED_DEEPSEEK_MODELS[name] = (0, model_1.modelRef)({
name: modelId,
info: modelInfo,
configSchema: modelConfig?.configSchema,
});
}
const modelInformation = modelInfo ? modelInfo : model.info;
const configSchema = modelConfig
? modelConfig.configSchema
: model.configSchema;
return ai.defineModel({
name: modelId,
...modelInformation,
configSchema,
}, (0, runner_js_1.gptRunner)(name, client));
}
exports.default = exports.PatientSeek;
//# sourceMappingURL=index.js.map