UNPKG

@n8n/n8n-nodes-langchain

Version:
36 lines (33 loc) 2.43 kB
/** * OpenAI Node - Version 1 - Zod Schema * Discriminator: resource=assistant, operation=create * * 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, resolveOneOfSchemas, toolInstanceSchema, memoryInstanceSchema }) { // Static subnode schema const subnodesSchema = z.object({ tools: z.array(toolInstanceSchema).optional(), memory: memoryInstanceSchema.optional(), }).strict(); return z.object({ parameters: z.object({ resource: z.literal('assistant'), operation: z.literal('create'), modelId: 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(), name: stringOrExpression, description: stringOrExpression.optional(), instructions: stringOrExpression.optional(), codeInterpreter: booleanOrExpression.optional(), knowledgeRetrieval: booleanOrExpression.optional(), file_ids: resolveOneOfSchemas({ parameters, variants: [{ schema: z.array(z.string()), required: false, displayOptions: {"show":{"codeInterpreter":[true]},"hide":{"knowledgeRetrieval":[true]}}, defaults: {"codeInterpreter":false,"knowledgeRetrieval":false} }, { schema: z.array(z.string()), required: false, displayOptions: {"show":{"knowledgeRetrieval":[true]},"hide":{"codeInterpreter":[true]}}, defaults: {"knowledgeRetrieval":false,"codeInterpreter":false} }, { schema: z.array(z.string()), required: false, displayOptions: {"show":{"knowledgeRetrieval":[true],"codeInterpreter":[true]}}, defaults: {"knowledgeRetrieval":false,"codeInterpreter":false} }] }), options: z.object({ temperature: numberOrExpression.optional(), topP: numberOrExpression.optional(), failIfExists: booleanOrExpression.optional() }).optional(), }).optional(), subnodes: subnodesSchema.optional(), }); };