UNPKG

@cognigy/rest-api-client

Version:

Cognigy REST-Client

189 lines 7.19 kB
/* Custom Modules */ import { createQuerySchema } from "../../helper/createQuerySchema"; import { entityMetaSchema } from "./IEntityMeta"; import { modeType, apiTypes, generativeAIUseCases } from "../generativeAI/IGenerativeAIModels"; import { generativeAIProviders } from "../generativeAI/IGenerativeAIModels"; export const anthropicMetaSchema = { title: "anthropicMetaSchema", type: "object", additionalProperties: false, properties: { customModel: { type: ["string", "null"] } } }; export const mistralMetaSchema = { title: "mistralMetaSchema", type: "object", additionalProperties: false, properties: { customModel: { type: ["string", "null"] } } }; export const awsBedrockMetaSchema = { title: "awsBedrockMetaSchema", type: "object", additionalProperties: false, properties: { customModel: { type: ["string", "null"] }, region: { type: "string", format: "resource-name" }, location: { type: ["string", "null"], enum: ["region", "geo", "global", null] }, geo: { type: ["string", "null"] } } }; export const alephAlphaMetaSchema = { title: "alephAlphaMetaSchema", type: "object", additionalProperties: false, properties: { customModel: { type: ["string", "null"] }, baseCustomUrl: { type: ["string", "null"] }, } }; export const openAIMetaSchema = { title: "openAIMetaSchema", type: "object", additionalProperties: false, properties: { customModel: { type: ["string", "null"] }, baseCustomUrl: { type: ["string", "null"] } } }; export const openAICompatibleMetaSchema = { title: "openAICompatibleMetaSchema", type: "object", additionalProperties: false, properties: { customModel: { type: "string" }, baseCustomUrl: { type: "string" }, customAuthHeader: { type: "string" }, embeddingVectorSize: { type: "number" }, } }; export const 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"] } } }; export const 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"] }, } }; export const googleGeminiMetaSchema = { title: "googleGeminiMetaSchema", type: "object", additionalProperties: false, properties: { location: { type: "string", format: "resource-name" }, customModel: { type: ["string", "null"] }, } }; export const googleGenAIMetaSchema = { title: "googleGenAIMetaSchema", type: "object", additionalProperties: false, properties: { location: { type: "string", format: "resource-name" }, customModel: { type: ["string", "null"] }, } }; export const 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" }, }, }, }, }, }, }; export const 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: [...modeType] }, apiType: { type: "string", enum: [...apiTypes] }, provider: { type: "string", enum: [...generativeAIProviders] }, connectionId: { type: "string", format: "uuid" }, isDefault: { type: "boolean" }, openAI: openAIMetaSchema, openAICompatible: openAICompatibleMetaSchema, azureOpenAI: azureOpenAIMetaSchema, googleVertexAI: googleVertexAIMetaSchema, googleGemini: googleGeminiMetaSchema, googleGenAI: googleGenAIMetaSchema, alephAlpha: alephAlphaMetaSchema, anthropic: anthropicMetaSchema, mistral: mistralMetaSchema, awsBedrock: awsBedrockMetaSchema, fallbacks: llmFallbackSchema, resourceLevel: { type: "string", enum: ["organisation", "project"] }, assignedToProjects: { type: "array", uniqueItems: true, items: { type: "string", format: "mongo-id" } } } }; export const largeLanguageModelSchema = { title: "largeLanguageModelSchema", type: "object", additionalProperties: false, properties: Object.assign(Object.assign(Object.assign({}, largeLanguageModelDataSchema.properties), entityMetaSchema.properties), { projectReference: { type: "string", format: "mongo-id" }, organisationReference: { type: "string", format: "mongo-id" }, referenceId: { type: "string", format: "uuid" }, configSetId: { type: "string" }, configSetSyncedAt: { type: "number" }, isInPlatformLlm: { type: "boolean" }, useCases: { type: "array", items: { type: "string", enum: generativeAIUseCases } }, isDisabled: { type: "boolean" }, displayName: { type: "string" } }) }; export const largeLanguageModelQuerySchema = createQuerySchema("largeLanguageModelQuerySchema", largeLanguageModelSchema); export 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); }; //# sourceMappingURL=ILargeLanguageModel.js.map