@cognigy/rest-api-client
Version:
Cognigy REST-Client
162 lines • 5.89 kB
JavaScript
/* Custom Modules */
import { createQuerySchema } from "../../helper/createQuerySchema";
import { entityMetaSchema } from "./IEntityMeta";
import { modeType } 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" }
}
};
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" },
}
};
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 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] },
provider: { type: "string", enum: [...generativeAIProviders] },
connectionId: { type: "string", format: "uuid" },
isDefault: { type: "boolean" },
openAI: openAIMetaSchema,
openAICompatible: openAICompatibleMetaSchema,
azureOpenAI: azureOpenAIMetaSchema,
googleVertexAI: googleVertexAIMetaSchema,
googleGemini: googleGeminiMetaSchema,
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" } })
};
export const largeLanguageModelQuerySchema = createQuerySchema("largeLanguageModelQuerySchema", largeLanguageModelSchema);
//# sourceMappingURL=ILargeLanguageModel.js.map