@cognigy/rest-api-client
Version:
Cognigy REST-Client
180 lines • 7.13 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.isIGraphLargeLanguageModel = exports.largeLanguageModelQuerySchema = exports.largeLanguageModelSchema = exports.largeLanguageModelDataSchema = exports.llmFallbackSchema = exports.googleGeminiMetaSchema = exports.googleVertexAIMetaSchema = exports.azureOpenAIMetaSchema = exports.openAICompatibleMetaSchema = exports.openAIMetaSchema = exports.alephAlphaMetaSchema = exports.awsBedrockMetaSchema = exports.mistralMetaSchema = exports.anthropicMetaSchema = void 0;
/* Custom Modules */
const createQuerySchema_1 = require("../../helper/createQuerySchema");
const IEntityMeta_1 = require("./IEntityMeta");
const IGenerativeAIModels_1 = require("../generativeAI/IGenerativeAIModels");
const IGenerativeAIModels_2 = require("../generativeAI/IGenerativeAIModels");
exports.anthropicMetaSchema = {
title: "anthropicMetaSchema",
type: "object",
additionalProperties: false,
properties: {
customModel: { type: ["string", "null"] }
}
};
exports.mistralMetaSchema = {
title: "mistralMetaSchema",
type: "object",
additionalProperties: false,
properties: {
customModel: { type: ["string", "null"] }
}
};
exports.awsBedrockMetaSchema = {
title: "awsBedrockMetaSchema",
type: "object",
additionalProperties: false,
properties: {
customModel: { type: ["string", "null"] },
region: { type: "string", format: "resource-name" }
}
};
exports.alephAlphaMetaSchema = {
title: "alephAlphaMetaSchema",
type: "object",
additionalProperties: false,
properties: {
customModel: { type: ["string", "null"] },
baseCustomUrl: { type: ["string", "null"] },
}
};
exports.openAIMetaSchema = {
title: "openAIMetaSchema",
type: "object",
additionalProperties: false,
properties: {
customModel: { type: ["string", "null"] },
baseCustomUrl: { type: ["string", "null"] }
}
};
exports.openAICompatibleMetaSchema = {
title: "openAICompatibleMetaSchema",
type: "object",
additionalProperties: false,
properties: {
customModel: { type: "string" },
baseCustomUrl: { type: "string" },
customAuthHeader: { type: "string" },
embeddingVectorSize: { type: "number" },
}
};
exports.azureOpenAIMetaSchema = {
title: "azureOpenAIMetaSchema",
type: "object",
additionalProperties: false,
properties: {
resourceName: { type: ["string", "null"] },
deploymentName: { type: ["string", "null"] },
apiVersion: { type: ["string", "null"] },
baseCustomUrl: { type: ["string", "null"] },
customModel: { type: ["string", "null"] }
}
};
exports.googleVertexAIMetaSchema = {
title: "googleVertexAIMetaSchema",
type: "object",
additionalProperties: false,
properties: {
apiEndPoint: { type: "string", format: "resource-name" },
location: { type: "string", format: "resource-name" },
publisher: { type: ["string", "null"] },
customModel: { type: ["string", "null"] },
}
};
exports.googleGeminiMetaSchema = {
title: "googleGeminiMetaSchema",
type: "object",
additionalProperties: false,
properties: {
location: { type: "string", format: "resource-name" },
customModel: { type: ["string", "null"] },
}
};
exports.llmFallbackSchema = {
title: "TLLMFallbackArraySchema",
type: "array",
items: {
type: "object",
additionalProperties: false,
properties: {
order: { type: "integer" },
isFallbackEnabled: { type: "boolean" },
fallbackLLMReferenceId: { type: "string", format: "uuid" },
immediateFallBack: {
type: "object",
additionalProperties: false,
properties: {
failedRequests: { type: "number", format: "fallback-failed-requests" },
durationInMinutes: { type: "number", format: "fallback-duration" },
emailNotificationList: {
type: "array",
items: { type: "string", format: "email" },
},
},
},
},
},
};
exports.largeLanguageModelDataSchema = {
title: "largeLanguageModelDataSchema",
type: "object",
additionalProperties: false,
oneOf: [
{ required: ["name", "modelType",] },
{ required: ["name", "modelType", "modelGroup", "isCustomModel"] }
],
properties: {
name: { type: "string", format: "resource-name" },
description: { type: "string", format: "resource-description" },
modelType: { type: "string" } /* wildcard string for the Custom Models */,
isCustomModel: { type: "boolean" },
areFallbacksEnabled: { type: "boolean" },
modelGroup: { type: "string", enum: [...IGenerativeAIModels_1.modeType] },
provider: { type: "string", enum: [...IGenerativeAIModels_2.generativeAIProviders] },
connectionId: { type: "string", format: "uuid" },
isDefault: { type: "boolean" },
openAI: exports.openAIMetaSchema,
openAICompatible: exports.openAICompatibleMetaSchema,
azureOpenAI: exports.azureOpenAIMetaSchema,
googleVertexAI: exports.googleVertexAIMetaSchema,
googleGemini: exports.googleGeminiMetaSchema,
alephAlpha: exports.alephAlphaMetaSchema,
anthropic: exports.anthropicMetaSchema,
mistral: exports.mistralMetaSchema,
awsBedrock: exports.awsBedrockMetaSchema,
fallbacks: exports.llmFallbackSchema,
resourceLevel: { type: "string", enum: ["organisation", "project"] },
assignedToProjects: {
type: "array",
uniqueItems: true,
items: {
type: "string",
format: "mongo-id"
}
}
}
};
exports.largeLanguageModelSchema = {
title: "largeLanguageModelSchema",
type: "object",
additionalProperties: false,
properties: Object.assign(Object.assign(Object.assign({}, exports.largeLanguageModelDataSchema.properties), IEntityMeta_1.entityMetaSchema.properties), { projectReference: { type: "string", format: "mongo-id" }, organisationReference: { type: "string", format: "mongo-id" }, referenceId: { type: "string", format: "uuid" } })
};
exports.largeLanguageModelQuerySchema = (0, createQuerySchema_1.createQuerySchema)("largeLanguageModelQuerySchema", exports.largeLanguageModelSchema);
const isIGraphLargeLanguageModel = (resource) => {
return (resource &&
resource.type === "largeLanguageModel" &&
resource._id &&
resource.name &&
resource.referenceId &&
resource.properties &&
resource.properties.modelType &&
resource.properties.createdAt &&
resource.properties.createdBy &&
resource.properties.lastChanged &&
resource.properties.lastChangedBy);
};
exports.isIGraphLargeLanguageModel = isIGraphLargeLanguageModel;
//# sourceMappingURL=ILargeLanguageModel.js.map