MCPcopy Create free account
hub / github.com/Nardien/agent-distillation / evaluate_lambda

Function evaluate_lambda

src/smolagents/local_python_executor.py:442–463  ·  view source on GitHub ↗
(
    lambda_expression: ast.Lambda,
    state: Dict[str, Any],
    static_tools: Dict[str, Callable],
    custom_tools: Dict[str, Callable],
    authorized_imports: List[str],
)

Source from the content-addressed store, hash-verified

440
441
442def evaluate_lambda(
443 lambda_expression: ast.Lambda,
444 state: Dict[str, Any],
445 static_tools: Dict[str, Callable],
446 custom_tools: Dict[str, Callable],
447 authorized_imports: List[str],
448) -> Callable:
449 args = [arg.arg for arg in lambda_expression.args.args]
450
451 def lambda_func(*values: Any) -> Any:
452 new_state = state.copy()
453 for arg, value in zip(args, values):
454 new_state[arg] = value
455 return evaluate_ast(
456 lambda_expression.body,
457 new_state,
458 static_tools,
459 custom_tools,
460 authorized_imports,
461 )
462
463 return lambda_func
464
465
466def evaluate_while(

Callers 1

evaluate_astFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected