Skip to main content

Unofficial Python wrapper for Blackbox AI

Project description

Ataraxia (Blackbox)

Ataraxia is unofficial Python wrapper for Blackbox AI.

Installation

pip install ataraxia

Usage

Chat

from ataraxia import Blackbox, Model

# Use Models.BLACKBOXAI by default
blackbox = Blackbox()
response = blackbox.chat('What do you think about gen alpha?') # ChatResponse<CHAT_ID>
print(response)

# Chat with image
response = blackbox.chat('What do you think about this image?', 'https://example.com/image.png') # from image link
response = blackbox.chat('What do you think about this image?', 'QWt1IFBIUA==') # from base64 string
response = blackbox.chat('What do you think about this image?', 'data:image/png;base64,QWt1IFBIUA==') # from base64 image data
response = blackbox.chat('What do you think about this image?', b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x03\xe8\x00\x00') # from image bytes

# Use other model from Model
blackbox = Blackbox(Model.GPT_4O)

# Set system instruction prompt
blackbox = Blackbox(instruction='You are a gen alpha assistant')
# or
blackbox.change_instruction('You are a gen alpha assistant')

# Load chat data and history from saved file
blackbox = Blackbox(chat_id='SAVED_CHAT_ID')
# or
blackbox.load_chat('SAVED_CHAT_ID')

# Save chat data and history to JSON file
blackbox.save_chat()
# or
blackbox.save_chat('./ataraxia_{CHAT_ID}.json') # {CHAT_ID} will be replaced with current chat id

# Change save path
blackbox.change_save_path('filename_{CHAT_ID}.json')

Image Generation (Imagine)

from ataraxia import Blackbox

blackbox = Blackbox()
result = blackbox.imagine('A pregnant kitten') # ImageResponse<IMAGE_ID>
print(result) # https://storage.googleapis.com/...

# Download the image to bytes
image_bytes = result.download()

# Save the image to file
result.save('./imagine.jpg') # True if success False otherwise

Search

from ataraxia import Blackbox

blackbox = Blackbox()
results = blackbox.search('Schall meaning') # list of SearchResult<TITLE>
print(results[0]) # Schall. [ʃal]Maskulinum | masculine m...

Deep Search

from ataraxia import Blackbox

blackbox = Blackbox()
result = blackbox.deep_search('Schall meaning') # SearchResult<OK>
print(result)

Blackbox Params

Param Type Description Required Default
model Models Set the Blackbox AI (chat) default model No Model.BLACKBOXAI
chat_id str Set the saved chat_id to load the history and chat data No None
instruction str Set the system instruction for every chat request No None
auto_save bool Will save chat data and history to save_path if True No True
save_path str File path to save chat data like model, instruction, and history. It is recommended to always insert {CHAT_ID} so that it can be loaded with load_chat() No ./ataraxia_{CHAT_ID}.json

Blackbox.chat Params

Param Type Description Required Default
message str Message to send Yes -
image str | bytes Additional image No None
history list Chat history No []
max_tokens int Response max tokens No 1024
top_p float Probability sampling to determine the selected set of tokens for the response No 0.9
temperature float Set the level of creativity or randomness in the generated response No 0.7

Buy me tanghulu

https://trakteer.id/alfi-syahri

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

ataraxia-1.1.6.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

ataraxia-1.1.6-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file ataraxia-1.1.6.tar.gz.

File metadata

  • Download URL: ataraxia-1.1.6.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for ataraxia-1.1.6.tar.gz
Algorithm Hash digest
SHA256 7f4e157b2bedb9a49e61c76860a0679ef9910887bc7930a95b26a7c10337ad46
MD5 46a6ccd83e8df79b111db2f770f1b135
BLAKE2b-256 d57c89e1ba74668865d9b3d424e485e903c0eafacacc889a4cc1f59cce29e638

See more details on using hashes here.

File details

Details for the file ataraxia-1.1.6-py3-none-any.whl.

File metadata

  • Download URL: ataraxia-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for ataraxia-1.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 94917538f922b84fe8e71a44e485f4ade4b3a9d812fc901726dc3c7b63b04fe9
MD5 fb795283253a2d5bedbafb2978b3ae23
BLAKE2b-256 c7c3a9744607da76f5dd469026f9264fb7a5352eabd8e167c6e31dfde5df86e6

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