Skip to main content

asymmetric-py

Read the docs at https://asymmetric.sh/docs

Install

pip install asymmetric-py

Usage

from asymmetric import Asymmetric, GuardrailViolation

client = Asymmetric(api_key="sk_live_...")

Guardrails

Basic completion

try:
    response = client.chat.completions.create(
        model="openai/gpt-4o-mini",
        messages=[{"role": "user", "content": "Tell me about Caltech"}],
        guardrail_policy="Flag any content mentioning Caltech",
    )
    print(response.choices[0].message.content)
except GuardrailViolation as e:
    print(e.policy)

Streaming

try:
    for chunk in client.chat.completions.create(
        model="openai/gpt-4o-mini",
        messages=[{"role": "user", "content": "Tell me about Caltech"}],
        guardrail_policy="Flag any content mentioning Caltech",
        stream=True,
    ):
        if chunk.choices[0].delta.content:
            print(chunk.choices[0].delta.content, end="")
except GuardrailViolation as e:
    print(f"\nViolation: {e.policy}")

Multiple policies

response = client.chat.completions.create(
    model="openai/gpt-4o-mini",
    messages=[{"role": "user", "content": "Hello"}],
    guardrail_policy=[
        "Flag any content promoting violence",
        "Flag any content containing profanity",
    ],
)

Violation history

violations = client.guardrails.list_violations()
for v in violations:
    print(v.timestamp, v.guardrail_policy)

Memories

Log and use memories in a request

response = client.chat.completions.create(
    model="openai/gpt-4o-mini",
    messages=[{"role": "user", "content": "What did Darwin discover?"}],
    memory=[
        {"group": "darwin_agent", "goal": "Historical records about Darwin"}
    ],
)
print(response.choices[0].message.content)

Finetuning

Trigger training and inspect status

job = client.finetuning.train(
    memory_group="darwin_agent",
    lora_name="darwin_adapter",
)
print(job.status, job.message)

status = client.finetuning.status(
    memory_group="darwin_agent",
    lora_name="darwin_adapter",
)
print(f"Ready: {status.lora_ready}")

# List all adapters
adapters = client.finetuning.list()
for a in adapters:
    print(f"{a.lora_name}: {a.status}")

LoRA inference

response = client.chat.completions.create(
    model="asymmetric/Qwen3-8B",
    messages=[{"role": "user", "content": "Tell me about Darwin's voyages"}],
    finetuning={"lora_name": "darwin_adapter"},
)
print(response.choices[0].message.content)

Auto-training with memory

response = client.chat.completions.create(
    model="openai/gpt-4o-mini",
    messages=[{"role": "user", "content": "What did Darwin discover?"}],
    memory=[{"group": "darwin_agent", "goal": "Historical records about Darwin"}],
    finetuning={
        "lora_name": "darwin_adapter",
        "finetune_thresh": 3,
        "min_finetune_group": 5,
    },
)

Metadata

Release files for asymmetric-py 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for asymmetric-py 0.2.0
File Size Uploaded Provenance
asymmetric_py-0.2.0.tar.gz 8.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for asymmetric-py 0.2.0
File Interpreter ABI Platform
asymmetric_py-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / asymmetric_py-0.2.0.tar.gz

Download URL asymmetric_py-0.2.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
cae326be7621e91bd8ef45becb4366edcd71dbc72ba43c6f172282feb5aeafe5
BLAKE2b-256 checksum
How to use checksums
38ac93cdc09704e67eebeaa0cfcb7f918f2aff7475b024f0c4f032eb0791a8d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / asymmetric_py-0.2.0-py3-none-any.whl

Download URL asymmetric_py-0.2.0-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
011ee6acf379e15c20961645ce9efc2bcf0bf14957dc34a6de5b3858b8e35d4d
BLAKE2b-256 checksum
How to use checksums
72201781aa5c74be135fce9235a4074408084dc1e17dca10d20e10ac159a23ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Security for asymmetric-py 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page