From cf16232ece13b52f205b86a99f8fba3aa4192e72 Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Wed, 19 Feb 2025 17:11:30 -0800 Subject: [PATCH 1/2] IDK how this test is failing, but it shouldn't be here Change-Id: Ifd983a42a18f14df3c3b5dd8d4ac098a0e2bcf76 --- tests/test_models.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/tests/test_models.py b/tests/test_models.py index c7cd1dbcd..6f10f9123 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -169,14 +169,6 @@ def test_max_temperature(self): model = models.get_base_model(name) self.assertEqual(max_temperature, model.max_temperature) - @parameterized.named_parameters( - ["simple", "mystery-bison-001"], - ["model-instance", protos.Model(name="how?-bison-001")], - ) - def test_fail_with_unscoped_model_name(self, name): - with self.assertRaises(ValueError): - model = models.get_model(name) - def test_list_models(self): # The low level lib wraps the response in an iterable, so this is a fair test. self.responses = { From 24964ebc12ea1de632e40551a3f97f78ed72d0be Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Wed, 19 Feb 2025 17:18:16 -0800 Subject: [PATCH 2/2] black Change-Id: I972cdea7e3a4bd845dd849161d452b4f16134bfb --- google/generativeai/notebook/command_utils.py | 2 +- google/generativeai/notebook/lib/llm_function.py | 4 ++-- tests/notebook/lib/test_llm_function.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google/generativeai/notebook/command_utils.py b/google/generativeai/notebook/command_utils.py index 355592c21..f4432c0c2 100644 --- a/google/generativeai/notebook/command_utils.py +++ b/google/generativeai/notebook/command_utils.py @@ -106,7 +106,7 @@ def create_llm_function( def _convert_simple_compare_fn( - name_and_simple_fn: tuple[str, Callable[[str, str], Any]] + name_and_simple_fn: tuple[str, Callable[[str, str], Any]], ) -> tuple[str, llm_function.CompareFn]: simple_fn = name_and_simple_fn[1] new_fn = lambda x, y: simple_fn(x.result_value(), y.result_value()) diff --git a/google/generativeai/notebook/lib/llm_function.py b/google/generativeai/notebook/lib/llm_function.py index c3eb7b52d..c4f379828 100644 --- a/google/generativeai/notebook/lib/llm_function.py +++ b/google/generativeai/notebook/lib/llm_function.py @@ -64,7 +64,7 @@ def _convert_compare_fn_to_batch_add_fn( llmfn_output_row.LLMFnOutputRowView, ], Any, - ] + ], ) -> llmfn_post_process.LLMCompareFnPostProcessBatchAddFn: """Vectorize a single-row-based comparison function.""" @@ -74,7 +74,7 @@ def _fn( llmfn_output_row.LLMFnOutputRowView, llmfn_output_row.LLMFnOutputRowView, ] - ] + ], ) -> Sequence[Any]: return [fn(lhs, rhs) for lhs, rhs in lhs_and_rhs_rows] diff --git a/tests/notebook/lib/test_llm_function.py b/tests/notebook/lib/test_llm_function.py index 896e49c88..008ed7a38 100644 --- a/tests/notebook/lib/test_llm_function.py +++ b/tests/notebook/lib/test_llm_function.py @@ -393,7 +393,7 @@ def _is_length_greater_than(lhs: Mapping[str, Any], rhs: Mapping[str, Any]) -> b # Batch-based comparison function for post-processing. def _sum_of_lengths( - rows: Sequence[tuple[Mapping[str, Any], Mapping[str, Any]]] + rows: Sequence[tuple[Mapping[str, Any], Mapping[str, Any]]], ) -> Sequence[int]: return [lhs["length"] + rhs["length"] for lhs, rhs in rows]