Core shared libraries for multimodal Kani extensions.
Project description
kani-multimodal-core
This package contains core extensions for using Kani with multimodal language models.
Installation
kani-multimodal-core should be installed alongside the core kani install using an extra:
$ pip install "kani[multimodal]"
However, you can also explicitly specify a version and install the core package itself:
$ pip install kani-multimodal-core
Features
This package provides the core multimodal extensions that engine implementations can use -- it does not provide any engine implementations on its own.
The package adds support for:
- Images (
kani.ext.multimodal_core.ImagePart) - Audio (
kani.ext.multimodal_core.AudioPart) - Video (WIP)
When installed, these core kani engines will automatically use the multimodal parts:
- OpenAIEngine
- AnthropicEngine
Additionally, the core kani chat_in_terminal method will support attaching multimodal data from a local drive or
from the internet using @/path/to/media or @https://example.com/media.
Message Parts
The main feature you need to be familiar with is the MessagePart, the core way of sending messages to the engine.
To do this, when you call the kani round methods (i.e. Kani.chat_round or Kani.full_round or their str variants),
pass a list of multimodal parts rather than a string:
from kani import Kani
from kani.engines.openai import OpenAIEngine
from kani.ext.multimodal_core import ImagePart
engine = OpenAIEngine(model="gpt-4.1-nano")
ai = Kani(engine)
# notice how the arg is a list of parts rather than a single str!
msg = await ai.chat_round_str([
"Please describe this image:",
ImagePart.from_file("path/to/image.png")
])
print(msg)
See the docs (TODO) for more information about the provided message parts.
Terminal Utility
When installed, kani-multimodal-core augments the chat_in_terminal utility provided by kani.
This utility allows you to provide multimodal media on your disk or on the internet inline by prepending it with an @ symbol:
>>> from kani import chat_in_terminal
>>> chat_in_terminal(ai)
USER: Please describe this image: @path/to/image.png and also this one: @https://example.com/image.png
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
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
File details
Details for the file kani_multimodal_core-0.0.1.dev0.tar.gz.
File metadata
- Download URL: kani_multimodal_core-0.0.1.dev0.tar.gz
- Upload date:
- Size: 24.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2ce2f5c916c4adafaa4e8971a7d2aa183f4a91e6240ea84e772461ec0420673
|
|
| MD5 |
ac705987e489dc8eb4ade66beeaf3bf5
|
|
| BLAKE2b-256 |
827c10de0b3966c4664c927c7802be82c07223dd777d9ff0b9d217b7fffb4870
|
Provenance
The following attestation bundles were made for kani_multimodal_core-0.0.1.dev0.tar.gz:
Publisher:
pythonpublish.yml on zhudotexe/kani-multimodal-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kani_multimodal_core-0.0.1.dev0.tar.gz -
Subject digest:
d2ce2f5c916c4adafaa4e8971a7d2aa183f4a91e6240ea84e772461ec0420673 - Sigstore transparency entry: 238404161
- Sigstore integration time:
-
Permalink:
zhudotexe/kani-multimodal-core@67bcc12267e2787bd6d321d8d85decb3e284822e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/zhudotexe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pythonpublish.yml@67bcc12267e2787bd6d321d8d85decb3e284822e -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file kani_multimodal_core-0.0.1.dev0-py3-none-any.whl.
File metadata
- Download URL: kani_multimodal_core-0.0.1.dev0-py3-none-any.whl
- Upload date:
- Size: 13.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3260f1c6af32364f0d6d4448c35afc42091c0de0b752fc430a07d882b438c819
|
|
| MD5 |
d228ea9e14c783d38aef235afb8e9f06
|
|
| BLAKE2b-256 |
3dd9d3f36e7b72270661e55b395af6029c6ddf572c230419a2255caf55c2d27b
|
Provenance
The following attestation bundles were made for kani_multimodal_core-0.0.1.dev0-py3-none-any.whl:
Publisher:
pythonpublish.yml on zhudotexe/kani-multimodal-core
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kani_multimodal_core-0.0.1.dev0-py3-none-any.whl -
Subject digest:
3260f1c6af32364f0d6d4448c35afc42091c0de0b752fc430a07d882b438c819 - Sigstore transparency entry: 238404162
- Sigstore integration time:
-
Permalink:
zhudotexe/kani-multimodal-core@67bcc12267e2787bd6d321d8d85decb3e284822e -
Branch / Tag:
refs/heads/main - Owner: https://github.com/zhudotexe
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pythonpublish.yml@67bcc12267e2787bd6d321d8d85decb3e284822e -
Trigger Event:
workflow_dispatch
-
Statement type: