biolmai.core package#
Subpackages#
Submodules#
biolmai.core.asynch module#
biolmai.core.auth module#
biolmai.core.const module#
biolmai.core.expression_evaluator module#
Template expression evaluation for protocol outputs.
This module provides safe evaluation of template expressions like ${{ field_name }} and ${{ score > 0.5 }} used in protocol output configurations.
- biolmai.core.expression_evaluator.evaluate_expression(expr: str, context: Dict[str, Any]) Any[source]#
Evaluate a template expression safely.
- Args:
expr: The expression to evaluate (without ${{ }} wrapper) context: Dictionary of variables available in the expression
- Returns:
The evaluated result
- Raises:
ValueError: If expression evaluation fails KeyError: If a required variable is missing from context
- biolmai.core.expression_evaluator.evaluate_template_value(value: Any, context: Dict[str, Any]) Any[source]#
Evaluate a value that may contain a template expression.
- Args:
value: Value that may be a template expression or literal context: Dictionary of variables available for evaluation
- Returns:
The evaluated value (or original value if not a template expression)
- biolmai.core.expression_evaluator.evaluate_where_clause(expr: str, row: Dict[str, Any]) bool[source]#
Evaluate a where clause expression row-by-row.
- Args:
expr: The filter expression (may include ${{ }} wrapper) row: The row data to evaluate against
- Returns:
True if row matches the filter, False otherwise
- Raises:
ValueError: If expression evaluation fails
- biolmai.core.expression_evaluator.extract_template_expr(value: Any) Tuple[bool, str][source]#
Extract template expression from a value if present.
- Args:
value: Value that may contain a template expression
- Returns:
Tuple of (is_template_expr, expression_string) - is_template_expr: True if value is a template expression - expression_string: The inner expression (without ${{ }} wrapper)
biolmai.core.http module#
biolmai.core.payloads module#
biolmai.core.seqflow_auth module#
MLflow RequestHeaderProvider that uses biolmai credentials for authentication.
This provider reads OAuth tokens from ~/.biolmai/credentials and adds them as Bearer tokens to MLflow requests.
- class biolmai.core.seqflow_auth.BiolmaiRequestHeaderProvider[source]#
Bases:
objectMLflow RequestHeaderProvider that uses biolmai credentials.
Reads OAuth tokens from ~/.biolmai/credentials (JSON format: {“access”: “…”, “refresh”: “…”}) and adds Authorization header with Bearer token to all MLflow requests.
biolmai.core.utils module#
Utility functions for BioLM SDK.
- biolmai.core.utils.prepare_items_for_api(items: Any | List[Any], type: str | None = None, check_n: int = 10) Tuple[List[dict] | List[List[dict]] | Any, bool][source]#
Normalize items for API calls. Supports list, tuple, single value, and iterables (e.g. generators). Returns (data, is_lol) where is_lol is True for list-of-lists; data is iterable of dicts or list of lists.
biolmai.core.validate module#
Module contents#
Core package for BioLM SDK.