Function Catalog

Welcome to the Function Catalog section of the memories-dev documentation. This comprehensive catalog provides a detailed index of all functions available in the framework, organized by module and purpose.

Note

The Function Catalog is an essential reference for developers working with the memories-dev API. It provides detailed information about each function, including parameters, return values, and usage examples.

How to Use This Catalog

Functions in this catalog are organized by module and purpose. You can:

  1. Navigate through the module structure to find functions by location

  2. Use the search functionality to find specific functions by name

  3. Browse the categorized function listings to discover capabilities

Each function entry includes:

  • Full function signature with type annotations

  • Detailed description of the function’s purpose

  • Parameter descriptions with types and default values

  • Return value description with type information

  • Usage examples

  • Links to related functions and classes

Core Functions

Memory Management

memories.MemoryStore.store(key, data, metadata=None, tier=None)

Store data in the memory system with associated metadata.

Parameters:
  • key (str) – The unique identifier for the data

  • data (dict) – The data to store

  • metadata (dict) – Optional metadata associated with the data

  • tier (str) – Optional memory tier to store in (hot, warm, cold, glacier)

Returns:

Boolean indicating success

Return type:

bool

Example:

from memories import MemoryStore, Config

memory_store = MemoryStore(Config())
memory_store.store(
    key="location_123",
    data={"satellite_image": image_data},
    metadata={"location": {"lat": 37.7749, "lon": -122.4194}}
)
memories.MemoryStore.retrieve(key, include_metadata=False)

Retrieve data from the memory system.

Parameters:
  • key (str) – The unique identifier for the data

  • include_metadata (bool) – Whether to include metadata in the result

Returns:

The retrieved data or (data, metadata) if include_metadata is True

Return type:

dict or tuple

Example:

from memories import MemoryStore, Config

memory_store = MemoryStore(Config())
data, metadata = memory_store.retrieve(
    key="location_123",
    include_metadata=True
)
memories.MemoryStore.query(query, limit=10, include_metadata=False)

Query the memory system for data matching the query.

Parameters:
  • query (dict) – The query to match against the data

  • limit (int) – Maximum number of results to return

  • include_metadata (bool) – Whether to include metadata in the results

Returns:

List of matching data items or (data, metadata) pairs

Return type:

list

Example:

from memories import MemoryStore, Config

memory_store = MemoryStore(Config())
results = memory_store.query(
    query={
        "location": {
            "lat": {"$gte": 37.7, "$lte": 37.8},
            "lon": {"$gte": - 122.5, "$lte": -122.4}
        }
    },
    limit=5,
    include_metadata=True
)

Earth Analyzers

memories.core.analyzers.TerrainAnalyzer.analyze(location, resolution='medium')

Analyze the terrain features of a location.

Parameters:
  • location (dict) – Location coordinates with lat/lon

  • resolution (str) – Resolution of analysis (β€˜low’, β€˜medium’, β€˜high’)

Returns:

Terrain analysis results

Return type:

dict

Example:

from memories.core.analyzers import TerrainAnalyzer

analyzer = TerrainAnalyzer()
results = await analyzer.analyze(
    location={"lat": 37.7749, "lon": -122.4194},
    resolution="high"
)
memories.core.analyzers.ClimateAnalyzer.analyze(location, time_range=None)

Analyze climate data for a location over a time range.

Parameters:
  • location (dict) – Location coordinates with lat/lon

  • time_range (dict) – Time range to analyze with start and end dates

Returns:

Climate analysis results

Return type:

dict

Example:

from memories.core.analyzers import ClimateAnalyzer

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

Model Integration

memories.models.load_model.LoadModel.__init__(model_provider, model_name, **kwargs)

Initialize a model with the specified provider and name.

Parameters:
  • model_provider (str) – Model provider name

  • model_name (str) – Model name

  • kwargs – Additional provider-specific parameters

Returns:

Model instance

Return type:

LoadModel

Example:

from memories.models.load_model import LoadModel

model = LoadModel(
    model_provider="openai",
    model_name="gpt-4",
    api_key=os.environ.get("OPENAI_API_KEY")
)
memories.models.load_model.LoadModel.generate(prompt, **kwargs)

Generate a response using the model.

Parameters:
  • prompt (str) – The prompt to send to the model

  • kwargs – Additional generation parameters

Returns:

Generated response

Return type:

str

Example:

from memories.models.load_model import LoadModel

model = LoadModel(
    model_provider="anthropic",
    model_name="claude-3-opus"
)

response = await model.generate(
    prompt="Analyze the climate risks for San Francisco",
    max_tokens=1000,
    temperature=0.7
)

Data Acquisition

memories.data_acquisition.SatelliteClient.get_imagery(location, date, resolution='medium')

Retrieve satellite imagery for a location and date.

Parameters:
  • location (dict) – Location coordinates with lat/lon

  • date (str) – Date to retrieve imagery for (YYYY-MM-DD)

  • resolution (str) – Image resolution (β€˜low’, β€˜medium’, β€˜high’)

Returns:

Satellite imagery data

Return type:

dict

Example:

from memories.data_acquisition import SatelliteClient

client = SatelliteClient()
imagery = await client.get_imagery(
    location={"lat": 37.7749, "lon": -122.4194},
    date="2023-06-15",
    resolution="high"
)

Utility Functions

memories.utils.geo_utils.calculate_distance(point1, point2)

Calculate the distance between two geographic points.

Parameters:
  • point1 (dict) – First point with lat/lon coordinates

  • point2 (dict) – Second point with lat/lon coordinates

Returns:

Distance in meters

Return type:

float

Example:

from memories.utils.geo_utils import calculate_distance

distance = calculate_distance(
    point1={"lat": 37.7749, "lon": -122.4194},
    point2={"lat": 37.3382, "lon": -121.8863}
)
print(f"Distance: {distance} meters")
memories.utils.geo_utils.is_point_in_polygon(point, polygon)

Check if a point is within a polygon.

Parameters:
  • point (dict) – Point with lat/lon coordinates

  • polygon (list) – List of polygon vertices with lat/lon coordinates

Returns:

True if point is in polygon, False otherwise

Return type:

bool

Example:

from memories.utils.geo_utils import is_point_in_polygon

is_inside = is_point_in_polygon(
    point={"lat": 37.7749, "lon": -122.4194},
    polygon=[
        {"lat": 37.7, "lon": -122.5},
        {"lat": 37.8, "lon": -122.5},
        {"lat": 37.8, "lon": -122.4},
        {"lat": 37.7, "lon": -122.4}
    ]
)
print(f"Point is inside polygon: {is_inside}")

Function Categories

Alphabetical Index

This section provides an alphabetical listing of all functions in the framework:

Function Name

Module

calculate_distance

memories.utils.geo_utils

ClimateAnalyzer.analyze

memories.core.analyzers

generate

memories.models.load_model

get_imagery

memories.data_acquisition

is_point_in_polygon

memories.utils.geo_utils

LoadModel.__init__

memories.models.load_model

MemoryStore.query

memories

MemoryStore.retrieve

memories

MemoryStore.store

memories

TerrainAnalyzer.analyze

memories.core.analyzers