Skip to content

Conversation

@lindseystead
Copy link

Fixes #83

This PR fixes an issue where only the first conversation turn was being ingested
when using AzureOpenAI with Memori.

Root cause

On subsequent invocations, conversation_id was not reliably resolved early
enough in the request lifecycle. This prevented prior messages from being
injected and caused new messages to not consistently be written to the same
conversation.

Changes

  • Ensured session_id and conversation_id are resolved early in
    inject_conversation_messages so prior messages can be injected correctly
  • Used idempotent conversation.create() to safely retrieve or create the
    active conversation within the timeout window
  • Ensured only new messages are written while injected history is excluded
    to prevent duplication
  • Added logging to surface when memory is written and which conversation/session
    is used
  • Added test coverage verifying all conversation turns are ingested

Result

  • Every user message is ingested on every turn
  • Every assistant response is ingested on every turn
  • Previous messages are injected for context without duplication
  • Public APIs and AzureOpenAI usage remain unchanged

Fixes MemoriLabs#83

- Ensure conversation_id is resolved early in inject_conversation_messages
- Add logging to track memory writes
- Add test for multi-turn conversation ingestion
- Update CHANGELOG.md
- Fixes issue where only first turn was being recorded
@devwdave
Copy link
Collaborator

Hi @lindseystead
Thanks for catching this and making a contribution. Do you mind creating an issue(bug) for this PR? We will review the issue and PR and provide feedback if necessary.

Thanks again!

@lindseystead
Copy link
Author

Created issue #233 as requested. The issue documents the bug and links to this PR.

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.

Fix the AzureOpenAI

2 participants