new version compatible
Browse files- ChromaDBFlow.yaml +1 -0
- VectorStoreFlow.yaml +1 -0
- run.py +20 -27
ChromaDBFlow.yaml
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
name: chroma_db
|
| 2 |
description: ChromaDB is a document store that uses vector embeddings to store and retrieve documents
|
|
|
|
| 3 |
|
| 4 |
backend:
|
| 5 |
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
|
|
|
| 1 |
name: chroma_db
|
| 2 |
description: ChromaDB is a document store that uses vector embeddings to store and retrieve documents
|
| 3 |
+
_target_: flow_modules.aiflows.VectorStoreFlowModule.ChromaDBFlow.instantiate_from_default_config
|
| 4 |
|
| 5 |
backend:
|
| 6 |
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
VectorStoreFlow.yaml
CHANGED
|
@@ -1,5 +1,6 @@
|
|
| 1 |
name: "VectorStoreFlow"
|
| 2 |
description: "VectorStoreFlow"
|
|
|
|
| 3 |
|
| 4 |
backend:
|
| 5 |
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
|
|
|
| 1 |
name: "VectorStoreFlow"
|
| 2 |
description: "VectorStoreFlow"
|
| 3 |
+
_target_: flow_modules.aiflows.VectorStoreFlowModule.VectorStoreFlow.instantiate_from_default_config
|
| 4 |
|
| 5 |
backend:
|
| 6 |
_target_: aiflows.backends.llm_lite.LiteLLMBackend
|
run.py
CHANGED
|
@@ -33,7 +33,6 @@ flow_verse.sync_dependencies(dependencies)
|
|
| 33 |
if __name__ == "__main__":
|
| 34 |
|
| 35 |
#1. ~~~~~ Set up a colink server ~~~~
|
| 36 |
-
FLOW_MODULES_PATH = "./"
|
| 37 |
|
| 38 |
cl = start_colink_server()
|
| 39 |
|
|
@@ -58,48 +57,42 @@ if __name__ == "__main__":
|
|
| 58 |
|
| 59 |
|
| 60 |
#3. ~~~~ Serve The Flow ~~~~
|
| 61 |
-
serve_utils.
|
| 62 |
cl = cl,
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
default_state=None,
|
| 66 |
-
default_dispatch_point="coflows_dispatch"
|
| 67 |
)
|
| 68 |
|
| 69 |
#4. ~~~~~Start A Worker Thread~~~~~
|
| 70 |
-
run_dispatch_worker_thread(cl
|
|
|
|
| 71 |
|
| 72 |
#5 ~~~~~Mount the flow and get its proxy~~~~~~
|
| 73 |
-
proxy_flow_cdb
|
| 74 |
cl=cl,
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
config_overrides=
|
| 78 |
-
|
| 79 |
-
dispatch_point_override=None,
|
| 80 |
-
)
|
| 81 |
|
| 82 |
#3.(2) ~~~~ Serve The Flow ~~~~
|
| 83 |
-
serve_utils.
|
| 84 |
cl = cl,
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
default_state=None,
|
| 88 |
-
default_dispatch_point="coflows_dispatch"
|
| 89 |
)
|
|
|
|
| 90 |
|
| 91 |
#4.(2) ~~~~~Start A Worker Thread~~~~~
|
| 92 |
-
run_dispatch_worker_thread(cl
|
| 93 |
|
| 94 |
#5.(2) ~~~~~Mount the flow and get its proxy~~~~~~
|
| 95 |
-
proxy_flow_vs
|
| 96 |
cl=cl,
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
config_overrides=
|
| 100 |
-
|
| 101 |
-
dispatch_point_override=None,
|
| 102 |
-
)
|
| 103 |
|
| 104 |
#6. ~~~ Get the data ~~~
|
| 105 |
data_write = {"id": 0, "operation": "write", "content": "The capital of Switzerland is Bern"} # Add your data here
|
|
|
|
| 33 |
if __name__ == "__main__":
|
| 34 |
|
| 35 |
#1. ~~~~~ Set up a colink server ~~~~
|
|
|
|
| 36 |
|
| 37 |
cl = start_colink_server()
|
| 38 |
|
|
|
|
| 57 |
|
| 58 |
|
| 59 |
#3. ~~~~ Serve The Flow ~~~~
|
| 60 |
+
serve_utils.serve_flow(
|
| 61 |
cl = cl,
|
| 62 |
+
flow_class_name="flow_modules.aiflows.VectorStoreFlowModule.ChromaDBFlow",
|
| 63 |
+
flow_endpoint="ChromaDBFlow",
|
|
|
|
|
|
|
| 64 |
)
|
| 65 |
|
| 66 |
#4. ~~~~~Start A Worker Thread~~~~~
|
| 67 |
+
run_dispatch_worker_thread(cl)
|
| 68 |
+
|
| 69 |
|
| 70 |
#5 ~~~~~Mount the flow and get its proxy~~~~~~
|
| 71 |
+
proxy_flow_cdb= serve_utils.get_flow_instance(
|
| 72 |
cl=cl,
|
| 73 |
+
flow_endpoint="ChromaDBFlow",
|
| 74 |
+
user_id="local",
|
| 75 |
+
config_overrides = cfg["chroma_demo_flow"]
|
| 76 |
+
)
|
|
|
|
|
|
|
| 77 |
|
| 78 |
#3.(2) ~~~~ Serve The Flow ~~~~
|
| 79 |
+
serve_utils.serve_flow(
|
| 80 |
cl = cl,
|
| 81 |
+
flow_class_name="flow_modules.aiflows.VectorStoreFlowModule.VectorStoreFlow",
|
| 82 |
+
flow_endpoint="VectorStoreFlow",
|
|
|
|
|
|
|
| 83 |
)
|
| 84 |
+
|
| 85 |
|
| 86 |
#4.(2) ~~~~~Start A Worker Thread~~~~~
|
| 87 |
+
run_dispatch_worker_thread(cl)
|
| 88 |
|
| 89 |
#5.(2) ~~~~~Mount the flow and get its proxy~~~~~~
|
| 90 |
+
proxy_flow_vs= serve_utils.get_flow_instance(
|
| 91 |
cl=cl,
|
| 92 |
+
flow_endpoint="VectorStoreFlow",
|
| 93 |
+
user_id="local",
|
| 94 |
+
config_overrides = cfg["vector_store_demo_flow"]
|
| 95 |
+
)
|
|
|
|
|
|
|
| 96 |
|
| 97 |
#6. ~~~ Get the data ~~~
|
| 98 |
data_write = {"id": 0, "operation": "write", "content": "The capital of Switzerland is Bern"} # Add your data here
|