Skip to main content
Quarantined

This project has been quarantined by PyPI admins. It cannot be installed or modified until a security review is complete.

kb-ai

PyPI Python versions License

Proof of concept. This package exists to demonstrate the shape of the API and the packaging pipeline. It is not production-hardened — expect breaking changes.

A lightweight, dependency-free knowledge base toolkit for AI applications. Store documents, search them with tf-idf ranking, and persist everything as plain JSON — no vector database or model server required to get started.

Maintained by 4us71n0.

Installation

pip install kb-ai

Quick start

from kb_ai import Document, KnowledgeBase

kb = KnowledgeBase()
kb.add_text("faq-1", "Refunds are issued within 5 business days.", {"topic": "billing"})
kb.add(Document(id="faq-2", text="Password resets are sent by email."))

for hit in kb.search("how long do refunds take"):
    print(hit.score, hit.document.id, hit.document.text)

kb.save("kb.json")
restored = KnowledgeBase.load("kb.json")

Command line

kb-ai add faq-1 "Refunds are issued within 5 business days." --metadata '{"topic": "billing"}'
kb-ai search "refund policy" -n 3
kb-ai list
kb-ai remove faq-1

Every command accepts --store PATH to point at a specific JSON file (default: kb.json in the current directory).

API

Object Purpose
Document(id, text, metadata) A single knowledge base entry.
SearchResult(document, score) A document with its relevance score.
KnowledgeBase add, add_text, get, remove, search, save, load.
tokenize(text) The lowercase alphanumeric tokenizer used for scoring.

Development

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest
ruff check .
mypy

Releasing to PyPI

  1. Bump __version__ in src/kb_ai/__init__.py and update CHANGELOG.md.
  2. Build and verify locally:
    python -m build
    twine check dist/*
    
  3. Tag and push — the publish workflow uploads to PyPI via Trusted Publishing:
    git tag v0.1.0 && git push origin v0.1.0
    

See PUBLISHING.md for the one-time PyPI setup.

License

MIT — see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kb_ai-0.1.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

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

kb_ai-0.1.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: kb_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.2

File hashes

Hashes for kb_ai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e58721500bdc41a11e3fa8bcdcf80f4ccc2f6befcf364e503c6c56a69c8e3b5
MD5 c30b11143799f0da6cf87516aefebb99
BLAKE2b-256 339fccc5520723fe31e2232da2db5689cd99e79f4444d4c186ed539ad6c0944e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: kb_ai-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.2

File hashes

Hashes for kb_ai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2c0e5c58af314f0af65041643d87f277455914c75fd87f3ce68352bf36647c0
MD5 16bc2b5479f98e3f9c2fbd33f68a9ed5
BLAKE2b-256 aa06d4e7466ea5a087c3eb2d4be65b55d758334cfbfcda7b91b40085cb684222

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page