Skip to main content

Hexagonal core library for generic-ml-cache: domain, use cases, ports, and the default outbound adapters (SQLite repo, blob store, local clients, API). Stateless; inject the data source.

Project description

gmlcache

generic-ml-cache-core

The hexagonal engine behind gmlcache — embeddable and stateless

License: Apache 2.0 Status: Alpha

The reusable engine behind gmlcache: record a real ML client (or API) call once, replay it by its content key. It contains the domain model, the use cases, the port contracts, and the default outbound adapters (SQLite execution repository, filesystem blob store, the claude/codex/cursor client runner, the API client, metrics, clock, fingerprinting) — plus the build_use_cases composition factory.

Pure Python and stateless: it bakes in structure (table names, blob naming, schema) but no location — you inject the data source.

Part of a single-user, local tool — not a gateway. gmlcache records and replays across the subscriptions and APIs you already hold; it is not a multi-user router. See Positioning.

Install

pip install generic-ml-cache-core

Embed it

Hand the library a data source and it wires the engine for you:

from generic_ml_cache_core import build_use_cases
from generic_ml_cache_core.application.port.inbound.run_managed_local_execution_command import (
    RunManagedLocalExecutionCommand,
)

wired = build_use_cases(store_root="/path/you/choose")   # you provide the data source
command = RunManagedLocalExecutionCommand(
    client="claude", model="sonnet", effort="", context="", prompt="…",
)
execution = wired.run_managed.execute(command)           # records on a miss, replays on a hit

You reuse the shipped adapters by injecting a data source — you never reimplement them (the Spring Batch model: the framework ships the writers, you provide the connection). Need a different store? Construct the use cases yourself against the ports and pass your own adapter.

What's inside

  • Domain model — executions, polymorphic call identities, artifacts, usage.
  • Use cases — managed-local / passthrough / API runs, and probe (check).
  • Ports (application/port/...) — client runner, blob store, execution repository, metrics, clock, fingerprint, API client.
  • Default adapters (adapter/out/...) + the build_use_cases composition factory.
  • generic_ml_cache_core.testing.InMemoryExecutionRepository — an in-memory reference adapter to test your code against the ports.

Inbound drivers — gmlcache today, a daemon later — map their surface (a terminal, a REST API) onto these public APIs; the core itself has no UI and reads no config file.

Links

License

Apache-2.0 — see LICENSE and NOTICE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

generic_ml_cache_core-0.8.0.tar.gz (110.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

generic_ml_cache_core-0.8.0-py3-none-any.whl (126.7 kB view details)

Uploaded Python 3

File details

Details for the file generic_ml_cache_core-0.8.0.tar.gz.

File metadata

  • Download URL: generic_ml_cache_core-0.8.0.tar.gz
  • Upload date:
  • Size: 110.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for generic_ml_cache_core-0.8.0.tar.gz
Algorithm Hash digest
SHA256 b8861ca55dafd9222cc66cdcea940f3c611c9ae23df669c7f85031f77039c1a0
MD5 2f70b4f2c5613e161f3278f128d6d91b
BLAKE2b-256 92547320f85eb794a704372e9f1076d378067cf51b5450c0019f0841523d515d

See more details on using hashes here.

Provenance

The following attestation bundles were made for generic_ml_cache_core-0.8.0.tar.gz:

Publisher: release.yml on danielslobozian/generic-ml-cache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file generic_ml_cache_core-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for generic_ml_cache_core-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d33c04b9c6fef98ead00935eab6bfda1b31b1667aa5c7d62be7cb7a35fe6a51e
MD5 40bbaa5fb3da09f67c22bba81ceb59ff
BLAKE2b-256 4cadc3ce1c50c975959f710464c2cce6e73afd3b9dfaed1ffe51ce7a72a84f5d

See more details on using hashes here.

Provenance

The following attestation bundles were made for generic_ml_cache_core-0.8.0-py3-none-any.whl:

Publisher: release.yml on danielslobozian/generic-ml-cache

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page