Fix agent scopes, and add documentation #45
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently the
agent
blocks were updating theAtomic
reference inside theAIScope
, this mean that agents could change during the execution of such a block.Since these blocks can be executed in parallel using
parMap
, or other concurrency operators. To prevent this I've scoped the lambdas toAIScope
which create a child scope with an updated agent parameter. This way the blocks are truly scoped.This PR also adds documentation to the current
AI
data type, and DSL.Discussion / future work
This brings to question what to do with
VectorStore
, should anagent(..) { }
block have it's own scopedVectorStore
whilst also having access to theVectorStore
of it's parent? We potentially have some kind-of factory to createVectorStore
and compose them together by query'ing both and aggregating the results.This brings to question to what to do with persistent vector stores like
Postgres
since all storage there is shared, and persisted across allai
calls and even multiple runs of the application. To avoid this we could create unique tables, which are destroyed at the end of anagent
block but I guess that defeats the purpose of having a persisted vector store?WDYT? @xebia-functional/team-ai