You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+82Lines changed: 82 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -327,6 +327,88 @@ Components that transform frames:
327
327
328
328
Read core.async.flow docs for more information about flow precesses.
329
329
330
+
## Modular Processor Functions
331
+
332
+
Simulflow processors are designed for modularity and reuse. Each processor can expose its core functionality as multi-arity functions that can be used independently or composed into custom processors.
333
+
334
+
### Multi-Arity Function Pattern
335
+
336
+
Processors follow a standard multi-arity pattern that maps directly to `core.async.flow` lifecycle:
(transport/mic-transport-transform state input-port data)
392
+
393
+
;; Handle text using LLM transform
394
+
(frame/llm-context? data)
395
+
(openai/transform state input-port data)
396
+
397
+
;; Custom handling for other frames
398
+
:else
399
+
[state {:out [(custom-transform data)]}])))
400
+
```
401
+
402
+
### Benefits of Modular Functions
403
+
404
+
-**Reusability**: Use processor logic across different flows
405
+
-**Testability**: Test individual transform functions in isolation
406
+
-**Composability**: Mix and match functionality from different processors
407
+
-**Customization**: Override specific behaviors while reusing core logic
408
+
-**Debugging**: Easier to debug individual components
409
+
410
+
This pattern enables building complex AI pipelines by composing smaller, well-tested components while maintaining the data-driven architecture that makes simulflow powerful.
0 commit comments