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"
)
Metadata
Release files for aibrary 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aibrary-0.0.3.tar.gz | 10.1 kB | Without provenance | Details for aibrary-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aibrary-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for aibrary-0.0.3-py3-none-any.whl |
Total release size: 23.9 kB
Release files / aibrary-0.0.3.tar.gz
| Download URL | aibrary-0.0.3.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
609d4f4d8432433fbf1107dedfeec07749497c3e35c00788be68b6f3a743b0cf
|
|
BLAKE2b-256 checksum How to use checksums |
a61c3cc2a00bec82f166f8105bfa1016f6a873e9b6189fa2335a185259f4beb7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.6 Darwin/24.2.0
|
Release files / aibrary-0.0.3-py3-none-any.whl
| Download URL | aibrary-0.0.3-py3-none-any.whl |
|---|---|
| Size | 13.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f85867e08cf33b9a4c44d894b41fc487d5b21cc4a138ef3e57b6f23a1ad4aae
|
|
BLAKE2b-256 checksum How to use checksums |
bfdac2618c8c5071042a088196029cb65dae54825d4f982a1f7ac60cb8c25a75
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.7.1 CPython/3.12.6 Darwin/24.2.0
|
Security for aibrary 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.