@n8n/n8n-nodes-langchain
Version:

31 lines (28 loc) • 1.57 kB
JavaScript
/**
* Simple Vector Store Node - Version 1.3 - Zod Schema
* Discriminator: mode=retrieve
*
* Use .parse() for strict validation or .safeParse() for error handling.
*
* Schema helpers (z, expressionSchema, etc.) are passed as parameters
* by the schema-validator, not imported from external files.
*
* @generated - CommonJS JavaScript for runtime loading
*/
module.exports = function getSchema({ parameters, z, expressionSchema, stringOrExpression, numberOrExpression, booleanOrExpression, resourceLocatorValueSchema, resourceMapperValueSchema, filterValueSchema, assignmentCollectionValueSchema, iDataObjectSchema, resolveSchema, embeddingInstanceSchema, rerankerInstanceSchema }) {
// Helper function for conditional subnode schema
function getSubnodesSchema() {
return z.object({
embedding: z.union([embeddingInstanceSchema, z.array(embeddingInstanceSchema)]),
reranker: resolveSchema({ parameters, schema: rerankerInstanceSchema, required: true, displayOptions: {"show":{"useReranker":[true]}}, defaults: {"useReranker":false} }),
}).strict();
}
return z.object({
parameters: z.object({
mode: z.literal('retrieve').default('retrieve'),
memoryKey: z.union([z.object({ __rl: z.literal(true), mode: z.union([z.literal('list'), z.literal('id')]), value: z.union([z.string(), z.number()]), cachedResultName: z.string().optional(), cachedResultUrl: z.string().optional() }), expressionSchema]).optional(),
useReranker: booleanOrExpression.optional(),
}).optional(),
subnodes: getSubnodesSchema(),
});
};