Skip to main content

InertialAI embeddings integration for Chroma

Project description

inertialai-chroma

PyPI Python License

InertialAI embeddings integration for Chroma — supports text-only, time-series-only, and multi-modal (text + time-series) semantic search via the inertial-embed-alpha model.


Overview

InertialAI's inertial-embed-alpha model produces dense vector embeddings from three input types:

Input type Example
Text only "temperature spike at noon"
Time-series only [[72, 74, 73, 75, 71]] (e.g. heart rate readings)
Multi-modal A time-series signal paired with its natural language description, combined into a single vector

Multi-modal embeddings are InertialAI's core differentiator — a single vector that captures both the numerical signal and its semantic context simultaneously, enabling richer similarity search across domains like industrial IoT, healthcare, and financial markets.

inertialai-chroma implements Chroma's full eight-method EmbeddingFunction interface, including get_config() and build_from_config(), so that collections can be persisted to disk and reconstructed without storing credentials.


Requirements


Installation

pip install inertialai-chroma
# or
uv add inertialai-chroma

Quickstart

Set your API key as an environment variable:

export INERTIALAI_API_KEY="your-api-key"

Then create a collection and start embedding:

import chromadb
from inertialai_chroma import InertialAIEmbeddingFunction

client = chromadb.HttpClient(host="localhost", port=8000)
ef = InertialAIEmbeddingFunction()  # reads INERTIALAI_API_KEY from env

collection = client.create_collection("sensors", embedding_function=ef)

collection.add(
    documents=[
        "temperature spike at noon",
        "stable overnight readings",
        "pressure anomaly detected",
    ],
    ids=["doc-1", "doc-2", "doc-3"],
)

results = collection.query(query_texts=["anomalous thermal event"], n_results=2)
print(results["documents"])

Multi-modal Embeddings

Since Chroma documents are always strings, multi-modal inputs are passed as JSON-serialised dicts containing a text field, a time_series field, or both. Time-series data is formatted as a list of channels, where each channel is a list of numerical readings.

import json
import chromadb
from inertialai_chroma import InertialAIEmbeddingFunction

client = chromadb.HttpClient(host="localhost", port=8000)
ef = InertialAIEmbeddingFunction()
collection = client.create_collection("energy", embedding_function=ef)

# Each document pairs a text description with its raw time-series readings
collection.add(
    documents=[
        json.dumps({
            "text": "Energy price spike Q4 2022",
            "time_series": [[1.2, 1.5, 1.8, 2.1, 2.4]],
        }),
        json.dumps({
            "text": "Stable energy prices Q1 2023",
            "time_series": [[0.9, 0.9, 0.91, 0.88, 0.9]],
        }),
    ],
    ids=["doc-1", "doc-2"],
)

# Query with a multi-modal input — or just plain text
results = collection.query(
    query_texts=[
        json.dumps({"text": "abnormal energy reading", "time_series": [[1.3, 1.6, 2.0]]})
    ],
    n_results=1,
)
print(results["documents"])

Configuration

InertialAIEmbeddingFunction(
    api_key_env_var="INERTIALAI_API_KEY",  # default
    model_name="inertial-embed-alpha",     # default
    dimensions=None,                        # default — use full embedding size
    timeout=60.0,                           # default — seconds
)
Parameter Type Default Description
api_key_env_var str "INERTIALAI_API_KEY" Name of the environment variable holding the API key
model_name str "inertial-embed-alpha" InertialAI model to use for embedding
dimensions int | None None Truncate embedding output to this many dimensions
timeout float 60.0 HTTP request timeout in seconds
api_key str | None None (Deprecated) Pass the key value directly — not persisted by Chroma; prefer api_key_env_var

Note: model_name and dimensions are immutable after a collection is created — changing either would invalidate the existing vector index.


Collection Persistence

When Chroma persists a collection to disk, it serialises the embedding function via get_config(). InertialAIEmbeddingFunction stores the environment variable name, never the key value itself, so serialised collections are safe to commit to version control. At load time, build_from_config() resolves the key from the environment automatically — no credentials need to be passed explicitly.


Links

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

inertialai_chroma-0.1.0.tar.gz (166.5 kB view details)

Uploaded Source

Built Distribution

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

inertialai_chroma-0.1.0-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file inertialai_chroma-0.1.0.tar.gz.

File metadata

  • Download URL: inertialai_chroma-0.1.0.tar.gz
  • Upload date:
  • Size: 166.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for inertialai_chroma-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72053541d87e54da1429ca85870ad225cd2fe8f26241347c019bcfcaf774efc6
MD5 84c1cf55086d7d227b5167005eea6083
BLAKE2b-256 f1cda772b3491e97292337ef827c73d1d85af112eca80e2ea8949f9a44b9ec7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for inertialai_chroma-0.1.0.tar.gz:

Publisher: publish-chroma.yml on InertialAI/inertialai-chroma

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inertialai_chroma-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for inertialai_chroma-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d48c010997143a2bda21da95d72371b11ad89d3a8c9a1cf5ffc1c6f4a6fb21f
MD5 62b2ed7fc8b37b22782890ffad2d0d1a
BLAKE2b-256 ae8cd8fbf25e5a6d5d2354d9f71cc2f4207ec9e33b868301744dca9aa12be99a

See more details on using hashes here.

Provenance

The following attestation bundles were made for inertialai_chroma-0.1.0-py3-none-any.whl:

Publisher: publish-chroma.yml on InertialAI/inertialai-chroma

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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