cell_annotator.BaseAnnotator#
- class cell_annotator.BaseAnnotator(species, tissue, stage='adult', cluster_key='leiden', model=None, max_completion_tokens=None, provider=None, api_key=None, _skip_validation=False)#
Shared base class for annotation-related functionality.
Provides a unified interface for querying different LLM providers to annotate cell types based on marker genes. Supports automatic provider detection from model names and handles API key management.
Attributes table#
Access to API key manager. |
Methods table#
|
Check API access and log warnings if needed. |
List available models for the current provider. |
|
|
Query the LLM with a given instruction. |
|
Test if the LLM setup is working correctly. |
Attributes#
- BaseAnnotator.api_keys#
Access to API key manager.
Methods#
- BaseAnnotator.check_api_access(provider=None, model=None)#
Check API access and log warnings if needed.
- BaseAnnotator.list_available_models()#
List available models for the current provider.
- BaseAnnotator.query_llm(instruction, response_format, other_messages=None)#
Query the LLM with a given instruction.
- BaseAnnotator.test_query(return_details=False)#
Test if the LLM setup is working correctly.
Performs a simple query to verify that the API key is valid and the model can be accessed successfully.
- Parameters:
return_details (
bool(default:False)) – If True, returns (success, message) tuple with detailed information. If False, returns only boolean success status.- Return type:
- Returns:
If return_details=False: True if the test query succeeds, False otherwise. If return_details=True: Tuple of (success, message) with detailed status.