Skip to content

Commit ed552ef

Browse files
authored
feat(examples): refine flow examples with clean import structure (#51)
1 parent a208ad3 commit ed552ef

File tree

6 files changed

+38
-1
lines changed

6 files changed

+38
-1
lines changed

examples/flow/01_custom_flow/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This example demonstrates how to create a simple custom flow using the new Quant
88
examples/flow/01_custom_flow/
99
├── flows/
1010
│ └── greeting_flow/
11+
│ ├── __init__.py # Module exports
1112
│ ├── prompts.yaml # Prompt templates
1213
│ └── flow.py # Flow implementation
1314
├── config.yaml # Flow configuration
@@ -38,6 +39,18 @@ examples/flow/01_custom_flow/
3839
- Separated from code for easy editing
3940
- Loaded dynamically
4041

42+
## Easy Import Structure
43+
44+
With the new `__init__.py` files, you can now import flows cleanly:
45+
46+
```python
47+
# Import from flow directory
48+
from flows.greeting_flow import GreetingFlow, GreetingFlowConfig
49+
50+
# Use in major pipelines
51+
flow = GreetingFlow(config)
52+
```
53+
4154
## Running the Demo
4255

4356
```bash
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Greeting flow module."""
2+
3+
from .flow import GreetingFlow, GreetingFlowConfig
4+
5+
__all__ = ["GreetingFlow", "GreetingFlowConfig"]

examples/flow/01_custom_flow/pipeline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pathlib import Path
55

66
# Import the custom flow
7-
from flows.greeting_flow.flow import GreetingFlow
7+
from flows.greeting_flow import GreetingFlow
88
from quantmind.config.settings import load_config
99

1010

examples/flow/02_summary_flow/README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ This example demonstrates the built-in SummaryFlow with custom chunking strategy
88
examples/flow/02_summary_flow/
99
├── flows/
1010
│ └── summary_flow/
11+
│ ├── __init__.py # Module exports
1112
│ ├── prompts.yaml # Prompt templates
1213
│ └── flow.py # Mock LLM implementation (for testing)
1314
├── config.yaml # Flow configuration
@@ -37,6 +38,18 @@ examples/flow/02_summary_flow/
3738
- Smart provider inference (OpenAI models use `OPENAI_API_KEY`)
3839
- Secure configuration without hardcoded keys
3940

41+
## Easy Import Structure
42+
43+
With the new `__init__.py` file, you can import the demo flow cleanly:
44+
45+
```python
46+
# Import from flow directory
47+
from flows.summary_flow import DemoSummaryFlow
48+
49+
# Use in pipelines
50+
flow = DemoSummaryFlow(config)
51+
```
52+
4053
## Running the Demo
4154

4255
```bash
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Summary flow module."""
2+
3+
from .flow import DemoSummaryFlow
4+
5+
__all__ = ["DemoSummaryFlow"]

examples/flow/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Both examples showcase the core principles of the new flow architecture:
3535
3. **Direct Access**: No unnecessary wrapper methods, just direct access to resources
3636
4. **Template Separation**: Prompts in YAML files for easy editing and maintenance
3737
5. **Type Safety**: Pydantic-based configuration instead of complex schemas
38+
6. **Easy Imports**: Each flow directory has `__init__.py` for clean imports (e.g., `from flows.greeting_flow import GreetingFlow`)
3839

3940
## Quick Start
4041

0 commit comments

Comments
 (0)