Configuration Reference
Constructor
from inertialai_chroma import InertialAIEmbeddingFunction
ef = InertialAIEmbeddingFunction(
api_key_env_var="INERTIALAI_API_KEY", # default
model_name="inertial-embed-alpha", # default
dimensions=None, # default
timeout=60.0, # default
)
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key_env_var | str | "INERTIALAI_API_KEY" | Name of the environment variable that holds your InertialAI API key. The name (not the value) is stored in Chroma's persisted collection config. |
model_name | str | "inertial-embed-alpha" | InertialAI embedding model to use. Immutable after collection creation. |
dimensions | int | None | None | Truncate the output embedding to this many dimensions. When None, the model's full embedding size is returned. Immutable after collection creation. |
timeout | float | 60.0 | HTTP request timeout in seconds for calls to the InertialAI embeddings API. |
api_key (deprecated) | str | None | None | Pass the API key value directly. Deprecated — not included in get_config() and therefore not persisted by Chroma. Prefer api_key_env_var. Raises a DeprecationWarning if used. |
api_key_env_var
Controls which environment variable the embedding function reads its API key from. Use this when you manage multiple keys for different environments:
# Development
ef_dev = InertialAIEmbeddingFunction(api_key_env_var="INERTIALAI_API_KEY_DEV")
# Production
ef_prod = InertialAIEmbeddingFunction(api_key_env_var="INERTIALAI_API_KEY_PROD")
If the named environment variable is not set when the embedding function is initialized, a ValueError is raised:
ValueError: The INERTIALAI_API_KEY environment variable is not set.
dimensions
Reduce the output embedding size to optimize storage or query speed:
ef = InertialAIEmbeddingFunction(dimensions=256)
Smaller dimensions reduce memory consumption and speed up vector search at the cost of some semantic fidelity. Common use cases include:
- Edge devices or applications with constrained memory
- Large-scale vector databases where storage cost matters
- Scenarios where approximate similarity is acceptable
dimensionscannot be changed after a collection has been created. Changing the embedding size would make new vectors incompatible with the existing index. Create a new collection and re-embed your data if you need a different dimension count.
timeout
Increase the HTTP timeout for large or slow batch requests:
ef = InertialAIEmbeddingFunction(timeout=120.0) # 2 minutes
The default of 60 seconds is appropriate for most workloads. Increase this value when embedding very large batches or when operating on slow network connections.
Distance Spaces
InertialAIEmbeddingFunction supports three distance metrics for vector similarity:
| Space | Identifier | Description |
|---|---|---|
| Cosine similarity | "cosine" | Measures the angle between vectors — scale-invariant. Recommended for most semantic search use cases. Default. |
| Euclidean distance | "l2" | Measures the straight-line distance between vectors. |
| Inner product | "ip" | Raw dot product — useful when vectors are pre-normalized. |
To use a non-default distance space, set it in the collection's metadata when creating the collection:
collection = client.create_collection(
"sensors",
embedding_function=ef,
metadata={"hnsw:space": "l2"}, # Use Euclidean distance
)
The distance space must be set at collection creation time and cannot be changed afterwards.
Immutable Settings
Two parameters are immutable after a Chroma collection has been created:
| Parameter | Why it's immutable |
|---|---|
model_name | Changing the model would produce embeddings in a different vector space, invalidating all existing index entries. |
dimensions | Changing the output dimension would make existing and new vectors incompatible. |
If you attempt to reopen a collection with different values for either parameter, Chroma raises a ValueError:
ValueError: 'model_name' cannot be changed after the collection has been created.
To use a different model or dimension count, create a new collection and re-embed your data.
Static Methods
These methods are called by Chroma internally and reflect the defaults for InertialAIEmbeddingFunction:
| Method | Return value | Description |
|---|---|---|
name() | "inertialai" | Identifier used in Chroma's embedding function registry. |
default_space() | "cosine" | Default distance metric for new collections using this function. |
supported_spaces() | ["cosine", "l2", "ip"] | All distance metrics supported by this embedding function. |