cognee/level_3
2023-10-31 11:45:22 +01:00
..
.data Update docs, fix issue with params, add tracking 2023-10-31 00:29:45 +01:00
.dlt Added embeddings as an option, added different types of text search 2023-10-09 20:16:34 +02:00
auth Updated and tested retry logic, still more to be done 2023-10-08 21:23:30 +02:00
buffer Updated and tested retry logic, still more to be done 2023-10-08 22:16:06 +02:00
cognitive_memory Updated and tested retry logic, still more to be done 2023-10-08 21:23:30 +02:00
database Added docs functionality 2023-10-29 19:11:20 +01:00
example_data Add base SQL query, rework docs a bit 2023-10-31 11:45:22 +01:00
models Added docs functionality 2023-10-29 19:11:20 +01:00
scripts Added docs functionality 2023-10-29 19:11:20 +01:00
shared Updated and tested retry logic, still more to be done 2023-10-08 21:23:30 +02:00
superset fixes to chunking logic and optimizations 2023-10-28 20:02:09 +02:00
tests Updated and tested retry logic, still more to be done 2023-10-08 21:23:30 +02:00
vectordb Update docs, fix issue with params, add tracking 2023-10-31 00:29:45 +01:00
.env.template Update docs, fix issue with params, add tracking 2023-10-30 21:21:26 +01:00
__init__.py Updated and tested retry logic, still more to be done 2023-10-08 21:23:30 +02:00
api.py Added docs functionality 2023-10-30 09:17:38 +01:00
create_database.py Added docs functionality 2023-10-29 19:11:20 +01:00
docker-compose.yml Update docs, fix issue with params, add tracking 2023-10-31 00:29:45 +01:00
Dockerfile Added docs functionality 2023-10-29 19:11:20 +01:00
entrypoint.sh Added docs functionality 2023-10-29 19:11:20 +01:00
fetch_secret.py Added following: 2023-10-04 21:52:35 +02:00
poetry.lock Update docs, fix issue with params, add tracking 2023-10-31 00:29:45 +01:00
pyproject.toml Update docs, fix issue with params, add tracking 2023-10-31 00:29:45 +01:00
rag_test_manager.py Update docs, fix issue with params, add tracking 2023-10-31 00:29:45 +01:00
Readme.md Update docs, fix issue with params, add tracking 2023-10-31 00:29:45 +01:00
utils.py Added following: 2023-10-04 21:52:35 +02:00
vectorstore_manager.py Added a few fixes and refactored the base app 2023-10-27 11:11:22 +02:00
wait-for-it.sh Added docs functionality 2023-10-29 19:11:20 +01:00

Docker:

Copy the .env.template to .env and fill in the variables Specify the environment variable in the .env file to "docker"

Launch the docker image:

docker compose up promethai_mem

Send the request to the API:

curl -X POST -H "Content-Type: application/json" -d '{
  "payload": {
    "user_id": "97980cfea0067",
    "data": [".data/3ZCCCW.pdf"],
    "test_set": "sample",
    "params": ["chunk_size"],
    "metadata": "sample",
    "retriever_type": "single_document_context"
  }
}' http://0.0.0.0:8000/rag-test/rag_test_run
 

Params:

  • data -> list of URLs or path to the file, located in the .data folder (pdf, docx, txt, html)
  • test_set -> sample, manual (list of questions and answers)
  • metadata -> sample, manual (json) or version (in progress)
  • params -> chunk_size, chunk_overlap, search_type (hybrid, bm25), embeddings
  • retriever_type -> llm_context, single_document_context, multi_document_context, cognitive_architecture(coming soon)

Inspect the results in the DB:

docker exec -it postgres psql -U bla

\c bubu

select * from test_outputs;

Or set up the superset to visualize the results:

Poetry environment:

Copy the .env.template to .env and fill in the variables Specify the environment variable in the .env file to "local"

Use the poetry environment:

poetry shell

Change the .env file Environment variable to "local"

Launch the postgres DB

docker compose up postgres

Launch the superset

docker compose up superset

Open the superset in your browser

http://localhost:8088 Add the Postgres datasource to the Superset with the following connection string:

postgres://bla:bla@postgres:5432/bubu

Make sure to run to initialize DB tables

python scripts/create_database.py

After that, you can run the RAG test manager from your command line.

    python rag_test_manager.py \
    --file ".data" \
    --test_set "example_data/test_set.json" \
    --user_id "97980cfea0067" \
    --params "chunk_size" "search_type" \
    --metadata "example_data/metadata.json" \
    --retriever_type "single_document_context"

Examples of metadata structure and test set are in the folder "example_data"

python rag_test_manager.py \
--file ".data" \
--test_set "example_data/test_set.json" \
--user_id "97980cfea0067" \
--params "chunk_size" "search_type" \
--metadata "example_data/metadata.json" \
--retriever_type "llm_context"


python rag_test_manager.py \
--file ".data" \
--test_set "example_data/test_set.json" \
--user_id "97980cfea0068" \
--params "chunk_size" "search_type", "overlap" \
--metadata "example_data/metadata.json" \
--retriever_type "single_document_context"