Skip to main content

MiscAI

Tools to make it easier to embed AI related things into your exsisting projects.

Features

  • Ollama local LLM wrapper (with build-in Jina embeddings model)
  • Mercury diffusion language model (with the same embeddings as with Ollama, requires a mercury API key)
  • Easy tool function creation with both types of language models
  • Whisper-cpp speech to text
  • Text to speech cloning with pocket-tts (requires a hugging face account)
  • Voice activity detection with silero
  • Wakeword detection with local wake
  • Intention detection with Jina embeddings and LLM slot fitting

Ollama local LLM

To use the local LLM with Ollama the host has to have Ollama installed already. The embeddings model is ran on the CPU as it is light and performant enough. Then install it into the python project with:

pip install miscai[llm]

Here is an example of how to use it:

from miscai.llm import LLM

llm = LLM(promt="You are helpful assistant.", model="qwen3:4b", convo_file="./convo.json")
print(llm.ask_LLM("Hello!"))

Diffusion Language Model (DLM)

Use of the DLM module is very similar to using the local LLM. You will need to make a Mercury API key to use the wrapper. The embeddings model is ran on the CPU as it is light and performant enough. Then install it into the python project with:

pip install miscai[dlm]

Here is an example of how to use it:

from miscai.dlm import DLM

dlm = DLM(promt="You are helpful assistant.", model="mercury-v2", convo_file="./convo.json", api_key="123abc")
print(dlm.ask_LLM("Hello!"))

Tool calling for Language models

This requires that you have installed one of the language models above. Here is an example of how to use it in a project:

from miscai.tools import ToolLoader

tool_loader = ToolLoader("./tools")

Then when you are creating your language model object, create it like this (using the Ollama one for example):

llm = LLM(promt="You are helpful assistant.", model="qwen3:4b", convo_file="./convo.json", tools=tool_loader.get_tools())

To create a tool, install the required dependencies to your project and place the python file in the directory specified in the ToolLoader object. Here is an example tool that gets the time with the 'pytz' package:

import pytz
from datetime import datetime

tool = {
    "type": "function",
    "function": {
        "name": "get_current_time",
        "description": "Gets the current time for a provided time zone.",
        'parameters': {
            "type": "object",
            "properties": {
                "timezone": {
                    "type": "string",
                    "description": "The time zone as specified in the tz (zoneinfo) library."
                }
            },
            "required": ["timezone"]
        }
    }
}

def get_current_time(timezone: str) -> str:
    tz = pytz.timezone(timezone)
    return str(datetime.now(tz))

Speech to text

The whisper-cpp model is ran on the CPU but is quite performant and accurate, but may use a lot of CPU. The audio bytes are in a numpy array encoded at 16000kHz with 512 byte chunks. Install it into your project with:

pip install miscai[stt]

Here is an example of how to use it:

from miscai.stt import STT

stt = STT()
print(stt.transcribe(audio_bytes=audio_bytes))

Text to speech

You will have to create a hugging face account and accept the eula for using the pocket-tts model. Then create an API key as you will need this later. The model is ran on the CPU for reason mentioned on the model's page. The audio base needs to be encoded with 16000kHz for the best results. The outputed audio is a numpy array. Then install it into the project using:

pip install miscai[tts]

Here is an example of how to use it:

from miscai.tts import TTS

tts = TTS("./voice_base.wav")
audio = tts.get_audio("Hello!")

Voice activity detection

This uses Silero VAD for voice detection and it runs on the CPU due to the model being light weight enough. The audio bytes inputed is a numpy array with 512 byte chunks. For best results the audio should be encoded in 16000kHz. Install it into your project with:

pip install miscai[vad]

Here is an example of how to use it:

from miscai.vad import VAD

vad = VAD(threshold=0.5)
print(vad.is_speech(audio_bytes=audio_bytes))

Wakeword detection

This uses local-wake and so any audio file of any person saying the wakeword works as the wakeword. The audio inputed is a audio stream with 512 byte chunks (best gotten through SoundDevice). For best results the audio for the input and the audio for the reference audio files should be encoded in 16000kHz. Install it into your project with:

pip install miscai[wake]

Here is an example of how to use it:

from miscai.wakeword import WakeWord

wake_word = WakeWord(threshold=0.5, audio_dir="./wakeword")
print("Begining to wait for wakeword")
wake_word.waitForWord(callback=awoke, stream=stream)

def awoke(detection: dict, stream: sd.InputStream):
    print(f"Wake word detected: {detection['wakeword']}")

Intention detection, with LLM slot extraction

This readme is getting too long and so I plan on writing a more in-depth wiki at a later date. For now this is undocumented but feel free to look though the code to figure it out. Also I am making a project that will use all (ish) features of miscai that I will reveal more details on at a later date.

Final notes

This project is in quite an early stage and could do with some more polish. It is not meant to be used in production but is good for making small prototypes for different ideas that you may have. However I am now making a full project using this in order to test how well this library works in production - more details will be anounced soon. I made this to make it easier to implement LLMs into my other projects and it grew from there. Changes are welcome as the documention is hastely written and the codes is arguable worse. Thanks for reading and maybe using this. :)

Metadata

Release files for miscai 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for miscai 0.2.1
File Size Uploaded Provenance Actions
miscai-0.2.1.tar.gz 139.5 kB With provenance Details for miscai-0.2.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for miscai 0.2.1
File Interpreter ABI Platform Actions
miscai-0.2.1-py3-none-any.whl Python 3 none any Details for miscai-0.2.1-py3-none-any.whl

Total release size: 152.7 kB

Release files / miscai-0.2.1.tar.gz

Download URL miscai-0.2.1.tar.gz
Size 139.5 kB
Tags Source
SHA-256 checksum
How to use checksums
977118650e4a81357e1b2417c0c78597528fb7b9105f743592595465880f67bf
BLAKE2b-256 checksum
How to use checksums
698e71ffb820242d313dfc473d9ec79273a4cfc201ae3fd21f8b7fee8e7f94f1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Release files / miscai-0.2.1-py3-none-any.whl

Download URL miscai-0.2.1-py3-none-any.whl
Size 13.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a417923aae4e785df9819adef6060851db8a6c916cdd6898aa5cdf27c3166402
BLAKE2b-256 checksum
How to use checksums
fbfc545f628e65fa6714e4f24b7bf1d7d8e17b0fb03300debb4ec0579471f0d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

Security for miscai 0.2.1

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for miscai-0.2.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 11, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page