Skip to content

Commit 50dce5b

Browse files
aelisseekibergus
authored andcommitted
internal changes
PiperOrigin-RevId: 818554170
1 parent 703b165 commit 50dce5b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

genai_processors/content_api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(
4747
mimetype: str | None = None,
4848
metadata: dict[str, Any] | None = None,
4949
) -> None:
50-
"""Constructs a ProcessorPart using a `Part` or `ProcessorPart`.
50+
"""Constructs a ProcessorPart.
5151
5252
Args:
5353
value: The content to use to construct the ProcessorPart.
@@ -62,9 +62,9 @@ def __init__(
6262
substream_name, unless it is overridden in this argument.
6363
mimetype: Mime type of the data.
6464
metadata: (Optional) Auxiliary information about the part. If the
65-
`ProcessorPart` is created using another `ProcessorPart`, this
66-
ProcessorPart inherits the existing metadata, unless it is overridden in
67-
this argument.
65+
`ProcessorPart` is created using another `ProcessorPart` or a
66+
`content_pb2.Part`, this ProcessorPart inherits the existing metadata,
67+
unless it is overridden in this argument.
6868
"""
6969
super().__init__()
7070
self._metadata = {}
@@ -77,7 +77,8 @@ def __init__(
7777
role = role or value.role
7878
substream_name = substream_name or value.substream_name
7979
mimetype = mimetype or value.mimetype
80-
self._metadata.update(value.metadata)
80+
self._metadata = value.metadata
81+
self._metadata.update(metadata or {})
8182
case str():
8283
self._part = genai_types.Part(text=value)
8384
case bytes():
@@ -329,7 +330,7 @@ def from_function_response(
329330
name: str,
330331
response: dict[str, Any],
331332
function_call_id: str | None = None,
332-
will_continue: bool = False,
333+
will_continue: bool | None = None,
333334
scheduling: genai_types.FunctionResponseScheduling | None = None,
334335
**kwargs,
335336
) -> 'ProcessorPart':
@@ -500,7 +501,6 @@ def __init__(
500501
*parts: 'ProcessorContentTypes',
501502
) -> None:
502503
"""Constructs a new Content object from the given inputs."""
503-
504504
self.replace_parts(*parts)
505505

506506
self.as_text = functools.partial(as_text, self)

0 commit comments

Comments
 (0)