Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ChromaDB Context Tool

A command-line tool for managing document collections in ChromaDB to provide relevant context for LLMs.

This tool is used to inject context into LLMs and agents like Aider. It could also be used with

Features

  • Create, list, and delete ChromaDB collections
  • Upload documents from directories
  • Query collections for relevant text chunks
  • Inject context directly into LLM prompts

Requirements

  • uv

Installation and Usage

Note

One can also install with:

uv tool install --force git+https://github.com/ryangreenup/chroma_query
  1. git clone

  2. just serve

  3. Make a collection 3. uv run -- python main.py mk my-docs

  4. Upload Docs 3. uv run -- python main.py upload my-docs /path/to/docs

  5. Query Docs 3. uv run -- python main.py query my-docs 'Some Search Term'

  6. Use from Aider. The default chunk size is 1000 tokens (ideal for embedding), so 2 results is 2000 tokens off the context window 3. /run uv run -- python main.py query my-docs 'Some Search Term' --n-results 2 --inject

  7. Make aliases whilst running a project

alias cs-ark="chroma-search --host localhost --port 8000 query 'web.components.ark' --n-results 2 --inject"
alias cs="chroma-search --host localhost --port 8000"

Usage

Collection Management

# Create a collection
python main.py mk "collection_name"

# List all collections
python main.py ls

# Delete a collection
python main.py rm "collection_name"

How It Works

  1. Documents are split into chunks of size upload --chunk-size
  2. Chunks are stored in ChromaDB with metadata
  3. Chroma's default semantic search finds relevant chunks for queries
  4. Results can be injected into Aider

Examples

See the justfile for example commands:

just example-create-collection
just example-upload-docs
just example-query-docs

Development

# Format code
just fmt

# Type check
just check

Potetntial Improvements

Footnotes

  1. https://huggingface.co/spaces/mteb/leaderboard

  2. https://ollama.com/blog/embedding-models

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages