Sequential Workflows allow users to quickly swap in and out new operations to test new things all while having different operations logged.


Module Contents#

class relevanceai.workflow.sequential.Ops#

Base class for operations

class relevanceai.workflow.sequential.UpdateOp#

Inherit this class if you want documents to update at the end of this call

class relevanceai.workflow.sequential.Input(input_fields: list, chunksize: int = 20, filters: Optional[list] = None)#

Base class for operations

class relevanceai.workflow.sequential.Output(output_field: Union[str, list])#

Update documents

class relevanceai.workflow.sequential.SequentialWorkflow(list_of_operations: list, log_filename: str = 'workflow-run.txt')#

Defining a workflow with input and output fields and linking them up accordingly.


import random
from relevanceai import Client
from relevanceai.workflow.sequential import SequentialWorkflow

client = Client()

def vectorize(docs, *args, **kw):
    return [[random.randint(0, 100) for _ in range(3)] for _ in range(len(docs))]

workflow = SequentialWorkflow(
        Input(["sample_1_label"], chunksize=50),

ds = client.Dataset("_mock_dataset_"), verbose=True)
run(self, dataset: relevanceai.dataset.dataset.Dataset, verbose: bool = False, log_to_file: bool = False)#

Run the sequential workflow