Skip to main content

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

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.2.0.tar.gz (74.4 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.2.0-py3-none-any.whl (57.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sefia-0.2.0.tar.gz
  • Upload date:
  • Size: 74.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sefia-0.2.0.tar.gz
Algorithm Hash digest
SHA256 67aa4e1bc42ac0d9e2d04f76e5081b8140b7a168ca6ef081b84d5d93e5f46cae
MD5 c9d982c12a6bc1157bee3df53bfb7d9e
BLAKE2b-256 7289f03795862f68f47d9b5bace8ad6b924d2ea02c8ceeb77e98669ce58fc11b

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: sefia-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 57.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for sefia-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e57cf045d679b631b46add3885edf1332d53e8c15511484fa4ecfe489b76a9b
MD5 7fa2e1b53eea7f3172cce5f635555b23
BLAKE2b-256 cd66e5f3456164b003257fb29be396b384f9909be219d2a7d85f2abfa7cb5a32

See more details on using hashes here.

Provenance

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