Skip to content

Commit 85ee8c1

Browse files
rozhaMarkDaoust
andauthored
Fix Model dataclass (#439)
* Fix Model dataclass Dataclass Model misses max_temperature field which brakes list_models() * Fix to handle max_temperature Change-Id: I0cdacd0134c868044ae5b96322b266224d7b8a69 * Fix type error. Change-Id: I5db22405c93b66fd268b19f1e081dc24f3246d24 --------- Co-authored-by: Mark Daoust <[email protected]>
1 parent 0f7723e commit 85ee8c1

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

google/generativeai/types/model_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ class Model:
117117
output_token_limit: int
118118
supported_generation_methods: list[str]
119119
temperature: float | None = None
120+
max_temperature: float | None = None
120121
top_p: float | None = None
121122
top_k: int | None = None
122123

tests/test_models.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def setUp(self):
4444

4545
client._client_manager.clients["model"] = self.client
4646

47-
# TODO(markdaoust): Check if typechecking works better if wee define this as a
47+
# TODO(markdaoust): Check if typechecking works better if we define this as a
4848
# subclass of `glm.ModelServiceClient`, would pyi files for `glm`. help?
4949
def add_client_method(f):
5050
name = f.__name__
@@ -160,6 +160,15 @@ def test_get_model(self, name):
160160
else:
161161
self.assertIsInstance(model, model_types.TunedModel)
162162

163+
def test_max_temperature(self):
164+
name = "models/fake-bison-001"
165+
max_temperature = 3.0
166+
self.responses = {
167+
"get_model": protos.Model(name=name, max_temperature=max_temperature),
168+
}
169+
model = models.get_base_model(name)
170+
self.assertEqual(max_temperature, model.max_temperature)
171+
163172
@parameterized.named_parameters(
164173
["simple", "mystery-bison-001"],
165174
["model-instance", protos.Model(name="how?-bison-001")],

0 commit comments

Comments
 (0)