Skip to main content

Import Knowledge (import-kb)

A utility package for importing distilled knowledge and curriculum files into a ChromaDB-based Long-Term Memory (LTM) system.

Purpose

The import-kb package is designed to bridge the gap between static knowledge files (JSONL, MeTTa) and an active agent's memory. It processes structured knowledge, generates vector embeddings, and upserts them into a ChromaDB collection, enabling semantic search and retrieval for AI agents.

Supported Embedding Models

This package supports two primary embedding modes:

  • OpenAI (Cloud):
    • Default model: text-embedding-3-large
    • High accuracy but requires an internet connection and an API key.
  • SentenceTransformers (Local):
    • Default model: intfloat/e5-large-v2
    • Runs fully offline on your local machine.
    • Can be configured to use any model compatible with the sentence-transformers library (e.g., all-MiniLM-L6-v2).

Installation

You can install the package directly from PyPI:

pip install import-kb

Or install it locally in editable mode:

git clone <repository-url>
cd import-knowledge-package
pip install -e .

Setup

Create a .env file in your project root or set the following environment variables:

  • OPENAI_API_KEY: Required if using OpenAI embeddings.
  • CHROMA_DB_PATH: (Optional) Custom path to your Chroma database. Defaults to looking for /PeTTa/chroma_db or a local chroma_db folder.

How to Run

Command Line Interface (CLI)

After installation, you can run the import via the provided entry point:

# Use OpenAI embeddings (default)
import-knowledge

# Use Local embeddings
import-knowledge --local

# Use a specific local model
import-knowledge --local --model "all-MiniLM-L6-v2"

# Override OpenAI model
import-knowledge --model "text-embedding-3-small"

Alternatively, run it as a module:

python3 -m import_knowledge.import_knowledge --local

Programmatic Usage

You can initialize the embedding system and trigger the import programmatically from your Python scripts:

from import_knowledge import initLocalEmbedding, main

# Initialize for local use
initLocalEmbedding(model_name="intfloat/e5-large-v2")

# Run the import process
main()

Dependencies

  • openai: For cloud-based embeddings.
  • sentence-transformers: For local, offline embeddings.
  • chromadb: Vector database for storage.
  • python-dotenv: Management of environment variables.
  • tqdm: Progress bars for batch processing.

License

MIT License. See the LICENSE file for more details.

Metadata

Release files for import-kb 0.1.9

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

Source distribution (sdist)

Source distribution for import-kb 0.1.9
File Size Uploaded Provenance
import_kb-0.1.9.tar.gz 2.6 MB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for import-kb 0.1.9
File Interpreter ABI Platform
import_kb-0.1.9-py3-none-any.whl Python 3 none any Details

Total release size: 5.3 MB

Release files / import_kb-0.1.9.tar.gz

Download URL import_kb-0.1.9.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
2f9b2366e87b85a5dabf6673a0a0ab13dee7b8bff2c77112687c1c1ed4945d9c
BLAKE2b-256 checksum
How to use checksums
74ff71f06d4837bb5cb7374c672b00a605294c7991a94de845822f56da02d356
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Release files / import_kb-0.1.9-py3-none-any.whl

Download URL import_kb-0.1.9-py3-none-any.whl
Size 2.6 MB
Tags Python 3
SHA-256 checksum
How to use checksums
4797baa9cd5dffc204a2aab445cf7d05790a229c61eaf9aa0f8634f0ab43f69b
BLAKE2b-256 checksum
How to use checksums
5efc0cb568957462022189334bcbde68870024d66f3aacb8edc296070ccdb0e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.12

Security for import-kb 0.1.9

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

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