Skip to main content

High-performance LLM prompt optimization library

Project description

kkachi-python

Python bindings for the kkachi LLM optimization library.

Installation

pip install kkachi

Usage

from kkachi import Signature, Example

sig = Signature("question -> answer")
ex = Example({"question": "What is 2+2?", "answer": "4"})

Memory / RAG with Persistent Storage

The Memory class provides a vector store for RAG (Retrieval-Augmented Generation) with full CRUD operations and optional persistent storage using DuckDB.

Basic Usage (In-Memory)

from kkachi import Memory

# Create in-memory store
mem = Memory()

# CREATE: Add documents
doc_id = mem.add("Document content here")
mem.add_with_id("custom-id", "Another document")
mem.add_tagged("category", "Tagged document")

# READ: Retrieve documents
content = mem.get(doc_id)
results = mem.search("query text", k=3)

# UPDATE: Modify existing documents
mem.update(doc_id, "Updated content")

# DELETE: Remove documents
mem.remove(doc_id)

Persistent Storage

Enable DuckDB-backed persistent storage to preserve data across program restarts:

from kkachi import Memory

# Create or open a persistent database
mem = Memory().persist("./my_rag_db.db")

# Add documents (persists to disk)
mem.add("Important knowledge that survives restarts")
mem.add("More documents here")

# Data persists across program runs
results = mem.search("knowledge", k=3)

# Close and reopen
del mem
mem = Memory().persist("./my_rag_db.db")  # Data is still there!

The database file will be created if it doesn't exist. Subsequent calls to .persist() with the same path will reopen the existing database.

Requirements:

  • The storage feature is enabled by default in pip package
  • DuckDB native library (usually handled automatically)

Complete Example

See examples/memory_persist.py for a complete demonstration of CRUD operations with persistent storage.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

kkachi-0.1.8-cp313-cp313-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.13Windows x86-64

kkachi-0.1.8-cp313-cp313-manylinux_2_28_x86_64.whl (14.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

kkachi-0.1.8-cp313-cp313-manylinux_2_28_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

kkachi-0.1.8-cp313-cp313-macosx_11_0_arm64.whl (13.0 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

kkachi-0.1.8-cp313-cp313-macosx_10_12_x86_64.whl (14.4 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

kkachi-0.1.8-cp312-cp312-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.12Windows x86-64

kkachi-0.1.8-cp312-cp312-manylinux_2_28_x86_64.whl (14.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

kkachi-0.1.8-cp312-cp312-manylinux_2_28_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

kkachi-0.1.8-cp312-cp312-macosx_11_0_arm64.whl (13.0 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

kkachi-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl (14.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

kkachi-0.1.8-cp311-cp311-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.11Windows x86-64

kkachi-0.1.8-cp311-cp311-manylinux_2_28_x86_64.whl (14.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

kkachi-0.1.8-cp311-cp311-manylinux_2_28_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

kkachi-0.1.8-cp311-cp311-macosx_11_0_arm64.whl (13.0 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

kkachi-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl (14.4 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

kkachi-0.1.8-cp310-cp310-win_amd64.whl (12.8 MB view details)

Uploaded CPython 3.10Windows x86-64

kkachi-0.1.8-cp310-cp310-manylinux_2_28_x86_64.whl (14.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

kkachi-0.1.8-cp310-cp310-manylinux_2_28_aarch64.whl (13.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

kkachi-0.1.8-cp310-cp310-macosx_11_0_arm64.whl (13.0 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

kkachi-0.1.8-cp310-cp310-macosx_10_12_x86_64.whl (14.4 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

File details

Details for the file kkachi-0.1.8-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: kkachi-0.1.8-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kkachi-0.1.8-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 2e77161e82c04967c051e56a08e8748b824071cccfe1956a2cca3ea1607b8225
MD5 28e0b358aafab96cb04188d3efb82833
BLAKE2b-256 fbc4e2bfccab0d43d3fd4bad5dc8936800769c2f0b3b3bebc83bfbed17a86147

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5eae8411c1b1c15baf937c4d67d8e6482ce401214a456f349e9b46217f7ab584
MD5 ea6412e5b085466c90ccbc86cafd970a
BLAKE2b-256 d08ac57296b927b6bd9046efa8968119dcc28bf8274356b104656a2ed57fd4b2

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2b9a2309ecfe2dae3ce6fc0d28fb719d908d0b3d2f8f2644ce92cede2ec66b74
MD5 94002ab27c62f977781d4d419524f0d5
BLAKE2b-256 af48f2261b4c9d2423e6a591212b1141b1efe539683ffe2711b792b4b19bdf95

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c725fc757ba8279e48e7181c44c7e578509b1d22868f027832faf1bfa93a7e72
MD5 61b05bfd58c1aaf4864f5c10ac27d67a
BLAKE2b-256 57531326d4155577ed7d8a4864fb56edc08e9146d863b1f76db4022b9680194e

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 7f0f59e52ecc78b97f80d604fb96caea386245f2b7e06535ec4043cf966ab8f1
MD5 a7750d5ec698ca8b836ab8ce4ef67474
BLAKE2b-256 b8b0be9a7c62602c6d2b43dcd9b4de5cc9cc02f10dfc75f92778b9232e9d3f81

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: kkachi-0.1.8-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kkachi-0.1.8-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 67414244fababb60595f63810ee0ad91c9cb26f686baa67b27375c1c5454c282
MD5 1dde89d11a0fe423b86e7eba6bb509f8
BLAKE2b-256 7bbb4a0c5199a54a8856019fba08577654c0dc1d7aed108ed95b3b7250981c40

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 103c448dc03753d7cb043331d58ed2b480387904d03e6ea166343b930e9af1f0
MD5 9b4efa8fd62799b439da67e27a7a5c3b
BLAKE2b-256 fea5cdb9913e21026690a0cef497c6000f5e82bc8a4905f339338a6178ffce3b

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 1894edb1e41371873b0c47350bdf096d2711743b80e9651fd751976efe9a42db
MD5 f761a59c07b738015aa44f8cd1a59f2b
BLAKE2b-256 e6db7f61d3618f5db3b9b89fa3c5c7ef17c5a80af637a4d5b0a39eb35dc5e2e4

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 19f5789901a98172eef22ee01526ff883589885b3d3f8d98832a2f9845ec0dc8
MD5 66c77bbbbb17ab518f1160d09f641268
BLAKE2b-256 750b80e64505dcc7a2c6e567747ba16e52279f2789aaf092da1243c169a776c4

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 e15d1c52aaf11670f65038b5b38f972ae8ed70f31c343d5c34703d7d9bca2980
MD5 f0adc80516edbb449f40a75a9b857f7b
BLAKE2b-256 c1c98e26edc42887733ae8cead4c7d96cce92830f342240504792a2c9465a430

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: kkachi-0.1.8-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kkachi-0.1.8-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 49acf69ce6c16450d8decc48453153c39ec48ba7bdf271aa75356a0e68f5be6a
MD5 0765a52bf4783dde111dbc65b3078da6
BLAKE2b-256 c0867f7b6fca5b81713fbdddb5d772f51475f94ab02577287646f553229b5781

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 20ef1846cb205491e7691a343940742e2fdc8cfd03be9005640137387953204c
MD5 779c4f0c3274339da326200dbc65c1a4
BLAKE2b-256 41439faff90027e9c8a4dd1ec09ab16d1dd02ebc52d62a0b058a0b8d80a95688

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 2e9b826eda1392869baf893869544f156125278ed4a721a11a78a6d5de395754
MD5 7c1154e555724dd0e995dd6687bd70da
BLAKE2b-256 f0e47b98937dc139882e1802dc428a6df422c5f4e2728d18b53313afe31a154a

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7ae0bf8972f474e0272e014cac9502759302a83e6d074729bd3b566c62deb491
MD5 e46796b7b33097026a91080f2e24c454
BLAKE2b-256 940f52e5a71b18211694c025f10c2a68a3175ef53ca8d398f15d5a4914858e17

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 40713ee2072a76c55e05b4fc5d6aa0b8b8c92ff4e9e2db5d3fefcbe33f80d968
MD5 b60c5d952e6f478c390551c876e57f1e
BLAKE2b-256 072bdf1c5ed15efc64ea168e94ab9849fc1b1337d587bd1f659a7e4d80673fdf

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: kkachi-0.1.8-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 12.8 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kkachi-0.1.8-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 40d9349ff0664b63e2aad8dccf107ec36d84622414f455ab960db65c8e4725b1
MD5 d78065e671ad6f2d89e44e65c01d1a95
BLAKE2b-256 b3894b07fa0329f414182fc1c3535ee2b8e0b2a5716c51785289377001d11be5

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 001453bff9bb855a750f62df202cc6e45fc259c8836aaa5da1d33b42f9c7805b
MD5 9be0b8a6f431aad13895193f8dbef862
BLAKE2b-256 4265bf123fa5855003e1eae4b3b1f7b2837449b62b54a0c2c82652ccb71e2498

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0fa62aff8d0c21d388dea091659aa4374f1ba180b144e6193fdc018135d4bbd8
MD5 5e2188ed70e1034978c528a938a94229
BLAKE2b-256 578cecb3beb2c8bb2dc1367ee37707159f6129736b384d9ad3b55f85b623a753

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6f88a6609406a3c0b93149f7f81cc2036f052388434803a0fc470dfa4ddea44d
MD5 e441944d31736373c086848ebc5afd72
BLAKE2b-256 099038a3461f375ed738a039cd5094b60b47029337ab16a3e998b8fb0c4f6fc5

See more details on using hashes here.

File details

Details for the file kkachi-0.1.8-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for kkachi-0.1.8-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 532e5ffc732d95d7eb385540662ef368333ea254f32e5cea234d58e031dec9ab
MD5 c15aeb423cf6f89df1dff7ed9b895f9b
BLAKE2b-256 0997cea77556e62058e41ea0eb7d7ff10da9ff838d8744fa5b8fb15d462cd7ef

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 Pingdom Monitoring Sentry Error logging StatusPage Status page