Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 20240910 importdocs (python) script #16

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*.py]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,9 @@ node_modules
*.bin
*.sqlite3
chroma.log

# Python temporary files and folders
__pycache__/

# Python venv folders
.venv/
6 changes: 4 additions & 2 deletions 2024-09-10-buildrag/python/importdocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
textdocspath = "../../scripts"
text_data = readtextfiles(textdocspath)

collection = chromaclient.get_or_create_collection(name="buildragwithpython", metadata={"hnsw:space": "cosine"} )
collectionname = "buildragwithpython"
# remove existing collection of the name to re-import every time
if any(collection.name == collectionname for collection in chromaclient.list_collections()):
chromaclient.delete_collection("buildragwithpython")
chromaclient.delete_collection(collectionname)
collection = chromaclient.get_or_create_collection(name=collectionname, metadata={"hnsw:space": "cosine"} )

for filename, text in text_data.items():
chunks = chunksplitter(text)
Expand Down
5 changes: 2 additions & 3 deletions 2024-09-10-buildrag/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
chromadb
os
re
ollama>=0.4.1
chromadb>=0.5.20