Skip to main content

Define LLM-powered steps as typed async Python functions.

Project description

sefia

Stateless Engraved Function Inference Abstraction

sefia turns typed Python functions into durable, replayable LLM-backed calls. An @infer function is an abstract method whose implementer is an LLM: the signature is the input contract, the return type is the validated output contract, the docstring is the instruction, and the body is ....

from pydantic import BaseModel
from sefia import infer


class Summary(BaseModel):
    key_points: list[str]
    uncertainty: str


@infer
async def summarize(article: str) -> Summary:
    """Summarize the article for a technical audience; note key uncertainty."""
    ...

Because model and tool steps replay on re-invocation, a call can pause, resume after a restart, and drive human-in-the-loop flows over ordinary request/response handlers — with no workflow engine or graph DSL.

Install

pip install sefia

sefia is the core framework: decorators, session, profiles, and the tool system. It is model-provider-agnostic; to talk to an actual LLM provider, add an adapter such as sefia-litellm, or install the batteries-included stack sefios.

Documentation

See the repository for the full README, tutorial, and architecture docs.

Status

Early development. APIs may change before v1.0.

License

MIT

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

sefia-0.1.1.tar.gz (72.5 kB view details)

Uploaded Source

Built Distribution

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

sefia-0.1.1-py3-none-any.whl (56.4 kB view details)

Uploaded Python 3

File details

Details for the file sefia-0.1.1.tar.gz.

File metadata

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

File hashes

Hashes for sefia-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a801f53e2686207f28131271a892533870088b9a3e700bf999d7166b94df0151
MD5 97b57d5127bf723f2cbacbb3722ef847
BLAKE2b-256 687c28101fb40d2498d82967f825253001b782f692b7bdeb30be242b9280c57b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sefia-0.1.1.tar.gz:

Publisher: publish-sefia.yml on nueruyu/sefia

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

File details

Details for the file sefia-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: sefia-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 56.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sefia-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf3728b299d0c236c9389bc20adc09452813949608c2cffaf7ed93c376fbd695
MD5 2a60a3e9c46beaa9d5e5cc1e6dec9650
BLAKE2b-256 5bd4295e64231bafc8876fb724ade4e7376832bb6cea30db04c44f3af0a31e20

See more details on using hashes here.

Provenance

The following attestation bundles were made for sefia-0.1.1-py3-none-any.whl:

Publisher: publish-sefia.yml on nueruyu/sefia

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