UNPKG

@nomyx/assistant

Version:

A powerful assistant library and cli for your AI projects. works with Vertex AI (Claude and Gemini)

11 lines 496 B
export function evaluateCondition(condition: string, context: Record<string, any>): boolean { try { // Use a simple evaluation technique for demonstration purposes // In a production environment, you'd want to use a more robust and secure evaluation method const result = new Function(...Object.keys(context), `return ${condition}`)(...Object.values(context)); return !!result; } catch (error) { console.error('Error evaluating condition:', error); return false; } }