File size: 1,639 Bytes
db32e07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""Spec-RAG: Cross-modal retrieval and generation utilities."""

from importlib import import_module

_EXPORTS = {
    "SMILESEmbedder": ("embeddings", "SMILESEmbedder"),
    "SpectrumEmbedder": ("embeddings", "SpectrumEmbedder"),
    "MolT5WithEmbeddings": ("molt5_with_embeddings", "MolT5WithEmbeddings"),
    "build_hnsw_index": ("faiss_index", "build_hnsw_index"),
    "save_index": ("faiss_index", "save_index"),
    "load_index": ("faiss_index", "load_index"),
    "search_index": ("retrieval", "search_index"),
    "format_molt5_prompt": ("prompt", "format_molt5_prompt"),
    "format_chat_example": ("prompt", "format_chat_example"),
    "SpecAgent": ("spec_agent", "SpecAgent"),
    "validate_smiles": ("agent_tools", "validate_smiles"),
    "calculate_mass_error": ("agent_tools", "calculate_mass_error"),
    "PerceiverResampler": ("perceiver_resampler", "PerceiverResampler"),
    "SpectraReasonEncoder": ("spectra_reason_encoder", "SpectraReasonEncoder"),
    "build_spectra_reason_encoder": ("spectra_reason_encoder", "build_spectra_reason_encoder"),
    "get_smiles_constraint": ("gcd_inference", "get_smiles_constraint"),
    "predict_smiles_from_spectrum": ("gcd_inference", "predict_smiles_from_spectrum"),
}

__all__ = list(_EXPORTS)


def __getattr__(name):
    if name not in _EXPORTS:
        raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
    module_name, attr_name = _EXPORTS[name]
    module = import_module(f".{module_name}", __name__)
    value = getattr(module, attr_name)
    globals()[name] = value
    return value


def __dir__():
    return sorted(list(globals().keys()) + __all__)