Code Catalog

Welcome to the Code Catalog section of the memories-dev documentation. This comprehensive catalog provides an organized view of the codebase, allowing developers to navigate the framework’s components with ease.

Note

The Code Catalog is designed to help developers understand the structure and organization of the memories-dev codebase. It is particularly useful for those looking to extend or modify the framework.

Package Structure

The memories-dev framework is organized into several key packages and modules:

memories/
β”œβ”€β”€ __init__.py                  # Package initialization and version info
β”œβ”€β”€ config.py                    # Global configuration
β”œβ”€β”€ cli.py                       # Command-line interface
β”œβ”€β”€ agents/                      # AI agents for domain-specific tasks
β”œβ”€β”€ core/                        # Core functionality and base classes
β”œβ”€β”€ data/                        # Data storage and management
β”œβ”€β”€ data_acquisition/            # APIs and tools for acquiring Earth data
β”œβ”€β”€ deployments/                 # Deployment configurations and utilities
β”œβ”€β”€ models/                      # AI model integrations and abstractions
β”œβ”€β”€ scripts/                     # Utility scripts
β”œβ”€β”€ synthetic/                   # Synthetic data generation
└── utils/                       # Utility functions and helpers

Core Components

Component

Description

Memory Store

Central storage system implementing the tiered memory architecture

Earth Analyzers

Specialized modules for analyzing Earth observation data

Model Integrations

Connectors for various AI models and providers

Data Acquisition

Tools for acquiring and processing Earth observation data

Memory Manager

Manages the memory system, including tiering and retrieval

Core Modules

memory_store

from memories import MemoryStore, Config

# Configure the memory store
config = Config(
    storage_path="./earth_memory",
    hot_memory_size=50,  # GB
    warm_memory_size=200,  # GB
    cold_memory_size=1000,  # GB
)

# Initialize the memory store
memory_store = MemoryStore(config)

# Store data in memory
memory_store.store(
    key="location_123",
    data={
        "satellite_imagery": imagery_data,
        "environmental_metrics": metrics_data,
        "temporal_series": time_series_data
    },
    metadata={
        "location": {"lat": 37.7749, "lon": -122.4194},
        "timestamp": "2023-06-15T14:30:00Z",
        "source": "sentinel-2"
    }
)

earth_analyzers

from memories.core.analyzers import TerrainAnalyzer, ClimateAnalyzer, WaterResourceAnalyzer

# Initialize analyzers
terrain = TerrainAnalyzer()
climate = ClimateAnalyzer()
water = WaterResourceAnalyzer()

# Analyze location
terrain_analysis = await terrain.analyze(
    location={"lat": 37.7749, "lon": -122.4194},
    resolution="high"
)

climate_analysis = await climate.analyze(
    location={"lat": 37.7749, "lon": -122.4194},
    time_range={"start": "2020-01-01", "end": "2023-01-01"}
)

water_analysis = await water.analyze(
    location={"lat": 37.7749, "lon": -122.4194},
    include_forecast=True
)

model_integration

from memories.models.load_model import LoadModel
from memories.models.multi_model import MultiModelInference

# Initialize multiple models
models = {
    "openai": LoadModel(model_provider="openai", model_name="gpt-4"),
    "anthropic": LoadModel(model_provider="anthropic", model_name="claude-3-opus"),
    "local": LoadModel(model_provider="local", model_name="llama-3-8b")
}

# Create multi-model inference engine
multi_model = MultiModelInference(models=models)

# Get responses with Earth memory integration
responses = await multi_model.get_responses_with_earth_memory(
    query="Analyze this location for climate resilience",
    location={"lat": 37.7749, "lon": -122.4194},
    earth_memory_analyzers=["terrain", "climate", "water"]
)

Directory Catalog

Module Index

This section provides direct links to the API documentation for key modules:

  • memories.core.memory_store

  • memories.core.analyzers

  • memories.data_acquisition.satellite

  • memories.models.load_model

  • memories.models.multi_model

  • memories.utils.geo_utils

For a complete list of all modules, see the β€˜modindex’.

File Types

The memories-dev codebase consists of various file types:

Extension

Description

.py

Python source code files

.pyx

Cython source files for performance-critical components

.json

Configuration files and data schemas

.md

Markdown documentation files

.rst

reStructuredText documentation files

.yaml/.yml

YAML configuration files

.sh

Shell scripts for various utilities

.ipynb

Jupyter notebook examples and tutorials

Development Tools

The memories-dev project uses several development tools:

  • Black: Code formatting

  • isort: Import sorting

  • mypy: Static type checking

  • pytest: Testing framework

  • sphinx: Documentation generation

  • pre-commit: Pre-commit hooks for code quality

Code Statistics

Metric

Value

Total Python Files

200+

Lines of Code

50,000+

Test Coverage

85%+

Documentation Coverage

90%+