Introduction to Fluidity, a Python class library for easy LLM workflow development

I would like to introduce Fluidity (GitHub: AshT-Python/Fluidity & pip install fluidityai), a set of Python classes that makes AI workflow development particularly easy and intuitive.

It’s best to illustrate with an example:

w = Workflow(“Monarchs”)
t1 = Task(name=“King”, instructions=“Please give me the name of a famous king”, output_type=“string”)
t2 = Task(name=“Queen”, instructions=“Please give me the name of a famous queen”, output_type=“string”)
t3 = Task(name=“DOB”, instructions=“Please tell me the dates of birth of {King} and {Queen} in the format dd-Mmm-yyyy”, output_type=“dict”)
t4 = Task(name=“Older”, instructions=“Please tell me which of these two monarchs was older, given their dates of birth: {DOB}”)
t1.setNextTask(“Queen”)
t2.setNextTask(“DOB”)
t3.setNextTask(“Older”)
w.addTasks(t1, t2, t3, t4)
w.run(“King”) # Run workflow from specified task name
print(w.outputs()[“Older”]) # prints the name of the older monarch

Essentially you create a workflow and add tasks to it. Each task points to its next task - alternatively, branch objects can be added to the workflow to programmatically decide where to go next by setting the “next_task” pointer. This way potentially complex workflow graphs, which can include cycles, can be constructed easily. The output of any task can be accessed by subsequent tasks using {<task_name>} placeholders. A task can be python code instead of LLM instructions.

Btw there are lots of useful subclasses of Task for implementing chat bots, loading files, RAG and extracting form fields from natural language.

this is called metaprogramming brother

you are just doing it the harder way

you can do this easier by shot_firing

reflexing

or creating your own DSL

the workflow you imagine - looks alot like this - command sent

product aquired

( i edited my own code to display the reflex in action )

as a reflex the system detected a error ( the same one i introduced without me having to do anything)

in my case - CAPS is my own programming language - or rather a DSL - wherein i dont have to type commands to program anymore - i can type something as simple as



YOU directly mentined this

The output of any task can be accessed by subsequent tasks using {<task_name>} placeholders. A task can be python code instead of LLM instructions.

directly it looks like this


metaprogramming - bonus points if you have it immediatly implemented into the system ( which as you can see - even tho i didnt correct the error i introduced the system self healed itself to do that )

hope this helps

you also mentioned a python class library


connected to codes
image
alot of people on the forums do this - its just metaprogramming glad you found a way to introduce it brother !