FEAT Allow preserving order of message in memory with intermediary message in target #1149
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.
Description
This PR fixes an issue in the conversation flow where the prompt was not stored in the central memory before being sent via send_prompt_async in
PromptNormalizer. Previously, the flow would first callsend_prompt_async, and only afterward would the prompt be added to the central memory.Additionally,
send_prompt_asynccurrently only returns a singleMessagecontainingMessagePieceobjects of a single type. This limitation prevented proper handling of intermediary steps in targets such asOpenAIResponseTarget, since those messages were not being stored anywhere. Attempts to store them in the central memory directly by modifying the target resulted in out-of-order messages due to the aforementioned sequencing issue.This PR addresses the problem by:
Ensuring that the prompt is first inserted into the central memory before calling
send_prompt_async.Simplifying error-handling logic by removing redundant calls that are now unnecessary thanks to the corrected flow.
As a result, intermediary messages can now be correctly ordered and consistently stored in the central memory.
Tests and Documentation
N/A