Skip to content

fix(agents): generate proper history blocks in agent#570

Merged
douglas-reid merged 1 commit intomainfrom
doug/debug-duplicate-messages
Oct 3, 2023
Merged

fix(agents): generate proper history blocks in agent#570
douglas-reid merged 1 commit intomainfrom
doug/debug-duplicate-messages

Conversation

@douglas-reid
Copy link
Copy Markdown
Contributor

With the inflight changes for streaming, we unfortunately merged a commit that left message selection in a broken state. The existing testing was not enough to capture the issue. This PR attempts to restore proper message selection functionality.

Follow on PRs will be necessary to clean up and streamline the selection bits added in this PR.

@douglas-reid douglas-reid requested review from dkolas and eob October 3, 2023 06:43
@@ -67,10 +72,8 @@ def build_chat_history_for_tool(self, context: AgentContext) -> List[Block]:
# this should happen BEFORE any agent/assistant messages related to tool selection
messages.append(context.chat_history.last_user_message)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I right that this will result in the following message list:

  • System Message
  • Topic-Selected Ancient Messages In Order
  • Last User Message
  • Last Action

I feel like if I was the LLM, I would want to see at the very least the last K messages from the history, in order, and the topic-selected list shouldn't include any that were included in the Last K messages list.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have:

  1. System message
  2. Semantic match historical messages
  3. Context-window messages (user <--> assistant and currently assistant<-->tool)
  4. Last User message
  5. Scratchpad messages.

(2) and (3) should be de-duped and sorted by file index (which is a current placeholder for temporal order).

So, I think that we are meeting your notional LLM requirements.

@douglas-reid douglas-reid added this pull request to the merge queue Oct 3, 2023
Merged via the queue into main with commit b9e32cc Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants