llama-index packs chroma_autoretrieval integration
Project description
Chroma AutoRetrieval Pack
This LlamaPack inserts your data into chroma and instantiates an auto-retriever, which will use the LLM at runtime to set metadata filtering, top-k, and query string.
CLI Usage
You can download llamapacks directly using llamaindex-cli
, which comes installed with the llama-index
python package:
llamaindex-cli download-llamapack ChromaAutoretrievalPack --download-dir ./chroma_pack
You can then inspect the files at ./chroma_pack
and use them as a template for your own project!
Code Usage
You can download the pack to a the ./chroma_pack
directory:
from llama_index.core.llama_pack import download_llama_pack
# download and install dependencies
ChromaAutoretrievalPack = download_llama_pack(
"ChromaAutoretrievalPack", "./chroma_pack"
)
From here, you can use the pack, or inspect and modify the pack in ./chroma_pack
.
Then, you can set up the pack like so:
# setup pack arguments
from llama_index.core.vector_stores.types import MetadataInfo, VectorStoreInfo
vector_store_info = VectorStoreInfo(
content_info="brief biography of celebrities",
metadata_info=[
MetadataInfo(
name="category",
type="str",
description=(
"Category of the celebrity, one of [Sports Entertainment, Business, Music]"
),
),
],
)
import chromadb
client = chromadb.EphemeralClient()
nodes = [...]
# create the pack
chroma_pack = ChromaAutoretrievalPack(
collection_name="test",
vector_store_info=vector_store_index,
nodes=nodes,
client=client,
)
The run()
function is a light wrapper around query_engine.query()
.
response = chroma_pack.run("Tell me a bout a Music celebritiy.")
You can also use modules individually.
# use the retriever
retriever = chroma_pack.retriever
nodes = retriever.retrieve("query_str")
# use the query engine
query_engine = chroma_pack.query_engine
response = query_engine.query("query_str")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for llama_index_packs_chroma_autoretrieval-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50ab76ed3bd5ae7b5872b029352f285da43160860cc750c8c03cb767d10aa914 |
|
MD5 | fa78ae224ec26ce0e0569c7411fdce49 |
|
BLAKE2b-256 | 54e5c0d51b1bcbd002e13cc467fdc38360d4f26b3e222f5ba9eba940420320aa |
Hashes for llama_index_packs_chroma_autoretrieval-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f5aa5593c84ad6d6a09cb063c812a500314d617f3c99f55b7dce949461ba556 |
|
MD5 | 4d86d5d36ffe3fbdd412cc182f106105 |
|
BLAKE2b-256 | cbda67f34530e694f6882acafa7f262638f60551dbd6d6f140fcd8a661a32e1b |