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.0.tar.gz (15.8 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.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ai_bridge_kit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 78fbd5a59bdb89bc8a26f1c809e85ae66a6b0429c8b657fbc9f57bc9f5d031af
MD5 5bbebcb4f7865356e631af4069e777e7
BLAKE2b-256 d3fd79497abc7b86ba155d917bf01e9e5a272f78b660e758c53e6c5d3e8e221d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ai_bridge_kit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for ai_bridge_kit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c247d963630176e5e6d414f3e3c43d14390f40ec3fa08efbb1c7185f9d3b4bf7
MD5 6606d6f671cd1257243f83aa4ed44787
BLAKE2b-256 c049e196dbd52c92673cb03e0dade22f4d1ec76aa33a8c4b2503fa088dce640e

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