Skip to content

Commit

Permalink
[USAGE][Examples]
Browse files Browse the repository at this point in the history
  • Loading branch information
Kye Gomez authored and Kye Gomez committed Jul 8, 2024
1 parent 32e53cd commit 5bd4b4b
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,29 @@ if __name__ == "__main__":


### ChromaDB
```
```python
from swarms_memory import ChromaDB

chromadb = ChromaDB(
metric="cosine",
output_dir="results",
limit_tokens=1000,
n_results=2,
docs_folder="path/to/docs",
verbose=True,
)

# Add a document
doc_id = chromadb.add("This is a test document.")

# Query the document
result = chromadb.query("This is a test query.")

# Traverse a directory
chromadb.traverse_directory()

# Display the result
print(result)

```

Expand Down
22 changes: 22 additions & 0 deletions chroma_db.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from swarms_memory import ChromaDB

chromadb = ChromaDB(
metric="cosine",
output_dir="results",
limit_tokens=1000,
n_results=2,
docs_folder="path/to/docs",
verbose=True,
)

# Add a document
doc_id = chromadb.add("This is a test document.")

# Query the document
result = chromadb.query("This is a test query.")

# Traverse a directory
chromadb.traverse_directory()

# Display the result
print(result)
Empty file removed example.py
Empty file.

0 comments on commit 5bd4b4b

Please sign in to comment.