Skip to main content

Multi-provider AI utility with structured responses and streaming

Project description

abyss-ai-sdk (Python)

Multi-provider AI utility with structured responses and streaming. Supports Groq, OpenAI, and Anthropic with a unified API.

Install

pip install abyss-ai-sdk

Usage

create_client() - recommended

from abyss_ai_sdk import create_client, AskOptions
from pydantic import BaseModel

ai = create_client(provider="groq/openai/anthropic", api_key="your_api_key")

# Plain text
res = ai.ask(AskOptions(prompt="Say hello in one sentence."))
print(res.data)

# Structured
class Sentiment(BaseModel):
  sentiment: str
  confidence: float
  summary: str

res = ai.ask(AskOptions(
  prompt="Analyse: 'I love this product!'",
  schema=Sentiment,
))
print(res.data.sentiment)
print(res.data.confidence)

# Streaming
for chunk in ai.stream(AskOptions(prompt="Tell me a story.")):
  print(chunk, end="", flush=True)

Embeddings (OpenAI only)

from abyss_ai_sdk import create_client, EmbedOptions

ai = create_client(provider="openai", api_key="your_openai_key")

res = ai.embed(EmbedOptions(input=["cat", "dog"]))
print(len(res.embeddings[0]))  # 1536

One-off calls

from abyss_ai_sdk import ask, stream, AskOptions
from abyss_ai_sdk import AbyssConfig

config = AbyssConfig(provider="groq", api_key="your_groq_key")

res = ask(config, AskOptions(prompt="What is 2 + 2?"))
print(res.data)

Providers

Providers

Provider Default Model
groq llama-3.1-8b-instant
openai gpt-4o-mini
anthropic claude-sonnet-4-6

Override the model:

ai = create_client(provider="groq/openai/anthropic", api_key="api_key", model="model_of_your_choice")

API

create_client(provider, api_key, model=None)

Returns an AbyssClient with .ask(), .stream(), and .embed().

AskOptions

Field Type Description
prompt str The user message
system str | None System prompt
schema BaseModel | None Pydantic model for structured output
temperature float Default 0.7
max_tokens int Default 1024

EmbedOptions

Field Type Description
input str | list[str] Text to embed
model str | None Override default model

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

abyss_ai_sdk-0.2.3.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

abyss_ai_sdk-0.2.3-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file abyss_ai_sdk-0.2.3.tar.gz.

File metadata

  • Download URL: abyss_ai_sdk-0.2.3.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.14.6"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.5.7 9 Jun 2026","python":"3.14.6","system":{"name":"Windows","release":"11"}} HTTPX2/2.5.0

File hashes

Hashes for abyss_ai_sdk-0.2.3.tar.gz
Algorithm Hash digest
SHA256 2fe357b85ae04faa458d385415bdf19a41b5504c47cebb302fc44fd8a97dd4ba
MD5 3e67e266aec063f215fe66987140a084
BLAKE2b-256 25934db500034e531cee1efe0636b36f3d9a9452416da4fa0da9ed0152f7d1b0

See more details on using hashes here.

File details

Details for the file abyss_ai_sdk-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: abyss_ai_sdk-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.14.6"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.5.7 9 Jun 2026","python":"3.14.6","system":{"name":"Windows","release":"11"}} HTTPX2/2.5.0

File hashes

Hashes for abyss_ai_sdk-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f7656b392e003d5f3d593669e69591026e49729eb8b5b22fb544eea314551c77
MD5 e536373a56b56a0c24483837b15768b4
BLAKE2b-256 fb0ebb4cd107f641aa6796e2a59d7324cb10a3a67cd5cafd9f2d01e421d20663

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