Understanding Effect's Dependency Injection with `provideSystem` and Context Tags
In my continuous exploration of Effect some concepts are starting to click for me.
However, to be completely sure that my understanding is at least right, I decided to try to explain it and hopefully get confirmation or comments correcting what I am wrongly assuming.
Here is my question with a lot of exposition to see if my understanding is correct.
I had the following piece of code, which I took inspiration from Tim's examples to create it (copy-paste then modify it
)
At certain point I asked myself... how is that
Had a look at the implementation of
So all it does is taking any effect, then provide the
continue in thread
However, to be completely sure that my understanding is at least right, I decided to try to explain it and hopefully get confirmation or comments correcting what I am wrongly assuming.
Here is my question with a lot of exposition to see if my understanding is correct.
I had the following piece of code, which I took inspiration from Tim's examples to create it (copy-paste then modify it
At certain point I asked myself... how is that
provideSystem reaching the inner completions if the effect that results from the completion call is not directly returned in the wrapping effect, and I don't see any "direct" way they can connect? Still, the openAi call was somehow including that system instruction in the payload.Had a look at the implementation of
provideSystem, which was surprisingly simple (removing the complex type annotations and dual wrappers...)So all it does is taking any effect, then provide the
SystemInstruction service which is just a string service which is the provided string.continue in thread
