Skip to main content

ABDUCTIO MVP core engine

Project description

abductio-core

Core engine for ABDUCTIO.

Install

From PyPI:

pip install abductio-core

Local path install (for use inside another codebase):

pip install /path/to/abductio-core

Editable install for local development:

pip install -e /path/to/abductio-core

If you host this repo, you can also install directly from VCS:

pip install git+ssh://<your-host>/<org>/abductio-core.git

Usage

from dataclasses import dataclass, field
from typing import Any, Dict, List

from abductio_core import RootSpec, SessionConfig, SessionRequest, run_session
from abductio_core.application.ports import RunSessionDeps
from abductio_core.domain.audit import AuditEvent


@dataclass
class MemAudit:
    events: List[AuditEvent] = field(default_factory=list)

    def append(self, event: AuditEvent) -> None:
        self.events.append(event)


@dataclass
class NoChildrenDecomposer:
    def decompose(self, target_id: str) -> Dict[str, Any]:
        if ":" in target_id:
            return {"ok": True, "type": "AND", "coupling": 0.80, "children": []}
        return {"ok": True, "feasibility_statement": f"{target_id} feasible"}


@dataclass
class SimpleEvaluator:
    def evaluate(self, node_key: str) -> Dict[str, Any]:
        return {"p": 0.8, "A": 1, "B": 1, "C": 1, "D": 1, "evidence_refs": "ref1"}


request = SessionRequest(
    claim="Example claim",
    roots=[RootSpec("H1", "Mechanism A", "x")],
    config=SessionConfig(tau=0.70, epsilon=0.05, gamma=0.20, alpha=0.40),
    credits=5,
    required_slots=[{"slot_key": "feasibility", "role": "NEC"}],
)

result = run_session(
    request,
    RunSessionDeps(
        evaluator=SimpleEvaluator(),
        decomposer=NoChildrenDecomposer(),
        audit_sink=MemAudit(),
    ),
)

print(result)

License

MIT. See LICENSE.

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

abductio_core-0.1.0.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

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

abductio_core-0.1.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file abductio_core-0.1.0.tar.gz.

File metadata

  • Download URL: abductio_core-0.1.0.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for abductio_core-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1676b94289f20368e9d426028593dee9a394ada354a3b3500a4efec42ab7327b
MD5 03c94e4ba02573a3b38557d6e4b86335
BLAKE2b-256 1e61c5072ec1aead522df5e652d585dd70dfff17ebba15e6d898f675d6ebd864

See more details on using hashes here.

File details

Details for the file abductio_core-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: abductio_core-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for abductio_core-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e15d426bde125d11bca71dfdf4463306a79d7d2cc6a871bbd63615ee13c24e5
MD5 7b66b47f01f01cc5caa8c2af9c76ea9c
BLAKE2b-256 615070f7ec8eb1871b6afbc2ee0ecf5b70f3f2a7651bd8e452744fd49107550c

See more details on using hashes here.

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