Skip to content

Commit 0dccd83

Browse files
Ark-kuncopybara-github
authored andcommitted
chore: GenAI - Validating history in the ChatSession constructor
PiperOrigin-RevId: 590588154
1 parent b647ef9 commit 0dccd83

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

vertexai/generative_models/_generative_models.py

+4
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,10 @@ def __init__(
655655
history: Optional[List["Content"]] = None,
656656
raise_on_blocked: bool = True,
657657
):
658+
if history:
659+
if not all(isinstance(item, Content) for item in history):
660+
raise ValueError("history must be a list of Content objects.")
661+
658662
self._model = model
659663
self._history = history or []
660664
self._raise_on_blocked = raise_on_blocked

0 commit comments

Comments
 (0)