Skip to main content

Unified Python bridge for integrating AI providers and custom AI functions.

Project description

ai-bridge-kit

ai-bridge-kit is a Python library to integrate AI providers through one clean API.

You can:

  • Switch providers without rewriting app logic.
  • Register your own local AI functions.
  • Use retries and timeouts consistently.
  • Keep your invention logic inside a reusable, package-ready SDK.

Install

pip install -e .

With OpenAI support:

pip install -e ".[openai]"

With Anthropic support:

pip install -e ".[anthropic]"

Install all provider extras:

pip install -e ".[all]"

For development:

pip install -e ".[dev,all]"

Quick Start

from ai_bridge_kit import AIClient

client = AIClient()

# Uses built-in local provider by default.
chat = client.chat("Explain AI integration in one line.")
print(chat.content)

emb = client.embed(["hello world"])
print(len(emb.vectors[0]))

Register your own AI functions

from ai_bridge_kit import AIClient
from ai_bridge_kit.providers import LocalFunctionProvider

provider = LocalFunctionProvider(name="my-ai")
provider.register("chat", lambda payload: "Custom answer")
provider.set_chat_function("chat")

client = AIClient()
client.register_provider(provider, set_default=True)

print(client.chat("hi").content)

OpenAI Provider (optional)

import os
from ai_bridge_kit import AIClient
from ai_bridge_kit.providers import OpenAIProvider

client = AIClient()
client.register_provider(
    OpenAIProvider(api_key=os.environ["OPENAI_API_KEY"]),
    set_default=True,
)

resp = client.chat("Give 3 startup names for an AI integration SDK.", model="gpt-4o-mini")
print(resp.content)

Additional Provider Adapters

Anthropic

import os
from ai_bridge_kit import AIClient
from ai_bridge_kit.providers import AnthropicProvider

client = AIClient()
client.register_provider(
    AnthropicProvider(api_key=os.environ["ANTHROPIC_API_KEY"]),
    set_default=True,
)
print(client.chat("Summarize agentic AI in one sentence.").content)

Ollama (local)

from ai_bridge_kit import AIClient
from ai_bridge_kit.providers import OllamaProvider

client = AIClient()
client.register_provider(
    OllamaProvider(base_url="http://localhost:11434", default_chat_model="llama3.2"),
    set_default=True,
)
print(client.chat("Explain RAG briefly.").content)

OpenAI-compatible APIs (OpenRouter/Groq/Together)

import os
from ai_bridge_kit import AIClient
from ai_bridge_kit.providers import OpenAICompatibleProvider

client = AIClient()
client.register_provider(
    OpenAICompatibleProvider.for_openrouter(api_key=os.environ["OPENROUTER_API_KEY"]),
    set_default=True,
)
print(client.chat("Give 3 names for an AI bridge SDK.").content)

CLI

ai-bridge providers
ai-bridge chat --message "What is retrieval augmented generation?"
ai-bridge embed --text "ai" --text "python"
ai-bridge call --function echo --arguments "{}"

Run tests

python -m pytest

Publish to PyPI

Use RELEASE.md for the full build + twine process.

Patent workflow support

Use PATENT_DISCLOSURE_TEMPLATE.md to document your technical novelty before filing.

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

ai_bridge_kit-0.1.2.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

ai_bridge_kit-0.1.2-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file ai_bridge_kit-0.1.2.tar.gz.

File metadata

  • Download URL: ai_bridge_kit-0.1.2.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_bridge_kit-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e22c5a22303df70ea7a04ccb0732061df3d3e1fc79b60cbcefb503987336f015
MD5 a45f63fec3cd142dc41a617a806ce24f
BLAKE2b-256 4ec7a9f88f621ce0a9fb124e00e5bd927825cb2b751c967522f05a407008000f

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_bridge_kit-0.1.2.tar.gz:

Publisher: publish.yml on sohammmmm10/python-library

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ai_bridge_kit-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: ai_bridge_kit-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ai_bridge_kit-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 30e37963a6eb65abe692c4613f433bd44e3c2e1d7930bbf1526765bc60626551
MD5 e05fa14f5fcfa49ed328158f0d715996
BLAKE2b-256 fe4a844944b3bd2fa8401fab8273b14d979eed63540d5500ac808190b31d0a52

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_bridge_kit-0.1.2-py3-none-any.whl:

Publisher: publish.yml on sohammmmm10/python-library

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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