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.0.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.0-py3-none-any.whl (56.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sefia-0.1.0.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.0.tar.gz
Algorithm Hash digest
SHA256 d25708bf5f2f7318ee151d8c591192a7c6f516c289d8da8ed8015ab9ac676c66
MD5 11489e4cd5f6100796b1ccd3d784f1ee
BLAKE2b-256 e64354e1270f2b51642a31903007f433a526387658adbd00b371000652b67ada

See more details on using hashes here.

Provenance

The following attestation bundles were made for sefia-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: sefia-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 253f9b2ca1d731ce4e0bf8a5c352b0cedefbaa6c3a60206bdce829bc56f18a40
MD5 03bb64f5a66bb77b30456b01f71be665
BLAKE2b-256 6592cc9127618914ab7aa1ea7da0b9e726da4f130c4a1b1558e8810ccbd1e1ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for sefia-0.1.0-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