Skip to main content

SynaptExtraction IL v1 -- schema, validation, and finalization

Project description

synapt-extract

SynaptExtraction is the intermediate language (IL) for synapt's product stack. It is the universal exchange format between text extraction and intelligence operations.

Any text + Any LLM  ->  SynaptExtraction (IL)  ->  @synapt/memory (intelligence)

Install

pip install synapt-extract

Quick start

from synapt_extract import (
    build_extraction_prompt,
    finalize_extraction,
    FinalizeContext,
)

# 1. Build a prompt
prompt = build_extraction_prompt(text, profile="standard")

# 2. Send to any LLM, parse JSON response
llm_output = json.loads(llm.complete(prompt))

# 3. Finalize
result = finalize_extraction(llm_output, FinalizeContext(
    produced_by="openai://gpt-4o-mini",
    user_id=user_id,
    kind="conversa/prayer",
))

assert result.validation.valid

Prompt profiles

Profile Model class Capabilities
minimal 3B-7B local entities, entity_state, goals, themes, summary
standard GPT-4o-mini, Haiku + entity_context, goal_timing, facts, temporal_refs, sentiment, evidence_anchoring
full GPT-4o, Sonnet, Opus + entity_ids, goal_entity_refs, relations, relation_origin, assertion_signals, temporal_classes

Prompt and schema builder

Use the builder when the model API supports structured output. It resolves capabilities once, then builds the matching prompt, Stage 1 JSON schema, OpenAI response format, finalized packet schema, and optional finalization context.

from synapt_extract import create_extraction_builder

builder = (
    create_extraction_builder(text, profile="standard")
    .add_capabilities(["entity_ids", "goal_entity_refs"])
    .with_extracted_at("2026-05-11T18:00:00Z")
    .with_produced_by({
        "model": "openai://gpt-5.5",
        "model_version": "gpt-5.5-2026-04-23",
        "configuration": {"reasoning_effort": "medium"},
        "operator": "synapt-dev",
    })
    .with_source(source_id="note-1", source_type="note")
)

built = builder.build(name="synapt_extract_stage1")

# Send built["prompt"] and built["response_format"] to the model.
# Then call builder.finalize(stage1_json) or finalize_extraction(stage1_json, builder.finalize_context()).

build_extraction_schema() returns the semantic Stage 1 schema. build_extraction_response_format() returns an OpenAI-compatible json_schema response format; strict mode requires every object property as OpenAI expects and represents semantic optional fields as nullable. build_finalized_extraction_schema() returns the finalized packet shape, including produced_by, source context, capabilities, embeddings, and extensions.

Links

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

synapt_extract-0.3.2.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

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

synapt_extract-0.3.2-py3-none-any.whl (39.3 kB view details)

Uploaded Python 3

File details

Details for the file synapt_extract-0.3.2.tar.gz.

File metadata

  • Download URL: synapt_extract-0.3.2.tar.gz
  • Upload date:
  • Size: 26.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for synapt_extract-0.3.2.tar.gz
Algorithm Hash digest
SHA256 d105ebaa822a5801dcd310528bf9c9bb6c8b8150f7c775872f05306cac4eb2b1
MD5 226d5a4db86b8b0f4fed121bfeadc862
BLAKE2b-256 f7ec22f986e67ee30fe2f35d05cde570f3c91f981a2426f414caff4879482d5c

See more details on using hashes here.

Provenance

The following attestation bundles were made for synapt_extract-0.3.2.tar.gz:

Publisher: publish-pypi.yml on synapt-dev/extract

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

File details

Details for the file synapt_extract-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: synapt_extract-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 39.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for synapt_extract-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a6cfbc34b25e8a62b6d72f02f9f53ae149636b358d9d6d05174747108ba4c1ee
MD5 d3961ab5c8286be3cc4f4e63905b51c8
BLAKE2b-256 316dd2f99fcfa7bf1f1e56dc12089c769f4269d43940b7229df97856dc401958

See more details on using hashes here.

Provenance

The following attestation bundles were made for synapt_extract-0.3.2-py3-none-any.whl:

Publisher: publish-pypi.yml on synapt-dev/extract

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