OmniModKit
Use convenient multimodal toolkit that operates with structured output.
Easily build agent tools on top of that.
Implementation
This package utilizes the implemented langchain structured output pipelines.
Installation
pip install omnimodkit
Omnimodel Usage
- Import OmniModel
- Give it text/image/audio and get text/image/audio
from omnimodkit import OmniModel
# Initialize the model
omni_model = OmniModel()
# Get image
omni_model.run(
user_input="Give me an image of a cat",
)
# Get just text
omni_model.run(
user_input="Tell me a joke",
)
# Get audio response
omni_model.run(
user_input="Tell me a joke with voice",
)
# Get image and text
omni_model.run(
user_input="Show me a cat and tell me about it",
)
# Stream responses
for response in omni_model.stream(
user_input="Tell me a joke",
):
print(response.text_new_chunk, end="|", flush=True)
# Async stream responses with image generation
last_response = None
async for response in omni_model.astream(
user_input="Draw a cat and provide some text about it",
):
if response.text_new_chunk:
print(response.text_new_chunk, end="|", flush=True)
last_response = response
print("\nFinal response:", last_response)
# Async stream responses
async for response in omni_model.astream(
user_input="Tell me a joke",
):
print(response.text_new_chunk, end="|", flush=True)
# Use audio recognition
import io
import requests
url = "https://cdn.openai.com/API/examples/data/ZyntriQix.wav"
audio_bytes = io.BytesIO(requests.get(url, timeout=10).content)
audio_bytes.name = "audio.wav"
omni_model.run(
user_input="Draw an image based on the audio and tell me about it.",
in_memory_audio_stream=audio_bytes,
)
# Use image recognition
import io
import requests
url = "https://raw.githubusercontent.com/Flagro/treefeeder/main/logo.png"
image_bytes = io.BytesIO(requests.get(url, timeout=10).content)
image_bytes.name = "image.png"
omni_model.run(
user_input="Describe this image and generate a related image.",
in_memory_image_stream=image_bytes,
)
# Estimate price for a model run
import io
import requests
url = "https://raw.githubusercontent.com/Flagro/treefeeder/main/logo.png"
image_bytes = io.BytesIO(requests.get(url, timeout=10).content)
image_bytes.name = "image.png"
omni_model.estimate_price(
user_input="What is the capital of France?", in_memory_image_stream=image_bytes
)
Modkit Usage
- Import ModelsToolkit
- Run appropriate models
- Get structured output response
from omnimodkit import ModelsToolkit
# Initialize the model toolkit
modkit = ModelsToolkit()
# Run the model synchronously
modkit.text_model.run(
user_input="What is the capital of France?",
)
# Stream responses from the model
for response in modkit.text_model.stream(
user_input="What is the capital of France?",
):
print(response, end="|", flush=True)
# Generate images
modkit.image_generation_model.run(
user_input="Draw a cat",
)
# Use audio recognition
import io
import requests
url = "https://cdn.openai.com/API/examples/data/ZyntriQix.wav"
audio_bytes = io.BytesIO(requests.get(url, timeout=10).content)
audio_bytes.name = "audio.wav"
modkit.audio_recognition_model.run(
in_memory_audio_stream=audio_bytes,
)
# Use image recognition
import io
import requests
url = "https://raw.githubusercontent.com/Flagro/treefeeder/main/logo.png"
image_bytes = io.BytesIO(requests.get(url, timeout=10).content)
image_bytes.name = "image.png"
modkit.vision_model.run(
in_memory_image_stream=image_bytes,
)
# Use audio generation
modkit.audio_generation_model.run(
user_input="Hello! How can I help you today?",
)
License
MIT license
Release files for omnimodkit 0.0.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| omnimodkit-0.0.9.tar.gz | 14.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| omnimodkit-0.0.9-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 34.6 kB
Release files / omnimodkit-0.0.9.tar.gz
| Download URL | omnimodkit-0.0.9.tar.gz |
|---|---|
| Size | 14.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b46cd1c500e62e464663d587ea92a636d0d6b9a12fd70705c6db09f4e217feb3
|
|
BLAKE2b-256 checksum How to use checksums |
73749cfeaf9011efa95b0fb06161ab62b0a2359a738f9258f63d679c5ec38639
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|
Release files / omnimodkit-0.0.9-py3-none-any.whl
| Download URL | omnimodkit-0.0.9-py3-none-any.whl |
|---|---|
| Size | 20.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
80cfe72a691e5c6e8996ea8b1d41ccac4e785c4397f20754b69086dfb8332bda
|
|
BLAKE2b-256 checksum How to use checksums |
3aac72450267349910f61380ea22676d9dfdfb8dce7cbaf58724ec344564e4ee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.23
|