Skip to content

Conversation

@harshalmore31
Copy link
Collaborator

This pull request adds support for the new google-genai SDK response format and fixes #246 (which uses a candidates attribute instead of the old protobuf _pb attribute) to the LLM base classes. It also introduces comprehensive tests to ensure correct handling of both streaming and non-streaming responses in the new format, while maintaining backwards compatibility with the old format.

Support for new google-genai SDK response format:

  • Updated _format_response and process_chunk methods in memori/llm/_base.py to detect and correctly parse responses and streaming chunks using the new google-genai SDK format, which uses a candidates attribute instead of _pb [1] [2].

Testing and backwards compatibility:

  • Added a new test module tests/llm/test_llm_google_genai.py with extensive tests for both the new (no _pb) and old (protobuf) google-genai formats, covering both streaming and non-streaming response handling, as well as format detection and role preservation.

devwdave
devwdave previously approved these changes Jan 5, 2026
@devwdave devwdave merged commit 09c5bae into MemoriLabs:main Jan 5, 2026
6 checks passed
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.

[Bug] google-genai wrapper fails to detect streaming response

2 participants