Skip to main content

No project description provided

Project description

Install

With these command you can build and install it in your enviourment

python -m pip venv .venv
source ./venv/bin/activate
pip install -q build
python -m build

pip install ./dist/aibrary-0.1.0-py3-none-any.whl
pip install ./dist/aibrary-0.1.0.tar.gz

Snippet Code

Sync Requests

from aibrary import AiBrary
aibrary = AiBrary(api_key=None) # either passing api_key to the client or setting the AIBRARY_API_KEY in environment variable

Get All Models

aibrary.get_all_models(filter_category="TTS",return_as_objects=False)

OpenAI Completion Models

aibrary.chat.completions.create(
    model="gpt-3.5-turbo",
    messages=[
        {"role": "user", "content": "How are you today?"},
        {"role": "assistant", "content": "I'm doing great, thank you!"},
    ],
    temperature=0.7,
)

Anthropic Completion Model

aibrary.chat.completions.create(
    model="claude-3-5-haiku-20241022",
    messages=[
        {"role": "user", "content": "How are you today?"},
        {"role": "assistant", "content": "what is computer"},
    ],
    temperature=0.7,
    system="you are a teacher of cmputer",
)

Text to Speech (TTS)

aibrary.audio.transcriptions.create(
    model="whisper-large-v3", file=open("path/to/audio", "rb")
)

Speech to Text (STT)

response = aibrary.audio.speech.create(
    input="Hey Cena", model="tts-1", response_format="mp3", voice="alloy"
)
open("file.mp3", "wb").write(response.content)

Image Generation

aibrary.images.generate(model="dall-e-2", size="256x256", prompt="Draw cat")

Translation

aibrary.translation.automatic_translation("HI", "phedone", "en", "fa")

OCR

aibrary.ocr(providers='amazon',file=open('tests/assets/ocr-test.jpg','rb').read(),file_name="test.jpg")
# OR only send path
aibrary.ocr(providers='amazon',file='tests/assets/ocr-test.jpg')
# OR send url
aibrary.ocr(providers='amazon',file_url="https://builtin.com/sites/www.builtin.com/files/styles/ckeditor_optimize/public/inline-images/5_python-ocr.jpg")

Async Client

For async version of client you can import from aibrary import AsyncAiBrary and only put await behind above exmpale like this example:

from aibrary import AsyncAiBrary
aibrary = AsyncAiBrary(api_key=None)
await aibrary.chat.completions.create(
    model="claude-3-5-haiku-20241022",
    messages=[
        {"role": "user", "content": "who are you what is your role??"},
    ],
    temperature=0.7,
    system="you are a math teacher"
    )

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

aibrary-0.0.3.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

aibrary-0.0.3-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

Details for the file aibrary-0.0.3.tar.gz.

File metadata

  • Download URL: aibrary-0.0.3.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.6 Darwin/24.2.0

File hashes

Hashes for aibrary-0.0.3.tar.gz
Algorithm Hash digest
SHA256 609d4f4d8432433fbf1107dedfeec07749497c3e35c00788be68b6f3a743b0cf
MD5 7fad95bf9b7b29cda42ccaced0eab168
BLAKE2b-256 a61c3cc2a00bec82f166f8105bfa1016f6a873e9b6189fa2335a185259f4beb7

See more details on using hashes here.

File details

Details for the file aibrary-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: aibrary-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 13.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.6 Darwin/24.2.0

File hashes

Hashes for aibrary-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 7f85867e08cf33b9a4c44d894b41fc487d5b21cc4a138ef3e57b6f23a1ad4aae
MD5 a3de6eefebe43a1d40ff1a7b300a2a08
BLAKE2b-256 bfdac2618c8c5071042a088196029cb65dae54825d4f982a1f7ac60cb8c25a75

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