Skip to content

Commit

Permalink
chore: Added example with retry strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
tazarov committed Jun 11, 2024
1 parent 2e3c30f commit 809c5d9
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions examples/basic_functionality/http_client_with_retries.ipynb
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
}

0 comments on commit 809c5d9

Please sign in to comment.