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 instructionsmax_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+
openailibrarygoogle-generativeailibrary
License
MIT License
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
sbai-0.1.2-py3-none-any.whl
(3.5 kB
view details)
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
822d56b0e077de77bae0d15bbac22db081dc249dceee73ec8a654d2567a75ec1
|
|
| MD5 |
d83cec1267ca1925cc76e13bd9ecabe0
|
|
| BLAKE2b-256 |
8ac92eecea8842d16e4930e47d8d207edfda53f027c532b6cd40c642b1fc140e
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4c311765035be575fa7b6ab0793e73c9787a77d860ee6af57153c3dc5d40cee
|
|
| MD5 |
14d39df7e112da941f3b8a9341c762a3
|
|
| BLAKE2b-256 |
077dce5d6f12cdc718ffabb11423962249d4b918daf400c6ff3adfb05665e158
|