fastworkflow 2.15.2__tar.gz → 2.17.11__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/PKG-INFO +16 -18
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/README.md +9 -16
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/__init__.py +16 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/_commands/ErrorCorrection/you_misunderstood.py +1 -1
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/what_can_i_do.py +16 -2
- fastworkflow-2.17.11/fastworkflow/_workflows/command_metadata_extraction/_commands/wildcard.py +179 -0
- fastworkflow-2.17.11/fastworkflow/_workflows/command_metadata_extraction/intent_detection.py +360 -0
- fastworkflow-2.17.11/fastworkflow/_workflows/command_metadata_extraction/parameter_extraction.py +411 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/chat_session.py +401 -181
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/cli.py +80 -165
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/command_context_model.py +73 -7
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/command_executor.py +14 -25
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/command_metadata_api.py +106 -6
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/fastworkflow.env +2 -1
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/fastworkflow.passwords.env +2 -1
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/exchange_delivered_order_items.py +32 -3
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/find_user_id_by_email.py +6 -5
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/get_user_details.py +1 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/modify_pending_order_items.py +32 -3
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/return_delivered_order_items.py +13 -2
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/transfer_to_human_agents.py +1 -1
- fastworkflow-2.17.11/fastworkflow/intent_clarification_agent.py +132 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/mcp_server.py +3 -3
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/run/__main__.py +35 -19
- fastworkflow-2.17.11/fastworkflow/run_fastapi_mcp/README.md +373 -0
- fastworkflow-2.17.11/fastworkflow/run_fastapi_mcp/__main__.py +1300 -0
- fastworkflow-2.17.11/fastworkflow/run_fastapi_mcp/conversation_store.py +391 -0
- fastworkflow-2.17.11/fastworkflow/run_fastapi_mcp/jwt_manager.py +341 -0
- fastworkflow-2.17.11/fastworkflow/run_fastapi_mcp/mcp_specific.py +103 -0
- fastworkflow-2.17.11/fastworkflow/run_fastapi_mcp/redoc_2_standalone_html.py +40 -0
- fastworkflow-2.17.11/fastworkflow/run_fastapi_mcp/utils.py +517 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/train/__main__.py +1 -1
- fastworkflow-2.17.11/fastworkflow/utils/chat_adapter.py +99 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/python_utils.py +4 -4
- fastworkflow-2.17.11/fastworkflow/utils/react.py +258 -0
- fastworkflow-2.17.11/fastworkflow/utils/signatures.py +672 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/workflow.py +1 -5
- fastworkflow-2.17.11/fastworkflow/workflow_agent.py +407 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/pyproject.toml +9 -3
- fastworkflow-2.15.2/fastworkflow/_workflows/command_metadata_extraction/_commands/wildcard.py +0 -721
- fastworkflow-2.15.2/fastworkflow/run_agent/__main__.py +0 -294
- fastworkflow-2.15.2/fastworkflow/run_agent/agent_module.py +0 -194
- fastworkflow-2.15.2/fastworkflow/utils/signatures.py +0 -473
- fastworkflow-2.15.2/fastworkflow/workflow_agent.py +0 -254
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/LICENSE +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/.DS_Store +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_commands/.gitkeep +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/_commands/ErrorCorrection/abort.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/go_up.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/reset_context.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/_commands/IntentDetection/what_is_current_context.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/_commands/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/_workflows/command_metadata_extraction/command_context_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/__main__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/ast_class_extractor.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/class_analysis_structures.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/cli_specification.md +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/command_dependency_resolver.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/command_file_generator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/command_file_template.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/command_import_utils.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/command_stub_generator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/context_folder_generator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/context_model_generator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/dependency_manager.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/dir_scanner.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/documentation_generator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/genai_postprocessor.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/inheritance_block_regenerator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/libcst_transformers.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/navigator_stub_generator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/pydantic_model_generator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/build/utterance_generator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/cache_matching.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/command_directory.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/command_interfaces.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/command_routing.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/docs/context_modules_prd.txt +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/extended_workflow_example/README.md +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/extended_workflow_example/_commands/WorkItem/get_status.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/extended_workflow_example/_commands/generate_report.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/extended_workflow_example/_commands/startup.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/extended_workflow_example/simple_workflow_template.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/extended_workflow_example/workflow_inheritance_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/hello_world/_commands/README.md +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/hello_world/_commands/add_two_numbers.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/hello_world/_commands/context_inheritance_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/hello_world/application/add_two_numbers.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_1/_commands/context_inheritance_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_1/_commands/send_message.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_1/application/send_message.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_2/_commands/User/send_message.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_2/_commands/context_inheritance_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_2/_commands/startup.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_2/application/user.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_3/_commands/PremiumUser/send_priority_message.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_3/_commands/User/send_message.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_3/_commands/context_inheritance_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_3/_commands/initialize_user.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_3/application/user.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/ChatRoom/_ChatRoom.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/ChatRoom/add_user.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/ChatRoom/broadcast_message.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/ChatRoom/get_current_user.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/ChatRoom/list_users.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/ChatRoom/set_current_user.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/PremiumUser/_PremiumUser.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/PremiumUser/send_priority_message.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/User/_User.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/User/send_message.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/context_inheritance_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/_commands/set_root_context.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/application/chatroom.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/application/user.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/context_hierarchy_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/messaging_app_4/startup_action.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/calculate.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/cancel_pending_order.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/find_user_id_by_name_zip.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/get_order_details.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/get_product_details.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/list_all_product_types.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/modify_pending_order_address.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/modify_pending_order_payment.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/_commands/modify_user_address.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/context_inheritance_model.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/retail_data/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/retail_data/orders.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/retail_data/products.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/retail_data/users.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/calculate.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/cancel_pending_order.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/exchange_delivered_order_items.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/find_user_id_by_email.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/find_user_id_by_name_zip.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/get_order_details.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/get_product_details.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/get_user_details.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/list_all_product_types.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/modify_pending_order_address.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/modify_pending_order_items.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/modify_pending_order_payment.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/modify_user_address.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/return_delivered_order_items.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/think.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/tool.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/tools/transfer_to_human_agents.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/retail_workflow/workflow_description.txt +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/_WorkItem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/add_child_workitem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/get_status.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/go_to_workitem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/mark_as_complete.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/move_to_first_child_workitem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/move_to_last_child_workitem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/move_to_next_workitem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/move_to_previous_workitem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/remove_all_child_workitems.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/remove_child_workitem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/WorkItem/show_schema.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/_commands/startup.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/application/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/application/workitem.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/simple_workflow_template.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/examples/simple_workflow_template/startup_action.json +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/model_pipeline_training.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/refine/__main__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/run/__init__.py +0 -0
- {fastworkflow-2.15.2/fastworkflow/run_agent → fastworkflow-2.17.11/fastworkflow/run_fastapi_mcp}/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/train/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/train/generate_synthetic.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/user_message_queues.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/__init__.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/command_dependency_graph.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/context_utils.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/dspy_cache_utils.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/dspy_logger.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/dspy_utils.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/env.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/fuzzy_match.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/generate_param_examples.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/logging.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/parameterize_func_decorator.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/pydantic_model_2_dspy_signature_class.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/utils/startup_progress.py +0 -0
- {fastworkflow-2.15.2 → fastworkflow-2.17.11}/fastworkflow/workflow_inheritance_model.py +0 -0
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: fastworkflow
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.17.11
|
|
4
4
|
Summary: A framework for rapidly building large-scale, deterministic, interactive workflows with a fault-tolerant, conversational UX
|
|
5
5
|
License: Apache-2.0
|
|
6
6
|
Keywords: fastworkflow,ai,workflow,llm,openai
|
|
7
7
|
Author: Dhar Rawal
|
|
8
8
|
Author-email: drawal@radiantlogic.com
|
|
9
|
-
Requires-Python: >=3.11
|
|
9
|
+
Requires-Python: >=3.11,<3.14
|
|
10
10
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
11
|
Classifier: Programming Language :: Python :: 3
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Provides-Extra: fastapi
|
|
14
15
|
Requires-Dist: colorama (>=0.4.6,<0.5.0)
|
|
15
16
|
Requires-Dist: datasets (>=4.0.0,<5.0.0)
|
|
16
17
|
Requires-Dist: dspy (>=3.0.1,<4.0.0)
|
|
18
|
+
Requires-Dist: fastapi (>=0.115.5,<0.116.0) ; extra == "fastapi"
|
|
19
|
+
Requires-Dist: fastapi-mcp (>=0.4.0,<0.5.0) ; extra == "fastapi"
|
|
17
20
|
Requires-Dist: libcst (>=1.8.2,<2.0.0)
|
|
18
21
|
Requires-Dist: litellm[proxy] (>=1.75.8,<2.0.0)
|
|
19
22
|
Requires-Dist: mmh3 (>=5.1.0,<6.0.0)
|
|
@@ -21,12 +24,14 @@ Requires-Dist: openai (>=1.99.5,<1.100.0)
|
|
|
21
24
|
Requires-Dist: prompt_toolkit (>=3.0.43,<4.0.0)
|
|
22
25
|
Requires-Dist: pydantic (>=2.9.2,<3.0.0)
|
|
23
26
|
Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
|
|
27
|
+
Requires-Dist: python-jose[cryptography] (>=3.3.0,<4.0.0) ; extra == "fastapi"
|
|
24
28
|
Requires-Dist: python-levenshtein (>=0.27.1,<0.28.0)
|
|
25
29
|
Requires-Dist: scikit-learn (>=1.6.1,<2.0.0)
|
|
26
30
|
Requires-Dist: sentence-transformers (>=3.4.1,<4.0.0)
|
|
27
31
|
Requires-Dist: speedict (>=0.3.12,<0.4.0)
|
|
28
32
|
Requires-Dist: torch (>=2.7.1,<3.0.0)
|
|
29
33
|
Requires-Dist: transformers (>=4.48.2,<5.0.0)
|
|
34
|
+
Requires-Dist: uvicorn (>=0.29.0,<0.30.0) ; extra == "fastapi"
|
|
30
35
|
Project-URL: homepage, https://github.com/radiantlogicinc/fastworkflow
|
|
31
36
|
Project-URL: repository, https://github.com/radiantlogicinc/fastworkflow
|
|
32
37
|
Description-Content-Type: text/markdown
|
|
@@ -50,7 +55,7 @@ While [DSPy](https://dspy.ai) ([Why DSPy](https://x.com/lateinteraction/status/1
|
|
|
50
55
|
|
|
51
56
|
### Why fastWorkflow?
|
|
52
57
|
|
|
53
|
-
- ✅ **Unlimited Tool Scaling**: fastworkflow
|
|
58
|
+
- ✅ **Unlimited Tool Scaling**: fastworkflow organizes tools into context hierarchies so use any number of tools without sacrificing performance or efficiency
|
|
54
59
|
- ✅ **Cost-Effective Performance**: fastWorkFlow with small, free models can match the quality of large expensive models
|
|
55
60
|
- ✅ **Reliable Tool Execution**: fastworkflow validation pipeline virtually eliminates incorrect tool calling or parameter extraction, ensuring a reliable tool response
|
|
56
61
|
- ✅ **Adaptive Learning**: 1-shot learning from intent detection mistakes. It learns your conversational vocabulary as you interact with it
|
|
@@ -202,14 +207,14 @@ LITELLM_API_KEY_PLANNER=your-mistral-api-key
|
|
|
202
207
|
LITELLM_API_KEY_AGENT=your-mistral-api-key
|
|
203
208
|
```
|
|
204
209
|
|
|
205
|
-
You can get a free API key from [Mistral AI](https://mistral.ai)
|
|
210
|
+
You can get a free API key from [Mistral AI](https://mistral.ai) for the mistral small model. Or a free API key from [OpenRouter](https://openrouter.ai/openai/gpt-oss-20b:free) for the GPT-OSS-20B:free model. You can use different models for different LLM roles in the same workflow if you wish.
|
|
206
211
|
|
|
207
212
|
### Step 3: Train the Example
|
|
208
213
|
|
|
209
214
|
Train the intent-detection models for the workflow:
|
|
210
215
|
|
|
211
216
|
```sh
|
|
212
|
-
fastworkflow examples
|
|
217
|
+
fastworkflow train ./examples/hello_world ./examples/fastworkflow.env ./examples/fastworkflow.passwords.env
|
|
213
218
|
```
|
|
214
219
|
|
|
215
220
|
This step builds the NLP models that help the workflow understand user commands.
|
|
@@ -219,7 +224,7 @@ This step builds the NLP models that help the workflow understand user commands.
|
|
|
219
224
|
Once training is complete, run the interactive assistant:
|
|
220
225
|
|
|
221
226
|
```sh
|
|
222
|
-
fastworkflow examples
|
|
227
|
+
fastworkflow run ./examples/hello_world ./examples/fastworkflow.env ./examples/fastworkflow.passwords.env
|
|
223
228
|
```
|
|
224
229
|
|
|
225
230
|
You will be greeted with a `User >` prompt. Try it out by asking "what can you do?" or "add 49 + 51"!
|
|
@@ -240,12 +245,6 @@ fastworkflow examples list
|
|
|
240
245
|
|
|
241
246
|
# Fetch an example to your local directory
|
|
242
247
|
fastworkflow examples fetch <example_name>
|
|
243
|
-
|
|
244
|
-
# Train an example workflow
|
|
245
|
-
fastworkflow examples train <example_name>
|
|
246
|
-
|
|
247
|
-
# Run an example workflow
|
|
248
|
-
fastworkflow examples run <example_name>
|
|
249
248
|
```
|
|
250
249
|
|
|
251
250
|
### Workflow Operations
|
|
@@ -261,11 +260,8 @@ fastworkflow train <workflow_dir> <env_file> <passwords_file>
|
|
|
261
260
|
fastworkflow run <workflow_dir> <env_file> <passwords_file>
|
|
262
261
|
```
|
|
263
262
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
```sh
|
|
267
|
-
fastworkflow run <workflow_dir> <env_file> <passwords_file> --run_as_agent
|
|
268
|
-
```
|
|
263
|
+
> [!tip]
|
|
264
|
+
> **Deterministic execution:** Prefix a natural language command with `/` to execute it deterministically (non‑agentic) during an interactive run.
|
|
269
265
|
|
|
270
266
|
Each command has additional options that can be viewed with the `--help` flag:
|
|
271
267
|
|
|
@@ -590,6 +586,7 @@ This single command will generate the `greet.py` command, `get_properties` and `
|
|
|
590
586
|
| `LLM_RESPONSE_GEN` | LiteLLM model string for response generation | `run` | `mistral/mistral-small-latest` |
|
|
591
587
|
| `LLM_PLANNER` | LiteLLM model string for the agent's task planner | `run` (agent mode) | `mistral/mistral-small-latest` |
|
|
592
588
|
| `LLM_AGENT` | LiteLLM model string for the DSPy agent | `run` (agent mode) | `mistral/mistral-small-latest` |
|
|
589
|
+
| `LLM_CONVERSATION_STORE` | LiteLLM model string for conversation topic/summary generation | FastAPI service | `mistral/mistral-small-latest` |
|
|
593
590
|
| `NOT_FOUND` | Placeholder value for missing parameters during extraction | Always | `"NOT_FOUND"` |
|
|
594
591
|
| `MISSING_INFORMATION_ERRMSG` | Error message prefix for missing parameters | Always | `"Missing required..."` |
|
|
595
592
|
| `INVALID_INFORMATION_ERRMSG` | Error message prefix for invalid parameters | Always | `"Invalid information..."` |
|
|
@@ -603,6 +600,7 @@ This single command will generate the `greet.py` command, `get_properties` and `
|
|
|
603
600
|
| `LITELLM_API_KEY_RESPONSE_GEN`| API key for the `LLM_RESPONSE_GEN` model | `run` | *required* |
|
|
604
601
|
| `LITELLM_API_KEY_PLANNER`| API key for the `LLM_PLANNER` model | `run` (agent mode) | *required* |
|
|
605
602
|
| `LITELLM_API_KEY_AGENT`| API key for the `LLM_AGENT` model | `run` (agent mode) | *required* |
|
|
603
|
+
| `LITELLM_API_KEY_CONVERSATION_STORE`| API key for the `LLM_CONVERSATION_STORE` model | FastAPI service | *required* |
|
|
606
604
|
|
|
607
605
|
> [!tip]
|
|
608
606
|
> The example workflows are configured to use Mistral's models by default. You can get a free API key from [Mistral AI](https://mistral.ai) that works with the `mistral-small-latest` model.
|
|
@@ -638,7 +636,7 @@ Interested in contributing to `fastWorkflow` itself? Great!
|
|
|
638
636
|
1. **Clone the repository:** `git clone https://github.com/your-repo/fastworkflow.git`
|
|
639
637
|
2. **Set up the environment:** Create a virtual environment using your preferred tool (venv, uv, conda, poetry, etc.) with Python 3.11+
|
|
640
638
|
3. **Install in editable mode with dev dependencies:** `pip install -e .` or `uv pip install -e ".[dev]"`
|
|
641
|
-
4. **[Join our Discord](https://discord.gg/
|
|
639
|
+
4. **[Join our Discord](https://discord.gg/k2g58dDjYR):** Ask questions, discuss functionality, showcase your fastWorkflows
|
|
642
640
|
|
|
643
641
|
---
|
|
644
642
|
|
|
@@ -17,7 +17,7 @@ While [DSPy](https://dspy.ai) ([Why DSPy](https://x.com/lateinteraction/status/1
|
|
|
17
17
|
|
|
18
18
|
### Why fastWorkflow?
|
|
19
19
|
|
|
20
|
-
- ✅ **Unlimited Tool Scaling**: fastworkflow
|
|
20
|
+
- ✅ **Unlimited Tool Scaling**: fastworkflow organizes tools into context hierarchies so use any number of tools without sacrificing performance or efficiency
|
|
21
21
|
- ✅ **Cost-Effective Performance**: fastWorkFlow with small, free models can match the quality of large expensive models
|
|
22
22
|
- ✅ **Reliable Tool Execution**: fastworkflow validation pipeline virtually eliminates incorrect tool calling or parameter extraction, ensuring a reliable tool response
|
|
23
23
|
- ✅ **Adaptive Learning**: 1-shot learning from intent detection mistakes. It learns your conversational vocabulary as you interact with it
|
|
@@ -169,14 +169,14 @@ LITELLM_API_KEY_PLANNER=your-mistral-api-key
|
|
|
169
169
|
LITELLM_API_KEY_AGENT=your-mistral-api-key
|
|
170
170
|
```
|
|
171
171
|
|
|
172
|
-
You can get a free API key from [Mistral AI](https://mistral.ai)
|
|
172
|
+
You can get a free API key from [Mistral AI](https://mistral.ai) for the mistral small model. Or a free API key from [OpenRouter](https://openrouter.ai/openai/gpt-oss-20b:free) for the GPT-OSS-20B:free model. You can use different models for different LLM roles in the same workflow if you wish.
|
|
173
173
|
|
|
174
174
|
### Step 3: Train the Example
|
|
175
175
|
|
|
176
176
|
Train the intent-detection models for the workflow:
|
|
177
177
|
|
|
178
178
|
```sh
|
|
179
|
-
fastworkflow examples
|
|
179
|
+
fastworkflow train ./examples/hello_world ./examples/fastworkflow.env ./examples/fastworkflow.passwords.env
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
This step builds the NLP models that help the workflow understand user commands.
|
|
@@ -186,7 +186,7 @@ This step builds the NLP models that help the workflow understand user commands.
|
|
|
186
186
|
Once training is complete, run the interactive assistant:
|
|
187
187
|
|
|
188
188
|
```sh
|
|
189
|
-
fastworkflow examples
|
|
189
|
+
fastworkflow run ./examples/hello_world ./examples/fastworkflow.env ./examples/fastworkflow.passwords.env
|
|
190
190
|
```
|
|
191
191
|
|
|
192
192
|
You will be greeted with a `User >` prompt. Try it out by asking "what can you do?" or "add 49 + 51"!
|
|
@@ -207,12 +207,6 @@ fastworkflow examples list
|
|
|
207
207
|
|
|
208
208
|
# Fetch an example to your local directory
|
|
209
209
|
fastworkflow examples fetch <example_name>
|
|
210
|
-
|
|
211
|
-
# Train an example workflow
|
|
212
|
-
fastworkflow examples train <example_name>
|
|
213
|
-
|
|
214
|
-
# Run an example workflow
|
|
215
|
-
fastworkflow examples run <example_name>
|
|
216
210
|
```
|
|
217
211
|
|
|
218
212
|
### Workflow Operations
|
|
@@ -228,11 +222,8 @@ fastworkflow train <workflow_dir> <env_file> <passwords_file>
|
|
|
228
222
|
fastworkflow run <workflow_dir> <env_file> <passwords_file>
|
|
229
223
|
```
|
|
230
224
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
```sh
|
|
234
|
-
fastworkflow run <workflow_dir> <env_file> <passwords_file> --run_as_agent
|
|
235
|
-
```
|
|
225
|
+
> [!tip]
|
|
226
|
+
> **Deterministic execution:** Prefix a natural language command with `/` to execute it deterministically (non‑agentic) during an interactive run.
|
|
236
227
|
|
|
237
228
|
Each command has additional options that can be viewed with the `--help` flag:
|
|
238
229
|
|
|
@@ -557,6 +548,7 @@ This single command will generate the `greet.py` command, `get_properties` and `
|
|
|
557
548
|
| `LLM_RESPONSE_GEN` | LiteLLM model string for response generation | `run` | `mistral/mistral-small-latest` |
|
|
558
549
|
| `LLM_PLANNER` | LiteLLM model string for the agent's task planner | `run` (agent mode) | `mistral/mistral-small-latest` |
|
|
559
550
|
| `LLM_AGENT` | LiteLLM model string for the DSPy agent | `run` (agent mode) | `mistral/mistral-small-latest` |
|
|
551
|
+
| `LLM_CONVERSATION_STORE` | LiteLLM model string for conversation topic/summary generation | FastAPI service | `mistral/mistral-small-latest` |
|
|
560
552
|
| `NOT_FOUND` | Placeholder value for missing parameters during extraction | Always | `"NOT_FOUND"` |
|
|
561
553
|
| `MISSING_INFORMATION_ERRMSG` | Error message prefix for missing parameters | Always | `"Missing required..."` |
|
|
562
554
|
| `INVALID_INFORMATION_ERRMSG` | Error message prefix for invalid parameters | Always | `"Invalid information..."` |
|
|
@@ -570,6 +562,7 @@ This single command will generate the `greet.py` command, `get_properties` and `
|
|
|
570
562
|
| `LITELLM_API_KEY_RESPONSE_GEN`| API key for the `LLM_RESPONSE_GEN` model | `run` | *required* |
|
|
571
563
|
| `LITELLM_API_KEY_PLANNER`| API key for the `LLM_PLANNER` model | `run` (agent mode) | *required* |
|
|
572
564
|
| `LITELLM_API_KEY_AGENT`| API key for the `LLM_AGENT` model | `run` (agent mode) | *required* |
|
|
565
|
+
| `LITELLM_API_KEY_CONVERSATION_STORE`| API key for the `LLM_CONVERSATION_STORE` model | FastAPI service | *required* |
|
|
573
566
|
|
|
574
567
|
> [!tip]
|
|
575
568
|
> The example workflows are configured to use Mistral's models by default. You can get a free API key from [Mistral AI](https://mistral.ai) that works with the `mistral-small-latest` model.
|
|
@@ -605,7 +598,7 @@ Interested in contributing to `fastWorkflow` itself? Great!
|
|
|
605
598
|
1. **Clone the repository:** `git clone https://github.com/your-repo/fastworkflow.git`
|
|
606
599
|
2. **Set up the environment:** Create a virtual environment using your preferred tool (venv, uv, conda, poetry, etc.) with Python 3.11+
|
|
607
600
|
3. **Install in editable mode with dev dependencies:** `pip install -e .` or `uv pip install -e ".[dev]"`
|
|
608
|
-
4. **[Join our Discord](https://discord.gg/
|
|
601
|
+
4. **[Join our Discord](https://discord.gg/k2g58dDjYR):** Ask questions, discuss functionality, showcase your fastWorkflows
|
|
609
602
|
|
|
610
603
|
---
|
|
611
604
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import contextlib
|
|
2
|
+
from dataclasses import dataclass
|
|
2
3
|
from enum import Enum
|
|
3
4
|
import os
|
|
5
|
+
import time
|
|
4
6
|
from typing import Any, Optional, Union
|
|
5
7
|
|
|
6
8
|
from pydantic import BaseModel
|
|
@@ -47,6 +49,20 @@ class MCPToolResult(BaseModel):
|
|
|
47
49
|
content: list[MCPContent]
|
|
48
50
|
isError: bool = False
|
|
49
51
|
|
|
52
|
+
class CommandTraceEventDirection(str, Enum):
|
|
53
|
+
AGENT_TO_WORKFLOW = "agent_to_workflow"
|
|
54
|
+
WORKFLOW_TO_AGENT = "workflow_to_agent"
|
|
55
|
+
|
|
56
|
+
@dataclass
|
|
57
|
+
class CommandTraceEvent:
|
|
58
|
+
direction: CommandTraceEventDirection
|
|
59
|
+
raw_command: str | None # for AGENT_TO_WORKFLOW
|
|
60
|
+
command_name: str | None # for WORKFLOW_TO_AGENT
|
|
61
|
+
parameters: dict | str | None
|
|
62
|
+
response_text: str | None
|
|
63
|
+
success: bool | None
|
|
64
|
+
timestamp_ms: int
|
|
65
|
+
|
|
50
66
|
class CommandOutput(BaseModel):
|
|
51
67
|
command_responses: list[CommandResponse]
|
|
52
68
|
workflow_name: str = ""
|
|
@@ -8,6 +8,7 @@ import json
|
|
|
8
8
|
|
|
9
9
|
import fastworkflow
|
|
10
10
|
from fastworkflow.train.generate_synthetic import generate_diverse_utterances
|
|
11
|
+
from fastworkflow.command_context_model import get_workflow_info
|
|
11
12
|
from fastworkflow.command_metadata_api import CommandMetadataAPI
|
|
12
13
|
|
|
13
14
|
class Signature:
|
|
@@ -139,20 +140,33 @@ class ResponseGenerator:
|
|
|
139
140
|
with contextlib.suppress(Exception):
|
|
140
141
|
if fastworkflow.chat_session:
|
|
141
142
|
is_agent_mode = fastworkflow.chat_session.run_as_agent
|
|
142
|
-
|
|
143
|
+
|
|
143
144
|
app_workflow = workflow.context["app_workflow"]
|
|
144
|
-
|
|
145
|
+
|
|
146
|
+
# Get workflow definition
|
|
147
|
+
workflow_info = get_workflow_info(app_workflow.folderpath)
|
|
148
|
+
workflow_def_text = CommandMetadataAPI.get_workflow_definition_display_text(workflow_info)
|
|
149
|
+
|
|
150
|
+
# Get available commands in current context
|
|
151
|
+
commands_text = CommandMetadataAPI.get_command_display_text(
|
|
145
152
|
subject_workflow_path=app_workflow.folderpath,
|
|
146
153
|
cme_workflow_path=workflow.folderpath,
|
|
147
154
|
active_context_name=app_workflow.current_command_context_name,
|
|
148
155
|
for_agents=is_agent_mode,
|
|
149
156
|
)
|
|
157
|
+
|
|
158
|
+
response = f"{workflow_def_text}\n\n{commands_text}"
|
|
150
159
|
|
|
160
|
+
nlu_pipeline_stage = workflow.context.get(
|
|
161
|
+
"NLU_Pipeline_Stage",
|
|
162
|
+
fastworkflow.NLUPipelineStage.INTENT_DETECTION)
|
|
163
|
+
success = nlu_pipeline_stage == fastworkflow.NLUPipelineStage.INTENT_DETECTION
|
|
151
164
|
return fastworkflow.CommandOutput(
|
|
152
165
|
workflow_id=workflow.id,
|
|
153
166
|
command_responses=[
|
|
154
167
|
fastworkflow.CommandResponse(
|
|
155
168
|
response=response,
|
|
169
|
+
success=success
|
|
156
170
|
)
|
|
157
171
|
]
|
|
158
172
|
)
|
fastworkflow-2.17.11/fastworkflow/_workflows/command_metadata_extraction/_commands/wildcard.py
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import fastworkflow
|
|
2
|
+
from fastworkflow import Action, CommandOutput, CommandResponse, NLUPipelineStage
|
|
3
|
+
from fastworkflow.command_executor import CommandExecutor
|
|
4
|
+
|
|
5
|
+
from ..intent_detection import CommandNamePrediction
|
|
6
|
+
from ..parameter_extraction import ParameterExtraction
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Signature:
|
|
10
|
+
plain_utterances = [
|
|
11
|
+
"3",
|
|
12
|
+
"france",
|
|
13
|
+
"16.7,.002",
|
|
14
|
+
"John Doe, 56, 281-995-6423",
|
|
15
|
+
"/path/to/my/object",
|
|
16
|
+
"id=3636",
|
|
17
|
+
"25.73 and Howard St",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
@staticmethod
|
|
21
|
+
def generate_utterances(workflow: fastworkflow.Workflow, command_name: str) -> list[str]:
|
|
22
|
+
return [
|
|
23
|
+
command_name.split('/')[-1].lower().replace('_', ' ')
|
|
24
|
+
] + Signature.plain_utterances
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class ResponseGenerator:
|
|
28
|
+
def __call__(
|
|
29
|
+
self,
|
|
30
|
+
workflow: fastworkflow.Workflow,
|
|
31
|
+
command: str,
|
|
32
|
+
) -> CommandOutput: # sourcery skip: hoist-if-from-if
|
|
33
|
+
app_workflow = workflow.context["app_workflow"] # type: fastworkflow.Workflow
|
|
34
|
+
cmd_ctxt_obj_name = app_workflow.current_command_context_name
|
|
35
|
+
nlu_pipeline_stage = workflow.context.get(
|
|
36
|
+
"NLU_Pipeline_Stage",
|
|
37
|
+
NLUPipelineStage.INTENT_DETECTION)
|
|
38
|
+
|
|
39
|
+
predictor = CommandNamePrediction(workflow)
|
|
40
|
+
cnp_output = predictor.predict(cmd_ctxt_obj_name, command, nlu_pipeline_stage)
|
|
41
|
+
|
|
42
|
+
if cnp_output.error_msg:
|
|
43
|
+
workflow_context = workflow.context
|
|
44
|
+
workflow_context["NLU_Pipeline_Stage"] = NLUPipelineStage.INTENT_AMBIGUITY_CLARIFICATION
|
|
45
|
+
workflow_context["command"] = command
|
|
46
|
+
workflow.context = workflow_context
|
|
47
|
+
return CommandOutput(
|
|
48
|
+
command_responses=[
|
|
49
|
+
CommandResponse(
|
|
50
|
+
response=(
|
|
51
|
+
f"Ambiguous intent error for command '{command}'\n"
|
|
52
|
+
f"{cnp_output.error_msg}"
|
|
53
|
+
),
|
|
54
|
+
success=False
|
|
55
|
+
)
|
|
56
|
+
]
|
|
57
|
+
)
|
|
58
|
+
else:
|
|
59
|
+
if nlu_pipeline_stage == NLUPipelineStage.INTENT_DETECTION and \
|
|
60
|
+
cnp_output.command_name != 'ErrorCorrection/you_misunderstood':
|
|
61
|
+
workflow_context = workflow.context
|
|
62
|
+
workflow_context["command"] = command
|
|
63
|
+
workflow.context = workflow_context
|
|
64
|
+
|
|
65
|
+
if cnp_output.is_cme_command:
|
|
66
|
+
workflow_context = workflow.context
|
|
67
|
+
if cnp_output.command_name == 'ErrorCorrection/you_misunderstood':
|
|
68
|
+
workflow_context["NLU_Pipeline_Stage"] = NLUPipelineStage.INTENT_MISUNDERSTANDING_CLARIFICATION
|
|
69
|
+
workflow_context["command"] = command
|
|
70
|
+
elif (
|
|
71
|
+
nlu_pipeline_stage == fastworkflow.NLUPipelineStage.INTENT_DETECTION or
|
|
72
|
+
cnp_output.command_name == 'ErrorCorrection/abort'
|
|
73
|
+
):
|
|
74
|
+
workflow.end_command_processing()
|
|
75
|
+
workflow.context = workflow_context
|
|
76
|
+
|
|
77
|
+
startup_action = Action(
|
|
78
|
+
command_name=cnp_output.command_name,
|
|
79
|
+
command=command,
|
|
80
|
+
)
|
|
81
|
+
command_output = CommandExecutor.perform_action(workflow, startup_action)
|
|
82
|
+
if (
|
|
83
|
+
nlu_pipeline_stage == fastworkflow.NLUPipelineStage.INTENT_DETECTION or
|
|
84
|
+
cnp_output.command_name == 'ErrorCorrection/abort'
|
|
85
|
+
):
|
|
86
|
+
command_output.command_responses[0].artifacts["command_handled"] = True
|
|
87
|
+
# Set the additional attributes
|
|
88
|
+
command_output.command_name = cnp_output.command_name
|
|
89
|
+
return command_output
|
|
90
|
+
|
|
91
|
+
if nlu_pipeline_stage in {
|
|
92
|
+
NLUPipelineStage.INTENT_DETECTION,
|
|
93
|
+
NLUPipelineStage.INTENT_AMBIGUITY_CLARIFICATION,
|
|
94
|
+
NLUPipelineStage.INTENT_MISUNDERSTANDING_CLARIFICATION
|
|
95
|
+
}:
|
|
96
|
+
app_workflow.command_context_for_response_generation = \
|
|
97
|
+
app_workflow.current_command_context
|
|
98
|
+
|
|
99
|
+
if cnp_output.command_name is None:
|
|
100
|
+
while not cnp_output.command_name and \
|
|
101
|
+
app_workflow.command_context_for_response_generation is not None and \
|
|
102
|
+
not app_workflow.is_command_context_for_response_generation_root:
|
|
103
|
+
app_workflow.command_context_for_response_generation = \
|
|
104
|
+
app_workflow.get_parent(app_workflow.command_context_for_response_generation)
|
|
105
|
+
cnp_output = predictor.predict(
|
|
106
|
+
fastworkflow.Workflow.get_command_context_name(app_workflow.command_context_for_response_generation),
|
|
107
|
+
command, nlu_pipeline_stage)
|
|
108
|
+
|
|
109
|
+
if cnp_output.command_name is None:
|
|
110
|
+
if nlu_pipeline_stage == NLUPipelineStage.INTENT_DETECTION:
|
|
111
|
+
# out of scope commands
|
|
112
|
+
workflow_context = workflow.context
|
|
113
|
+
workflow_context["NLU_Pipeline_Stage"] = \
|
|
114
|
+
NLUPipelineStage.INTENT_MISUNDERSTANDING_CLARIFICATION
|
|
115
|
+
workflow_context["command"] = command
|
|
116
|
+
workflow.context = workflow_context
|
|
117
|
+
|
|
118
|
+
startup_action = Action(
|
|
119
|
+
command_name='ErrorCorrection/you_misunderstood',
|
|
120
|
+
command=command,
|
|
121
|
+
)
|
|
122
|
+
command_output = CommandExecutor.perform_action(workflow, startup_action)
|
|
123
|
+
command_output.command_responses[0].artifacts["command_handled"] = True
|
|
124
|
+
return command_output
|
|
125
|
+
|
|
126
|
+
return CommandOutput(
|
|
127
|
+
command_responses=[
|
|
128
|
+
CommandResponse(
|
|
129
|
+
response=cnp_output.error_msg,
|
|
130
|
+
success=False
|
|
131
|
+
)
|
|
132
|
+
]
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
# move to the parameter extraction stage
|
|
136
|
+
workflow_context = workflow.context
|
|
137
|
+
workflow_context["NLU_Pipeline_Stage"] = NLUPipelineStage.PARAMETER_EXTRACTION
|
|
138
|
+
workflow.context = workflow_context
|
|
139
|
+
|
|
140
|
+
if nlu_pipeline_stage == NLUPipelineStage.PARAMETER_EXTRACTION:
|
|
141
|
+
cnp_output.command_name = workflow.context["command_name"]
|
|
142
|
+
else:
|
|
143
|
+
workflow_context = workflow.context
|
|
144
|
+
workflow_context["command_name"] = cnp_output.command_name
|
|
145
|
+
workflow.context = workflow_context
|
|
146
|
+
|
|
147
|
+
command_name = cnp_output.command_name
|
|
148
|
+
# Use the preserved original command (with parameters) if available
|
|
149
|
+
preserved_command = f'{command_name}: {workflow.context.get("command", command)}'
|
|
150
|
+
extractor = ParameterExtraction(workflow, app_workflow, command_name, preserved_command)
|
|
151
|
+
pe_output = extractor.extract()
|
|
152
|
+
if not pe_output.parameters_are_valid:
|
|
153
|
+
return CommandOutput(
|
|
154
|
+
command_name = command_name,
|
|
155
|
+
command_responses=[
|
|
156
|
+
CommandResponse(
|
|
157
|
+
response=(
|
|
158
|
+
f"PARAMETER EXTRACTION ERROR FOR COMMAND '{command_name}'\n"
|
|
159
|
+
f"{pe_output.error_msg}"
|
|
160
|
+
),
|
|
161
|
+
success=False
|
|
162
|
+
)
|
|
163
|
+
]
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
workflow.end_command_processing()
|
|
167
|
+
|
|
168
|
+
return CommandOutput(
|
|
169
|
+
command_responses=[
|
|
170
|
+
CommandResponse(
|
|
171
|
+
response="",
|
|
172
|
+
artifacts={
|
|
173
|
+
"command": preserved_command,
|
|
174
|
+
"command_name": command_name,
|
|
175
|
+
"cmd_parameters": pe_output.cmd_parameters,
|
|
176
|
+
},
|
|
177
|
+
)
|
|
178
|
+
]
|
|
179
|
+
)
|