Description
This PR updates the GeminiClient in core/intelligence/llm_client.py to correctly extract and return the inner text from the Google Generative AI response, standardizing the return type to str across all LLM clients.
Why this is necessary
The BaseLLMClient abstract class defines a strict contract that the complete() method must return a str. Currently, OpenAIClient and LlamaClient honor this contract. However, GeminiClient was returning the raw types.GenerateContentResponse Python object.
This is a violation of the Liskov Substitution Principle (LSP) and can cause runtime crashes whenever the backend is switched to Gemini.
Any downstream consumer of the LLM client (such as TaskDecomposer) that attempts to run standard string methods like .strip(), .split(), or len() on the complete() output may fail with an AttributeError if LLM_BACKEND=gemini.
Proposed Fix
- Updated the return type hint on
GeminiClient.complete() from types.GenerateContentResponse to str
- Modified the return statement to extract the text property via
return response.text
Type of Change
Testing
- Verified that downstream consumers can now reliably call
.strip() and other string methods regardless of the configured LLM backend
Description
This PR updates the
GeminiClientincore/intelligence/llm_client.pyto correctly extract and return the inner text from the Google Generative AI response, standardizing the return type tostracross all LLM clients.Why this is necessary
The
BaseLLMClientabstract class defines a strict contract that thecomplete()method must return astr. Currently,OpenAIClientandLlamaClienthonor this contract. However,GeminiClientwas returning the rawtypes.GenerateContentResponsePython object.This is a violation of the Liskov Substitution Principle (LSP) and can cause runtime crashes whenever the backend is switched to Gemini.
Any downstream consumer of the LLM client (such as
TaskDecomposer) that attempts to run standard string methods like.strip(),.split(), orlen()on thecomplete()output may fail with anAttributeErrorifLLM_BACKEND=gemini.Proposed Fix
GeminiClient.complete()fromtypes.GenerateContentResponsetostrreturn response.textType of Change
Testing
.strip()and other string methods regardless of the configured LLM backend