fastworkflow 2.17.19__py3-none-any.whl → 2.17.20__py3-none-any.whl

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.
@@ -3,6 +3,7 @@ import os
3
3
  import json
4
4
  import shutil
5
5
  from dotenv import dotenv_values
6
+ import importlib.util
6
7
 
7
8
  from colorama import Fore, Style
8
9
 
@@ -16,6 +17,21 @@ from fastworkflow.command_directory import CommandDirectory, get_cached_command_
16
17
  from fastworkflow.command_routing import RoutingDefinition, RoutingRegistry
17
18
  from fastworkflow.command_context_model import CommandContextModel
18
19
 
20
+ # Cache the datasets availability check result
21
+ _DATASETS_AVAILABLE = None
22
+
23
+
24
+ def _datasets_available() -> bool:
25
+ """Check if the datasets package is available in the environment.
26
+
27
+ Returns:
28
+ bool: True if datasets can be imported, False otherwise.
29
+ """
30
+ global _DATASETS_AVAILABLE
31
+ if _DATASETS_AVAILABLE is None:
32
+ _DATASETS_AVAILABLE = importlib.util.find_spec("datasets") is not None
33
+ return _DATASETS_AVAILABLE
34
+
19
35
 
20
36
  def train_workflow(workflow_path: str):
21
37
  # Ensure context model is parsed so downstream helpers have contexts
@@ -44,6 +60,16 @@ def train_workflow(workflow_path: str):
44
60
  logger.info(f"No _commands directory found at {workflow_path}, skipping training")
45
61
  return
46
62
 
63
+ # Check if datasets package is available for training
64
+ # Command directory and routing artifacts are generated above regardless
65
+ if not _datasets_available():
66
+ logger.warning(
67
+ f"datasets package not found in environment. Skipping intent detection training "
68
+ f"and DSPy few-shot parameter extraction for workflow: {workflow_path}. "
69
+ f"Other artifacts such as command_directory.json and routing_definition.json have been generated successfully."
70
+ )
71
+ return
72
+
47
73
  # create a workflow and train the main workflow
48
74
  workflow = fastworkflow.Workflow.create(
49
75
  workflow_path,
@@ -1,9 +1,16 @@
1
1
  from typing import List
2
- from datasets import load_dataset
3
2
  import random
4
3
  import fastworkflow
5
4
  import litellm
6
5
 
6
+ # Conditional import of datasets - only required at runtime during training
7
+ try:
8
+ from datasets import load_dataset
9
+ _DATASETS_AVAILABLE = True
10
+ except ImportError:
11
+ _DATASETS_AVAILABLE = False
12
+ load_dataset = None
13
+
7
14
  NUMOF_PERSONAS=fastworkflow.get_env_var('SYNTHETIC_UTTERANCE_GEN_NUMOF_PERSONAS', int)
8
15
  UTTERANCES_PER_PERSONA=fastworkflow.get_env_var('SYNTHETIC_UTTERANCE_GEN_UTTERANCES_PER_PERSONA', int)
9
16
  PERSONAS_PER_BATCH=fastworkflow.get_env_var('SYNTHETIC_UTTERANCE_GEN_PERSONAS_PER_BATCH', int)
@@ -15,6 +22,15 @@ def generate_diverse_utterances(
15
22
  utterances_per_persona: int = UTTERANCES_PER_PERSONA,
16
23
  personas_per_batch: int = PERSONAS_PER_BATCH
17
24
  ) -> list[str]:
25
+ # If datasets is not available, return only the seed utterances
26
+ if not _DATASETS_AVAILABLE:
27
+ from fastworkflow.utils.logging import logger
28
+ logger.warning(
29
+ f"datasets package not available. Skipping synthetic utterance generation "
30
+ f"for command '{command_name}'. Using only seed utterances."
31
+ )
32
+ return [command_name] + seed_utterances
33
+
18
34
  # Initialize LiteLLM with API key
19
35
  api_key = fastworkflow.get_env_var("LITELLM_API_KEY_SYNDATA_GEN")
20
36
  model=fastworkflow.get_env_var("LLM_SYNDATA_GEN")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fastworkflow
3
- Version: 2.17.19
3
+ Version: 2.17.20
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
@@ -155,8 +155,8 @@ fastworkflow/run_fastapi_mcp/mcp_specific.py,sha256=RdOPcPn68KlxNSM9Vb2yeYEDNGoN
155
155
  fastworkflow/run_fastapi_mcp/redoc_2_standalone_html.py,sha256=oYWn30O-xKX6pVjunCeLupyOM2DbeZ3QgFj-F2LalOE,1191
156
156
  fastworkflow/run_fastapi_mcp/utils.py,sha256=SX6meWba0T-iYn7YmEajbwJrijfVVUuYGv4usDXzA2c,19589
157
157
  fastworkflow/train/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
158
- fastworkflow/train/__main__.py,sha256=03OeHVwa7MmBNHGtBrQ-0cT2rtrVtAiQtvQBzkcbp3w,8533
159
- fastworkflow/train/generate_synthetic.py,sha256=sTDk-E5ewkS4o-0LJeofiEv4uXGpqdGcFRYKY_Yf36Y,5322
158
+ fastworkflow/train/__main__.py,sha256=m4v9uczmZ58EfNlJKc-cewMjPeltLL7tNRKotYtig3o,9532
159
+ fastworkflow/train/generate_synthetic.py,sha256=ingoGxpwlaHGM9WHeK1xULEZntr5HBmQohyLtpqVTD0,5917
160
160
  fastworkflow/user_message_queues.py,sha256=svbuFxQ16q6Tz6urPWfD4IEsOTMxtS1Kc1PP8EE8AWg,1422
161
161
  fastworkflow/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
162
162
  fastworkflow/utils/chat_adapter.py,sha256=-U5JFiPynDhSYXJ75wdY0EA-hH8QPaq1bzA6ju4ZnVc,4090
@@ -177,8 +177,8 @@ fastworkflow/utils/startup_progress.py,sha256=9icSdnpFAxzIq0sUliGpNaH0Efvrt5lDtG
177
177
  fastworkflow/workflow.py,sha256=37gn7e3ct-gdGw43zS6Ab_ADoJJBO4eJW2PywfUpjEg,18825
178
178
  fastworkflow/workflow_agent.py,sha256=LRPdl-3lDRPx8pQtK202JWGYMYBNz5Mruy630fCBCk0,18725
179
179
  fastworkflow/workflow_inheritance_model.py,sha256=Pp-qSrQISgPfPjJVUfW84pc7HLmL2evuq0UVIYR51K0,7974
180
- fastworkflow-2.17.19.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
181
- fastworkflow-2.17.19.dist-info/METADATA,sha256=98M30tfZ6P5KinxaJlRtX4aP4EwoThNzt3wEbvgRIuQ,30915
182
- fastworkflow-2.17.19.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
183
- fastworkflow-2.17.19.dist-info/entry_points.txt,sha256=m8HqoPzCyaZLAx-V5X8MJgw3Lx3GiPDlxNEZ7K-Gb-U,54
184
- fastworkflow-2.17.19.dist-info/RECORD,,
180
+ fastworkflow-2.17.20.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
181
+ fastworkflow-2.17.20.dist-info/METADATA,sha256=GRA2Txe-gPQQ35HCtWh2NiqLg2f4O5V0apIfEUjZXrY,30915
182
+ fastworkflow-2.17.20.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
183
+ fastworkflow-2.17.20.dist-info/entry_points.txt,sha256=m8HqoPzCyaZLAx-V5X8MJgw3Lx3GiPDlxNEZ7K-Gb-U,54
184
+ fastworkflow-2.17.20.dist-info/RECORD,,