Using `Ref` for State Management in Effect
I'm currently migrating an AI pipeline to effect.
Its basically entity and relationship extraction, we provide a text with the prompt, we get the output, after that we pass in the output / entire history of that completion to another llm which then decideds if entities where missed and if so performs another gleaning.
This cycle happens multiple times until the second llm decides we are done.
Now I wondered what the best way with effect is to share the state / the history that continues to grow.
The normal extracion and the gleaning are 2 seperate effects.
Is just using Ref the way to go here:
https://effect.website/docs/state-management/ref/#using-ref-as-a-service
Found this and seems quite like what i want
Its basically entity and relationship extraction, we provide a text with the prompt, we get the output, after that we pass in the output / entire history of that completion to another llm which then decideds if entities where missed and if so performs another gleaning.
This cycle happens multiple times until the second llm decides we are done.
Now I wondered what the best way with effect is to share the state / the history that continues to grow.
The normal extracion and the gleaning are 2 seperate effects.
Is just using Ref the way to go here:
https://effect.website/docs/state-management/ref/#using-ref-as-a-service
Found this and seems quite like what i want
Effect Documentation
Learn how to manage state in concurrent applications using Effect's Ref data type. Master mutable references for safe, controlled state updates across fibers.
