Skip to content

Commit 3e1c786

Browse files
fix(py): fix the bug in sample of say-hi-with-configured-temperature of google-genai (#4002)
Co-authored-by: Mengqin Shen <mengqin@google.com>
1 parent a535008 commit 3e1c786

File tree

2 files changed

+5
-5
lines changed
  • py
    • plugins/google-genai/src/genkit/plugins/google_genai/models
    • samples/evaluator-demo/src

2 files changed

+5
-5
lines changed

py/plugins/google-genai/src/genkit/plugins/google_genai/models/gemini.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,10 +670,11 @@ async def generate(self, request: GenerateRequest, ctx: ActionRunContext) -> Gen
670670
Returns:
671671
The model's response to the generation request.
672672
"""
673-
try:
674-
model_name = request.config.version
675-
except AttributeError:
676-
model_name = self._version
673+
model_name = self._version
674+
if request.config:
675+
version = getattr(request.config, 'version', None)
676+
if version:
677+
model_name = version
677678

678679
# TODO: do not move - this method mutates `request` by extracting system prompts into configuration object
679680
request_cfg = self._genkit_to_googleai_cfg(request=request)

py/samples/evaluator-demo/src/eval_demo.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ async def substring_match(datapoint: BaseDataPoint, options: Any | None):
5454
)
5555

5656

57-
5857
# Define a flow that programmatically runs the evaluation
5958
@ai.flow()
6059
async def run_eval_demo(dataset_input: List[BaseDataPoint] | None = None):

0 commit comments

Comments
 (0)