-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Added example with retry strategy
- Loading branch information
Showing
1 changed file
with
61 additions
and
0 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
examples/basic_functionality/http_client_with_retries.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"metadata": {}, | ||
"cell_type": "markdown", | ||
"source": [ | ||
"This example assumes you have a Chroma server running on localhost port 8000.\n", | ||
"\n", | ||
"To start a Chroma server you can run the following:\n", | ||
"\n", | ||
"```bash\n", | ||
"docker run --it --rm -p 8000:8000 chromadb/chroma:latest\n", | ||
"```\n" | ||
], | ||
"id": "3774bc1ccb0d9f2f" | ||
}, | ||
{ | ||
"metadata": {}, | ||
"cell_type": "code", | ||
"source": [ | ||
"import chromadb\n", | ||
"\n", | ||
"# we configure retry strategy that will retry 5 times with a backoff factor of 0.5\n", | ||
"# for more details on RetryStrategy defaults see chromadb.utils.net.RetryStrategy\n", | ||
"client = chromadb.HttpClient(host='localhost', port=8000, retry=chromadb.RetryStrategy(total=5, backoff_factor=0.5))" | ||
], | ||
"id": "initial_id", | ||
"outputs": [], | ||
"execution_count": null | ||
}, | ||
{ | ||
"metadata": {}, | ||
"cell_type": "code", | ||
"source": "", | ||
"id": "35bb827819d168fb", | ||
"outputs": [], | ||
"execution_count": null | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.6" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |