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: docs/wiki/Workflows.md
+36-12Lines changed: 36 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -344,12 +344,29 @@ except TypeError as e:
344
344
345
345
Behind the `@Flow.call` decorator is where all the magic lives, including advanced features which are not yet well tested or have not yet been implemented. However, we walk through some of the more basic functionality to give an idea of how it can be used.
346
346
347
-
The behavior of the `@Flow.call` decorator can be controlled in two ways:
347
+
The behavior of the `@Flow.call` decorator can be controlled in several ways:
348
348
349
-
- by using the FlowOptionsOverride context (which allows you to scope changes to specific models, specific model types or all models)
350
349
- by passing arguments to it when defining the CallableModel to customize model-specific behavior
350
+
- by using the FlowOptionsOverride context (which allows you to scope changes to specific models, specific model types or all models)
351
+
- by setting `options` in the `meta` attribute of the CallableModel
352
+
- by passing `_options` directly to the `__call__` method
353
+
354
+
An example of the first one (model-specific options) is to disable validation of the result type on a particular model
355
+
356
+
```python
357
+
from ccflow import CallableModel, Flow, GenericResult, GenericContext
An example of the latter (model-specific options) is to disable validation of the result type on a particular model
389
+
If there is only a need to set the options for a specific model (and not any sub-models that it may call), then the `meta` attribute or passing `_options` to the `__call__` method are better options.
390
+
Setting `meta.options` is particularly useful when the model is being loaded from a configuration file, though it can be done interactively as well to persist the options with the model instance.
373
391
374
392
```python
375
-
from ccflow import CallableModel, Flow, GenericResult, GenericContext
393
+
model = FizzBuzzModel()
394
+
model.meta.options = {"log_level": logging.WARN}
395
+
_ = model(15)
396
+
#[FizzBuzzModel]: Start evaluation of __call__ on GenericContext[int](value=15).
0 commit comments