Skip to content

Commit

Permalink
Update Unions
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkDaoust committed Jun 2, 2023
1 parent 3d93a3e commit 4d2e710
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions google/generativeai/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@
def configure(
*,
api_key: str | None = None,
credentials: Union[ga_credentials.Credentials, dict, None] = None,
credentials: ga_credentials.Credentials | dict | None = None,
# The user can pass a string to choose `rest` or `grpc` or 'grpc_asyncio'.
# See `_transport_registry` in `DiscussServiceClientMeta`.
# Since the transport classes align with the client classes it wouldn't make
# sense to accept a `Transport` object here even though the client classes can.
# We could accept a dict since all the `Transport` classes take the same args,
# but that seems rare. Users that need it can just switch to the low level API.
transport: Union[str, None] = None,
client_options: Union[client_options_lib.ClientOptions, dict, None] = None,
client_options: client_options_lib.ClientOptions | dict | None = None,
client_info: gapic_v1.client_info.ClientInfo | None = None,
):
"""Captures default client configuration.
Expand Down
2 changes: 1 addition & 1 deletion google/generativeai/notebook/flag_def.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@

# These are the intermediate types that argparse.ArgumentParser.parse_args()
# will pass command line arguments into.
_PARSETYPES = Union[str, int, float]
_PARSETYPES = str | int | float
# These are the final result types that the intermediate parsed values will be
# converted into. It is a superset of _PARSETYPES because we support converting
# the parsed type into a more precise type, e.g. from str to Enum.
Expand Down
2 changes: 1 addition & 1 deletion google/generativeai/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from google.generativeai.types import safety_types


def _make_text_prompt(prompt: Union[str, dict[str, str]]) -> glm.TextPrompt:
def _make_text_prompt(prompt: str | dict[str, str]) -> glm.TextPrompt:
if isinstance(prompt, str):
return glm.TextPrompt(text=prompt)
elif isinstance(prompt, dict):
Expand Down
2 changes: 1 addition & 1 deletion google/generativeai/types/discuss_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class MessageDict(TypedDict):
citation_metadata: citation_types.CitationMetadataDict | None


MessageOptions = Union[str, MessageDict, glm.Message]
MessageOptions = str | MessageDict | glm.Message
MESSAGE_OPTIONS = (str, dict, glm.Message)

MessagesOptions = Union[
Expand Down

0 comments on commit 4d2e710

Please sign in to comment.