Skip to content

Commit 20562c4

Browse files
committed
Merge branch 'main' of github.com:chasecadet/tiledb_demo
2 parents 3a50390 + d78507d commit 20562c4

15 files changed

+603
-38
lines changed

.DS_Store

0 Bytes
Binary file not shown.
-1.53 MB
Loading

dockerfiles/frontend/images/logo.png

-2.11 MB
Loading

notebooks/.ipynb_checkpoints/Tiledb_doc_prep-checkpoint.ipynb

Lines changed: 39 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 15,
5+
"execution_count": 51,
66
"id": "f35f0324-b068-41f6-86d7-0aae90c3e9a6",
77
"metadata": {
88
"tags": []
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": null,
19+
"execution_count": 52,
2020
"id": "65a9f4c2-66e8-4681-a55a-eb3594cb295f",
2121
"metadata": {},
2222
"outputs": [],
@@ -30,19 +30,30 @@
3030
},
3131
{
3232
"cell_type": "code",
33-
"execution_count": null,
33+
"execution_count": 53,
3434
"id": "dd65419c-d9eb-4e3b-8290-c388cba5252b",
3535
"metadata": {
3636
"tags": []
3737
},
38-
"outputs": [],
38+
"outputs": [
39+
{
40+
"data": {
41+
"text/plain": [
42+
"minio.api.Minio"
43+
]
44+
},
45+
"execution_count": 53,
46+
"metadata": {},
47+
"output_type": "execute_result"
48+
}
49+
],
3950
"source": [
4051
"type(client)"
4152
]
4253
},
4354
{
4455
"cell_type": "code",
45-
"execution_count": null,
56+
"execution_count": 54,
4657
"id": "490acd9d-ad92-4d55-800d-c0ffa8697da3",
4758
"metadata": {
4859
"tags": []
@@ -54,7 +65,7 @@
5465
},
5566
{
5667
"cell_type": "code",
57-
"execution_count": null,
68+
"execution_count": 62,
5869
"id": "7c9a9322-825d-4881-8f87-4868fbdcbb5c",
5970
"metadata": {
6071
"tags": []
@@ -63,6 +74,10 @@
6374
"source": [
6475
"def upload_files(bucket_name, file_location, client):\n",
6576
" found = False # Initialize 'found' before the try block\n",
77+
" print(\"Current working directory:\", os.getcwd())\n",
78+
" print(\"Listing directories in the current working directory:\", os.listdir(\".\"))\n",
79+
" print(f\"Checking existence of {file_location}: \", os.path.exists(file_location))\n",
80+
"\n",
6681
" try:\n",
6782
" found = client.bucket_exists(bucket_name)\n",
6883
" except Exception as e:\n",
@@ -100,12 +115,21 @@
100115
},
101116
{
102117
"cell_type": "code",
103-
"execution_count": null,
118+
"execution_count": 61,
104119
"id": "096fceeb-e788-463f-88c2-274457020b3b",
105120
"metadata": {
106121
"tags": []
107122
},
108-
"outputs": [],
123+
"outputs": [
124+
{
125+
"name": "stdout",
126+
"output_type": "stream",
127+
"text": [
128+
"Bucket newtiledb exists, we won't attempt to create one\n",
129+
"The directory documentation does not exist.\n"
130+
]
131+
}
132+
],
109133
"source": [
110134
"upload_files(bucket_name,\"documentation\",client)"
111135
]
@@ -154,7 +178,7 @@
154178
},
155179
{
156180
"cell_type": "code",
157-
"execution_count": 34,
181+
"execution_count": 44,
158182
"id": "0ceb5821-adec-4804-b029-62f6000ef01c",
159183
"metadata": {
160184
"tags": []
@@ -166,7 +190,7 @@
166190
},
167191
{
168192
"cell_type": "code",
169-
"execution_count": 35,
193+
"execution_count": 49,
170194
"id": "e2560e8f-1d9f-4016-8b97-d1d226a1bce9",
171195
"metadata": {
172196
"tags": []
@@ -190,7 +214,7 @@
190214
},
191215
{
192216
"cell_type": "code",
193-
"execution_count": 36,
217+
"execution_count": 50,
194218
"id": "eb3fc990-6a89-4fe6-b4bb-772c0015723a",
195219
"metadata": {
196220
"tags": []
@@ -200,8 +224,8 @@
200224
"name": "stdout",
201225
"output_type": "stream",
202226
"text": [
203-
"<Response [500]>\n",
204-
"{\"error\":\"ConnectionError : HTTPSConnectionPool(host='vectorstore-predictor-default.christensenc3526.svc.cluster.local', port=443): Max retries exceeded with url: /v1/models/vectorstore:predict (Caused by NameResolutionError(\\\"<urllib3.connection.HTTPSConnection object at 0x7b09481b5510>: Failed to resolve 'vectorstore-predictor-default.christensenc3526.svc.cluster.local' ([Errno -2] Name or service not known)\\\"))\"}\n"
227+
"<Response [200]>\n",
228+
"{\"predictions\":[\"TileDB is not a vector store, but rather an open-source database that stores geospatial data in multidimensional arrays. It was designed to organize data into high-dimensional arrays, making it easier to query and analyze large datasets with\"]}\n"
205229
]
206230
}
207231
],
@@ -214,12 +238,10 @@
214238
{
215239
"cell_type": "code",
216240
"execution_count": null,
217-
"id": "dea66ae5-f668-460e-9669-f7177a414369",
241+
"id": "f65b0d34-eeb4-44d3-be3e-98d033db8a58",
218242
"metadata": {},
219243
"outputs": [],
220-
"source": [
221-
"vectorstore-predictor"
222-
]
244+
"source": []
223245
}
224246
],
225247
"metadata": {

notebooks/Tiledb_doc_prep.ipynb

Lines changed: 73 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 15,
5+
"execution_count": 74,
66
"id": "f35f0324-b068-41f6-86d7-0aae90c3e9a6",
77
"metadata": {
88
"tags": []
@@ -16,7 +16,7 @@
1616
},
1717
{
1818
"cell_type": "code",
19-
"execution_count": null,
19+
"execution_count": 75,
2020
"id": "65a9f4c2-66e8-4681-a55a-eb3594cb295f",
2121
"metadata": {},
2222
"outputs": [],
@@ -30,19 +30,30 @@
3030
},
3131
{
3232
"cell_type": "code",
33-
"execution_count": null,
33+
"execution_count": 76,
3434
"id": "dd65419c-d9eb-4e3b-8290-c388cba5252b",
3535
"metadata": {
3636
"tags": []
3737
},
38-
"outputs": [],
38+
"outputs": [
39+
{
40+
"data": {
41+
"text/plain": [
42+
"minio.api.Minio"
43+
]
44+
},
45+
"execution_count": 76,
46+
"metadata": {},
47+
"output_type": "execute_result"
48+
}
49+
],
3950
"source": [
4051
"type(client)"
4152
]
4253
},
4354
{
4455
"cell_type": "code",
45-
"execution_count": null,
56+
"execution_count": 77,
4657
"id": "490acd9d-ad92-4d55-800d-c0ffa8697da3",
4758
"metadata": {
4859
"tags": []
@@ -54,7 +65,7 @@
5465
},
5566
{
5667
"cell_type": "code",
57-
"execution_count": null,
68+
"execution_count": 78,
5869
"id": "7c9a9322-825d-4881-8f87-4868fbdcbb5c",
5970
"metadata": {
6071
"tags": []
@@ -63,6 +74,10 @@
6374
"source": [
6475
"def upload_files(bucket_name, file_location, client):\n",
6576
" found = False # Initialize 'found' before the try block\n",
77+
" print(\"Current working directory:\", os.getcwd())\n",
78+
" print(\"Listing directories in the current working directory:\", os.listdir(\".\"))\n",
79+
" print(f\"Checking existence of {file_location}: \", os.path.exists(file_location))\n",
80+
"\n",
6681
" try:\n",
6782
" found = client.bucket_exists(bucket_name)\n",
6883
" except Exception as e:\n",
@@ -100,14 +115,35 @@
100115
},
101116
{
102117
"cell_type": "code",
103-
"execution_count": null,
118+
"execution_count": 84,
104119
"id": "096fceeb-e788-463f-88c2-274457020b3b",
105120
"metadata": {
106121
"tags": []
107122
},
108-
"outputs": [],
123+
"outputs": [
124+
{
125+
"name": "stdout",
126+
"output_type": "stream",
127+
"text": [
128+
"Current working directory: /home/jovyan\n",
129+
"Listing directories in the current working directory: ['tmp_docs', '.gitconfig', '.mc', 'lost+found', '.local', '.conda', '.cache', '.bashrc', 'tiledb_demo', 'minio-binaries', '.ipynb_checkpoints', 'ezua-tutorials', 'tiledb_index', '.ipython', '.kube', '.jupyter', 'db_index.zip', '.bash_history']\n",
130+
"Checking existence of tiledb_demo/notebooks/documentation: True\n",
131+
"Bucket newtiledb exists, we won't attempt to create one\n",
132+
"Successfully uploaded tiledb_vector.txt to bucket newtiledb.\n",
133+
"Successfully uploaded vector_database.txt to bucket newtiledb.\n",
134+
"Successfully uploaded tiledb.txt to bucket newtiledb.\n",
135+
"Successfully uploaded why_tile_blog.txt to bucket newtiledb.\n",
136+
"Successfully uploaded RAG.txt to bucket newtiledb.\n",
137+
"Successfully uploaded array_db.txt to bucket newtiledb.\n",
138+
"Successfully uploaded human_in_loop.txt to bucket newtiledb.\n",
139+
"Successfully uploaded embedding.txt to bucket newtiledb.\n",
140+
"Successfully uploaded feature_store.txt to bucket newtiledb.\n",
141+
"Successfully uploaded LLM.txt to bucket newtiledb.\n"
142+
]
143+
}
144+
],
109145
"source": [
110-
"upload_files(bucket_name,\"documentation\",client)"
146+
"upload_files(bucket_name,\"tiledb_demo/notebooks/documentation\",client)"
111147
]
112148
},
113149
{
@@ -120,7 +156,15 @@
120156
},
121157
{
122158
"cell_type": "code",
123-
"execution_count": 25,
159+
"execution_count": null,
160+
"id": "f33c4897-feeb-4499-bcca-977cb44f0949",
161+
"metadata": {},
162+
"outputs": [],
163+
"source": []
164+
},
165+
{
166+
"cell_type": "code",
167+
"execution_count": 107,
124168
"id": "8e5db8c5-b83c-493b-af9a-f85eacd4a034",
125169
"metadata": {
126170
"tags": []
@@ -131,15 +175,14 @@
131175
"output_type": "stream",
132176
"text": [
133177
"<Response [200]>\n",
134-
"{'predictions': ['Vector databases are specialized storage systems designed to efficiently store and query high-dimensional vector data, often used in machine learning, artificial intelligence, and similarity search applications. This section introduces the concept of vector databases, their importance in enabling fast and scalable vector similarity searches, and typical use cases such as image and text retrieval, and recommendation systems.\\n2. Getting Started with Vector Databases', 'Vector Databases Documentation\\n1. Introduction to Vector Databases', 'This guide provides a step-by-step introduction to working with vector databases, including setting up your first vector database, inserting and indexing vector data, and performing similarity searches. Through practical examples, learn the basics of vector storage, querying techniques, and how to integrate vector databases into your data pipeline.\\n3. Vector Database Architecture and Indexing Techniques', 'Understand the underlying architecture of vector databases and the indexing techniques they use to enable efficient similarity searches. This section dives into the algorithms and data structures, such as k-NN graph and HNSW (Hierarchical Navigable Small World), that power vector databases, explaining how they work and their trade-offs.\\n4. Advanced Querying and Analytics with Vector Databases']}\n",
135-
"{\"predictions\":[\"Vector databases are specialized storage systems designed to efficiently store and query high-dimensional vector data, often used in machine learning, artificial intelligence, and similarity search applications. This section introduces the concept of vector databases, their importance in enabling fast and scalable vector similarity searches, and typical use cases such as image and text retrieval, and recommendation systems.\\n2. Getting Started with Vector Databases\",\"Vector Databases Documentation\\n1. Introduction to Vector Databases\",\"This guide provides a step-by-step introduction to working with vector databases, including setting up your first vector database, inserting and indexing vector data, and performing similarity searches. Through practical examples, learn the basics of vector storage, querying techniques, and how to integrate vector databases into your data pipeline.\\n3. Vector Database Architecture and Indexing Techniques\",\"Understand the underlying architecture of vector databases and the indexing techniques they use to enable efficient similarity searches. This section dives into the algorithms and data structures, such as k-NN graph and HNSW (Hierarchical Navigable Small World), that power vector databases, explaining how they work and their trade-offs.\\n4. Advanced Querying and Analytics with Vector Databases\"]}\n"
178+
"{\"predictions\":[\"In summary, TileDB's architecture and features make it an excellent choice for managing vector data, especially in scenarios requiring scalability, performance, and flexibility in data management. Its ability to handle various data types, combined with efficient storage, querying capabilities, and cloud-native support, positions it as a versatile and powerful vector store solution.\",\"TileDB is an array database, and its main strength is that it can morph into practically any data modality and application, delivering unprecedented performance and alleviating the data infrastructure in an organization. A vector is simply a 1D array, therefore, TileDB is the most natural database choice for delivering amazing vector search functionality.\",\"TileDB is designed as a universal data management solution, which means it can handle a wide variety of data types, including tabular, sparse, and dense multi-dimensional array data. When considering TileDB as a vector store, several features and characteristics make it a strong candidate:\",\"I am assuming that you find all this awesome, but I bet you’d like to see how TileDB compares to the increasingly crowded vector database market, as well as where this leads, with TileDB being a universal database and all. Read on! :)\\nDifferentiation of TileDB\"]}\n"
136179
]
137180
}
138181
],
139182
"source": [
140183
"data = {\n",
141184
" \"instances\": [{\n",
142-
" \"input\": \"what are vectors\",\n",
185+
" \"input\": \"What makes tiledb a good vector store?\",\n",
143186
" \"num_docs\": 4 # number of documents to retrieve\n",
144187
" }]\n",
145188
"}\n",
@@ -148,13 +191,13 @@
148191
"\n",
149192
"response = requests.post(URL, json=data, verify=False) # 'verify=False' for self-signed certs\n",
150193
"print(response)\n",
151-
"print(response.json())\n",
194+
"#print(response.json())\n",
152195
"print(response.text)"
153196
]
154197
},
155198
{
156199
"cell_type": "code",
157-
"execution_count": 44,
200+
"execution_count": 113,
158201
"id": "0ceb5821-adec-4804-b029-62f6000ef01c",
159202
"metadata": {
160203
"tags": []
@@ -166,7 +209,7 @@
166209
},
167210
{
168211
"cell_type": "code",
169-
"execution_count": null,
212+
"execution_count": 114,
170213
"id": "e2560e8f-1d9f-4016-8b97-d1d226a1bce9",
171214
"metadata": {
172215
"tags": []
@@ -177,11 +220,11 @@
177220
" \"instances\": [{\n",
178221
" \"system\": \"You are an AI assistant. You will be given a task. You must generate a detailed answer.\",\n",
179222
" \"instruction\": \"Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\",\n",
180-
" \"input\": \"Is TileDB a good vector store?\",\n",
181-
" \"max_tokens\": 50,\n",
223+
" \"input\": \"what part of tiledbs architecture makes it a good choice for a vectorstore?\",\n",
224+
" \"max_tokens\": 5000,\n",
182225
" \"top_k\": 100,\n",
183226
" \"top_p\": 0.4,\n",
184-
" \"num_docs\": 1,\n",
227+
" \"num_docs\": 3,\n",
185228
" \"temperature\": 0.2\n",
186229
" }]\n",
187230
"}\n",
@@ -190,12 +233,21 @@
190233
},
191234
{
192235
"cell_type": "code",
193-
"execution_count": null,
236+
"execution_count": 115,
194237
"id": "eb3fc990-6a89-4fe6-b4bb-772c0015723a",
195238
"metadata": {
196239
"tags": []
197240
},
198-
"outputs": [],
241+
"outputs": [
242+
{
243+
"name": "stdout",
244+
"output_type": "stream",
245+
"text": [
246+
"<Response [200]>\n",
247+
"{\"predictions\":[\"TileDB's architecture and features make it an excellent choice for managing vector data due to its ability to handle various data types, efficient storage, querying capabilities, and cloud-native support. TileDB is designed as a universal data management solution that can handle tabular, sparse, and dense multi-dimensional array data, making it the most natural database choice for delivering amazing vector search functionality. Additionally, TileDB's ability to morph into practically any data modality and application makes it a versatile and powerful vector store solution. Therefore, TileDB is an excellent choice for managing vector data in scenarios requiring scalability, performance, and flexibility in data management.\"]}\n"
248+
]
249+
}
250+
],
199251
"source": [
200252
"print(response)\n",
201253
"#print(response.json())\n",

notebooks/documentation/.ipynb_checkpoints/RAG-checkpoint.txt

Whitespace-only changes.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Given the comprehensive details provided about your demo, including the integration of KServe, TileDB, FastAPI, Gradio, and the deployment configuration via Kubernetes manifests, your application represents a state-of-the-art machine learning solution that leverages the best practices and tools available for modern, scalable, and interactive AI applications. Here's a robust summary of your demo:
2+
3+
### Application Overview
4+
5+
Your demo is a sophisticated NLP application that enables users to interact with a large language model (LLM) for generating contextually aware responses to queries. It integrates several advanced components:
6+
7+
- **KServe for Model Serving**: Utilizes KServe to serve the machine learning models, including a transformer model for context retrieval from a vector database and an LLM model for generating responses.
8+
- **TileDB for Data Management**: Employs TileDB to efficiently manage and query large-scale, multi-dimensional data, including storing vector embeddings for the transformer model.
9+
- **FastAPI & Gradio for User Interaction**: Leverages FastAPI as the backend framework to handle API requests and Gradio to provide an intuitive, interactive web interface for users to input queries and receive responses.
10+
- **Kubernetes, Kubeflow, and Istio for Orchestration and Traffic Management**: Deploys and orchestrates the entire application on Kubernetes, using Kubeflow for managing machine learning workflows and Istio for advanced traffic routing and security.
11+
12+
### Detailed Workflow and Integration
13+
14+
1. **User Interaction Layer**: Users interact with the application through a Gradio interface, which allows for the easy submission of queries and displays the generated responses. This interface is accessible via a web browser and is designed to be user-friendly, lowering the barrier to entry for interacting with complex NLP models.
15+
16+
2. **Backend Processing**: Upon receiving a query from the user through the Gradio interface, FastAPI handles the request and may first route it to the transformer model for context retrieval. This transformer model, served by KServe, fetches relevant context from the vector database managed by TileDB, enhancing the query with additional information to improve the quality of the response.
17+
18+
3. **Response Generation**: The enriched query is then forwarded to the LLM model, also served by KServe, which generates a contextually aware response based on the input and retrieved context. The LLM model, powered by GPT-4All or a similar advanced NLP model, ensures high-quality, coherent responses.
19+
20+
4. **Data Management with TileDB**: TileDB plays a crucial role in managing the vector embeddings and potentially other data used by the application. It offers high performance, scalability, and flexibility in handling complex data structures, essential for NLP applications that rely on semantic search and context retrieval.
21+
22+
5. **Deployment and Orchestration**: The application is containerized and deployed on a Kubernetes cluster, ensuring scalability, reliability, and ease of management. Kubeflow orchestrates the machine learning components, simplifying the deployment and management of models. Istio manages network traffic, providing secure, efficient routing of requests within the application and enabling features like canary deployments and A/B testing.
23+
24+
6. **Security and Configuration**: The application is configured to ensure security and proper resource allocation, as demonstrated by the Kubernetes manifests. KServe InferenceServices are configured with appropriate resource requests and limits, and Istio policies are applied for secure access.
25+
26+
### Summary
27+
28+
Your demo showcases an innovative approach to deploying interactive NLP applications at scale. It demonstrates the effective integration of modern machine learning serving frameworks (KServe), data management systems (TileDB), user interface technologies (Gradio), and web frameworks (FastAPI) within a cloud-native environment orchestrated by Kubernetes, Kubeflow, and Istio. This demo not only highlights the capabilities of large language models in processing and responding to natural language queries but also emphasizes the importance of context in generating meaningful responses, achieved through sophisticated data retrieval and processing pipelines.

0 commit comments

Comments
 (0)