v1.1.0
Browse files
run.py
CHANGED
|
@@ -9,7 +9,7 @@ from aiflows.utils.general_helpers import read_yaml_file, quick_load_api_keys
|
|
| 9 |
from aiflows import logging
|
| 10 |
from aiflows.flow_cache import CACHING_PARAMETERS, clear_cache
|
| 11 |
|
| 12 |
-
from aiflows.utils import
|
| 13 |
from aiflows.workers import run_dispatch_worker_thread
|
| 14 |
from aiflows.messages import FlowMessage
|
| 15 |
from aiflows.interfaces import KeyInterface
|
|
@@ -55,7 +55,7 @@ if __name__ == "__main__":
|
|
| 55 |
|
| 56 |
|
| 57 |
#3. ~~~~ Serve The Flow ~~~~
|
| 58 |
-
|
| 59 |
cl=cl,
|
| 60 |
flow_class_name="flow_modules.aiflows.ChatInteractiveFlowModule.ChatHumanFlowModule",
|
| 61 |
flow_endpoint="ChatHumanFlowModule",
|
|
@@ -66,7 +66,7 @@ if __name__ == "__main__":
|
|
| 66 |
run_dispatch_worker_thread(cl)
|
| 67 |
|
| 68 |
#5. ~~~~~Mount the flow and get its proxy~~~~~~
|
| 69 |
-
proxy_flow=
|
| 70 |
cl=cl,
|
| 71 |
flow_endpoint="ChatHumanFlowModule",
|
| 72 |
user_id="local",
|
|
@@ -99,5 +99,5 @@ if __name__ == "__main__":
|
|
| 99 |
|
| 100 |
|
| 101 |
#9. ~~~~~Optional: Unserve Flow~~~~~~
|
| 102 |
-
#
|
| 103 |
|
|
|
|
| 9 |
from aiflows import logging
|
| 10 |
from aiflows.flow_cache import CACHING_PARAMETERS, clear_cache
|
| 11 |
|
| 12 |
+
from aiflows.utils import serving
|
| 13 |
from aiflows.workers import run_dispatch_worker_thread
|
| 14 |
from aiflows.messages import FlowMessage
|
| 15 |
from aiflows.interfaces import KeyInterface
|
|
|
|
| 55 |
|
| 56 |
|
| 57 |
#3. ~~~~ Serve The Flow ~~~~
|
| 58 |
+
serving.recursive_serve_flow(
|
| 59 |
cl=cl,
|
| 60 |
flow_class_name="flow_modules.aiflows.ChatInteractiveFlowModule.ChatHumanFlowModule",
|
| 61 |
flow_endpoint="ChatHumanFlowModule",
|
|
|
|
| 66 |
run_dispatch_worker_thread(cl)
|
| 67 |
|
| 68 |
#5. ~~~~~Mount the flow and get its proxy~~~~~~
|
| 69 |
+
proxy_flow= serving.get_flow_instance(
|
| 70 |
cl=cl,
|
| 71 |
flow_endpoint="ChatHumanFlowModule",
|
| 72 |
user_id="local",
|
|
|
|
| 99 |
|
| 100 |
|
| 101 |
#9. ~~~~~Optional: Unserve Flow~~~~~~
|
| 102 |
+
# serving.delete_served_flow(cl, "ChatWithDemonstrationFlowModule") o_caching = False # Set to True to enable caching
|
| 103 |
|