Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions google/genai/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,6 @@

if typing.TYPE_CHECKING:
import yaml
else:
try:
import yaml
except ImportError:
yaml = None

_is_httpx_imported = False
if typing.TYPE_CHECKING:
Expand Down Expand Up @@ -10298,7 +10293,9 @@ def to_yaml_file(self, file_path: str, version: Optional[str] = None) -> None:
Raises:
ImportError: If the pyyaml library is not installed.
"""
if yaml is None:
try:
import yaml
except ImportError:
raise ImportError(
'YAML serialization requires the pyyaml library. Please install'
" it using 'pip install google-cloud-aiplatform[evaluation]'."
Expand Down