Skip to main content

polyembed

Python SDK for the PolyEmbed embeddings API by a23one.

Install

pip install polyembed

Usage

from polyembed import PolyEmbed

client = PolyEmbed(api_key="pe_<team>_<key>")

# Single embedding
embedding = client.embed("hello world", input_type="document")
# [0.0229, 0.0319, ...]  (1024 floats)

# Limit tokens for faster responses (512–4096, capped by team's plan)
embedding = client.embed("short query", input_type="query", max_tokens=512)

# Batch (1-100 texts)
embeddings = client.embed_batch(
    ["text one", "text two"],
    input_type="document",
    max_tokens=1024,  # optional — cap tokens per text
)

# Shielded (encrypted, non-reversible)
embedding = client.embed(
    "classified report",
    input_type="document",
    shielded=True,
)

# Full response metadata
from polyembed import EmbedResponse

response = client.embed("hello", input_type="query", raw=True)
response.embedding   # list[float]
response.model       # "base"
response.shielded    # False
response.dimensions  # 1024
response.max_tokens  # 4096 (effective limit applied)

Configuration

client = PolyEmbed(
    api_key="pe_...",
    base_url="https://polyembed.com",  # default
    timeout=30,                         # seconds
    max_retries=3,                      # retries on 429/5xx
)

Error handling

from polyembed import AuthenticationError, ValidationError, RateLimitError, ServerError

try:
    embedding = client.embed("hello", input_type="document")
except AuthenticationError:
    # 401 — invalid or expired API key
except ValidationError:
    # 400 — invalid parameters
except RateLimitError:
    # 429 — rate limit exceeded (retried automatically)
except ServerError:
    # 500/502/503/504 — server error (retried automatically)

Context manager

with PolyEmbed(api_key="pe_...") as client:
    embedding = client.embed("hello", input_type="document")

Metadata

Release files for polyembed 0.0.2

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

Source distribution (sdist)

Source distribution for polyembed 0.0.2
File Size Uploaded
polyembed-0.0.2.tar.gz 13.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for polyembed 0.0.2
File Interpreter ABI Platform
polyembed-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 17.9 kB

Release files / polyembed-0.0.2.tar.gz

Download URL polyembed-0.0.2.tar.gz
Size 13.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7a560f661b6c81d50c6602193599ef23f0891a5e913eae989bdfb57ee43367bf
BLAKE2b-256 checksum
How to use checksums
fc5ebc88735e233ea2abf1c747e582d1ac80392b4b0c654d55fb1b4ade80cf99
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / polyembed-0.0.2-py3-none-any.whl

Download URL polyembed-0.0.2-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1aab7f12ada6fbbaeb6852749149c6b2420a80fb6c85902911a76f71ec057d09
BLAKE2b-256 checksum
How to use checksums
5c5465d2383ac792c382cedfe87f2cfd9045e06caa9502fecdb214a82bab24ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

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