fix: add pygemma API comment and model-mismatch warning to stream()

- Document that pygemma v0.1.3 completion() does not accept
  temperature/max_tokens (params accepted for ABC compliance)
- Add model-mismatch warning to stream() for consistency with generate()

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jon Saad-Falcon
2026-03-25 13:22:13 -07:00
co-authored by Claude Opus 4.6
parent e4d036dd50
commit d44076db3f
+10
View File
@@ -108,6 +108,9 @@ class GemmaCppEngine(InferenceEngine):
)
prompt = self._messages_to_prompt(messages)
try:
# pygemma v0.1.3 completion() does not accept temperature/max_tokens;
# these params are accepted in the signature for ABC compliance but
# not forwarded until pygemma or a vendored wrapper supports them.
raw = self._gemma.completion(prompt)
except Exception as exc:
raise RuntimeError(f"gemma.cpp inference failed: {exc}") from exc
@@ -135,6 +138,13 @@ class GemmaCppEngine(InferenceEngine):
**kwargs: Any,
) -> AsyncIterator[str]:
self._ensure_loaded()
if model != self._model_type:
logger.warning(
"gemma_cpp: requested model %r but loaded model is %r; "
"proceeding with loaded model",
model,
self._model_type,
)
prompt = self._messages_to_prompt(messages)
try:
raw = self._gemma.completion(prompt)