Skip to main content

Simplified AI API wrapper for ChatGPT and Google Gemini, enabling easy integration of language models with configurable parameters

Project description

sbai (Simple Broader AI)

A Python package to simplify interactions with OpenAI and Google Gemini APIs.

Installation

pip install sbai

Features

  • Easy-to-use interfaces for ChatGPT and Gemini
  • Configurable model parameters
  • Optional conversation memory
  • Support for system instructions

Usage

ChatGPT Integration

from sbai import ChatGPT

# Initialize with OpenAI API key
client = ChatGPT(
    api_key="your_openai_api_key", 
    model="gpt-4o-mini", 
    memory=True
)

# Send a prompt
response = client.prompt("Write a haiku about AI")
print(response)

# Clear conversation history
client.clear_history()

Gemini Integration

from sbai import Gemini

# Initialize with Google API key
client = Gemini(
    api_key="your_google_api_key", 
    model="gemini-2.0-flash-exp", 
    instructions="Be concise and helpful"
)

# Send a prompt
response = client.prompt("Explain quantum computing")
print(response)

# Clear conversation history
client.clear_history()

Configuration Options

ChatGPT

  • api_key: Your OpenAI API key (required)
  • model: OpenAI model to use (default: "gpt-4o-mini")
  • temperature: Sampling temperature (0-1, default: 0)
  • top_p: Nucleus sampling parameter (0-1, default: 0)
  • instructions: System-level instructions
  • max_token: Maximum tokens in response (default: 200)
  • memory: Enable conversation memory (default: False)
  • memory_limit: Maximum messages in memory (default: 5)

Gemini

  • api_key: Your Google API key (required)
  • model: Gemini model to use (default: "gemini-2.0-flash-exp")
  • temperature: Sampling temperature (0-1, default: 0)
  • top_p: Nucleus sampling parameter (0-1, default: 0)
  • max_token: Maximum tokens in response (default: 200)
  • memory: Enable conversation memory (default: False)
  • instructions: System-level instructions

Requirements

  • Python 3.8+
  • openai library
  • google-generativeai library

License

MIT License

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

sbai-0.1.2.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

sbai-0.1.2-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sbai-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for sbai-0.1.2.tar.gz
Algorithm Hash digest
SHA256 822d56b0e077de77bae0d15bbac22db081dc249dceee73ec8a654d2567a75ec1
MD5 d83cec1267ca1925cc76e13bd9ecabe0
BLAKE2b-256 8ac92eecea8842d16e4930e47d8d207edfda53f027c532b6cd40c642b1fc140e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: sbai-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for sbai-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f4c311765035be575fa7b6ab0793e73c9787a77d860ee6af57153c3dc5d40cee
MD5 14d39df7e112da941f3b8a9341c762a3
BLAKE2b-256 077dce5d6f12cdc718ffabb11423962249d4b918daf400c6ff3adfb05665e158

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