Skip to main content

embed-client

Python async client for the Embedding Service API. The canonical public client is EmbeddingClient, aligned with the migrated server-side contract (JSON-RPC via mcp-proxy-adapter).

from embed_client import EmbeddingClient

Installation

pip install embed-client

Editable development checkout:

git clone <repository-url>
cd embed-client
pip install -e .

Canonical real-server E2E (localhost:8001, mTLS)

The repository ships a runnable end-to-end tour of the public API against localhost:8001 with mTLS, using certificates under mtls_certificates/ (see mtls_certificates/README.md if present).

Artifact Path
Example script examples/canonical_mtls_localhost_8001.py
Live integration Set RUN_CANONICAL_MTLS_E2E=1 to perform real network calls (otherwise dry run / config check)
Optional embed_file Set CANONICAL_EMBED_FILE_SERVER_PATH to a server-visible file path to include embed_file in the tour
Tests tests/test_canonical_mtls_example.py
python examples/canonical_mtls_localhost_8001.py
RUN_CANONICAL_MTLS_E2E=1 python examples/canonical_mtls_localhost_8001.py

Minimal usage

import asyncio
from embed_client import EmbeddingClient

async def main() -> None:
    async with EmbeddingClient.from_base_url_port("http://localhost", 8001) as client:
        h = await client.health()
        print("health:", h)
        data = await client.embed(["hello"], error_policy="continue", wait=True)
        print("embed keys:", list(data.keys()) if isinstance(data, dict) else type(data))

if __name__ == "__main__":
    asyncio.run(main())

Public queue-oriented helpers include embed, wait_for_job, job_status, list_queued_commands, cmd, optional embed_file, plus introspection (list_commands, models, default_model, fetch_openapi_schema, http_get, timing_stats) and TLS helpers is_mtls_enabled, get_ssl_config. See embed_client/embedding_client.py for the full list.

embed_file vs local JSON without shared server disk: use embed_file with a server-visible input_file when the input already exists on the service host. For a json_array file that exists only on the client machine (no shared filesystem), use the CLI embed-file-json subcommand (or embed_file_from_local_json_file) so the client validates, uploads through the adapter, resolves storage_path via get_upload_session, then runs embed_file with that path and format=json_array. For Markdown sources (e.g. with YAML front matter), run prepare-embed-file-json first to emit a valid json_array (array of strings): the body is split only on blank lines (\n\n) into paragraph-sized strings, with per-paragraph UTF-8 size limits and no automatic oversize split — oversized paragraphs require editing the source or raising the byte cap; then embed-file-json. Add --show-progress to stream server WebSocket/status lines to stderr during the job wait (see CLI_README.md).

Vectorization backends (server 4.0.29+): embed and embed_file take backend="local"|"external" (omitted = the server's configured default; external is the macsc service). model_offload() moves the resident local model VRAM -> RAM (pinned against the GPU watcher) and model_load(model=None, device=None, wait=None) moves it back (wait=False returns at once while the load continues, wait=True blocks until it is in VRAM). A local request while the model is not in VRAM is refused at once with -32001 MODEL_LOADING (the load runs in the background; retry), a backend the server mode does not admit with -32002 BACKEND_MODE_MISMATCH, an external failure with -32003. Refusals of model_offload/model_load arrive as EmbedAPIError carrying the server error object. Every embed result carries backend; external results also carry usage.

Documentation

Security modes

The server supports multiple HTTP/HTTPS/mTLS and auth combinations. For deploy-time verification expectations, see the project deploy rule; for field-level mapping, see CONFIGURATION.md and docs/SERVER_MODES_AND_CLIENT.md.

Development and tests

Run the test suite with pytest; configuration lives in pyproject.toml ([tool.pytest.ini_options]). There is no pytest.ini at the repository root.

pytest -q

License

MIT License

Author

Vasiliy Zdanovskiy — vasilyvz@gmail.com

Metadata

Release files for embed-client 4.0.42

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

Source distribution (sdist)

Source distribution for embed-client 4.0.42
File Size Uploaded
embed_client-4.0.42.tar.gz 242.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for embed-client 4.0.42
File Interpreter ABI Platform
embed_client-4.0.42-py3-none-any.whl Python 3 none any Details

Total release size: 344.7 kB

Release files / embed_client-4.0.42.tar.gz

Download URL embed_client-4.0.42.tar.gz
Size 242.2 kB
Tags Source
SHA-256 checksum
How to use checksums
bc67b504a90c6d44de59df01c84a1dce0b9dc26d70eca239cd4785748a8b8adb
BLAKE2b-256 checksum
How to use checksums
10fa9e9b65f66cd0770d9b6efcae1be64c07b6fa201f06f192fc1415949430d2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / embed_client-4.0.42-py3-none-any.whl

Download URL embed_client-4.0.42-py3-none-any.whl
Size 102.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7b65d2e533cb0f4408403510995d052656f7723bde1dead36cdeb439f12766c8
BLAKE2b-256 checksum
How to use checksums
99384b61bb3d06ee92591e0cf8c31e7ce3d9014576b6c6c815ab40206829190a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release history Release notifications | RSS feed

4.0.44

2 release files

4.0.43

2 release files

This release

4.0.42 This release

2 release files

4.0.41

2 release files

4.0.40

2 release files

4.0.39

2 release files

4.0.38

2 release files

4.0.37

2 release files

4.0.36

2 release files

4.0.35

2 release files

4.0.34

2 release files

4.0.33

2 release files

4.0.32

2 release files

4.0.31

2 release files

4.0.30

2 release files

4.0.29

2 release files

4.0.28

2 release files

4.0.27

2 release files

4.0.26

2 release files

4.0.24

2 release files

4.0.23

2 release files

4.0.22

2 release files

4.0.20

2 release files

4.0.19

2 release files

4.0.18

2 release files

4.0.17

2 release files

4.0.16

2 release files

4.0.15

2 release files

4.0.1

2 release files

4.0.0

2 release files

1.0.0

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