-
Book Overview & Buying
-
Table Of Contents
Neural Search - From Prototype to Production with Jina
By :
Now that you know what Documents and Executors are and how to work with them, we can start to talk about Flow, one of the most important concepts in Jina.
Think of Flow as a manager in Jina; it takes care of all the tasks that will run on your application and will use Documents as its input and output.
The creation of a Flow in Jina is very easy and works just like any other object in Python. For example, this is how you would create an empty Flow:
from jina import Flow f = Flow()
In order to use a Flow, it’s best to always open it as a context manager, just like you would open a file in Python, by using the with function:
from jina import Flow f = Flow() with f: f.block()
Note
Flow follows a lazy construction pattern: it won’t actually run unless you use the with function to open it.
To add elements to your Flow, all you need to do is use the .add() method. You...