Skip to main content

Async client for the Embedding Service API. Canonical class: EmbeddingClient (JSON-RPC via mcp-proxy-adapter).

Project description

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, 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, then runs embed_file with format=json_array and staged transfer metadata. For Markdown sources (e.g. with YAML front matter), run prepare-embed-file-json first to emit a valid json_array file, then embed-file-json; add --show-progress to stream server WebSocket/status lines to stderr during the job wait (see CLI_README.md).

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 Zdanovskiyvasilyvz@gmail.com

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

embed_client-3.1.9.0.tar.gz (311.2 kB view details)

Uploaded Source

Built Distribution

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

embed_client-3.1.9.0-py3-none-any.whl (92.4 kB view details)

Uploaded Python 3

File details

Details for the file embed_client-3.1.9.0.tar.gz.

File metadata

  • Download URL: embed_client-3.1.9.0.tar.gz
  • Upload date:
  • Size: 311.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for embed_client-3.1.9.0.tar.gz
Algorithm Hash digest
SHA256 eb0b63156a5a6b54f95982fc039d1e55c5be174ade54eae5e1241b6702b468ae
MD5 5c81292afa25a3fd2e5a85cfd07a8895
BLAKE2b-256 c58597cf63c0512b73603654ebef3b6592e6bb7c03b0115969c6bfbd2871197f

See more details on using hashes here.

File details

Details for the file embed_client-3.1.9.0-py3-none-any.whl.

File metadata

  • Download URL: embed_client-3.1.9.0-py3-none-any.whl
  • Upload date:
  • Size: 92.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for embed_client-3.1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 516b10b91b0e6b2574baa0fdd974029d85bbeb808d71f92023b24dace079f64c
MD5 a0fc497050922fde15a5b44499b4f2bf
BLAKE2b-256 b1974ce6ecacfa163f3010b40838f5b9a60aee4f73f8f2dd5a6c92c3edf34f63

See more details on using hashes here.

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