Skip to main content

SynapseX Python SDK - Deploy and manage AI agents

Project description

SynapseX Python SDK

Python SDK for the SynapseX AI platform.

It provides LLMClient, an OpenAI-wire-compatible chat client that talks only to the public SynapseX edge (https://platform.synapsex.ai/api/v1) using a per-customer platform key (sk-synapsex-...).

Installation

pip install synapsex

Usage

from synapsex import LLMClient

# api_key falls back to the SYNAPSEX_API_KEY environment variable.
client = LLMClient(api_key="sk-synapsex-...")

resp = client.chat_completions(
    model="synapsex-nexus-v2",
    messages=[{"role": "user", "content": "Hello, world!"}],
)
print(resp["choices"][0]["message"]["content"])

Streaming:

stream = client.chat_completions(
    model="synapsex-nexus-v2",
    messages=[{"role": "user", "content": "Count from 1 to 5."}],
    stream=True,
)
for chunk in stream:
    for choice in chunk.get("choices", []):
        piece = choice.get("delta", {}).get("content")
        if piece:
            print(piece, end="", flush=True)

Because the wire format is OpenAI-compatible, you can equivalently point the stock openai SDK at the same base URL:

from openai import OpenAI

client = OpenAI(api_key="sk-synapsex-...", base_url="https://platform.synapsex.ai/api/v1")

Errors

Requests raise typed exceptions that subclass SynapseXError: AuthenticationError (401), InsufficientCreditsError (402), PermissionDeniedError (403), RateLimitError (429), and APIError for other non-2xx responses.

Documentation

See https://docs.synapsex.ai.

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

synapsex_platform-0.1.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

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

synapsex_platform-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file synapsex_platform-0.1.0.tar.gz.

File metadata

  • Download URL: synapsex_platform-0.1.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for synapsex_platform-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b639ea198dc0e2e20be4827342c1d89026f97e1e829796c9ac62980c0ad4017e
MD5 2059c794ff000b228fb0892cc6b529dd
BLAKE2b-256 c4865c1b364d06b9d46ac40f62571d1639e5a42f35a8f87baaab703365caabf9

See more details on using hashes here.

File details

Details for the file synapsex_platform-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for synapsex_platform-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 33ff5bc6f42344b1a2b036f1e40505bbf4720aa701485a3fd7dcc3788456c230
MD5 9e0c48ed5d2596534f180e3cb920a1ba
BLAKE2b-256 a29b0108f8e5316c9eb3b9eb49a23d7420940b808c1ad31f4a3bde734a52fe73

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