Skip to content

Commit aed41ec

Browse files
MarkDaoustcopybara-github
authored andcommitted
feat: [Interactions] Add FileCitation.{custom_metadata,media_id,page_number}
PiperOrigin-RevId: 904646307
1 parent dd79904 commit aed41ec

5 files changed

Lines changed: 29 additions & 32 deletions

File tree

google/genai/_interactions/types/content_delta.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@
5757
"DeltaMCPServerToolResult",
5858
"DeltaMCPServerToolResultResultFunctionResultSubcontentList",
5959
"DeltaFileSearchResult",
60-
"DeltaFileSearchResultResult",
6160
"DeltaGoogleMapsResult",
6261
"DeltaTextAnnotation",
6362
]
@@ -345,18 +344,11 @@ class DeltaMCPServerToolResult(BaseModel):
345344
"""A signature hash for backend validation."""
346345

347346

348-
class DeltaFileSearchResultResult(BaseModel):
349-
"""The result of the File Search."""
350-
351-
custom_metadata: Optional[List[object]] = None
352-
"""User provided metadata about the FileSearchResult."""
353-
354-
355347
class DeltaFileSearchResult(BaseModel):
356348
call_id: str
357349
"""Required. ID to match the ID from the function call block."""
358350

359-
result: List[DeltaFileSearchResultResult]
351+
result: List[object]
360352

361353
type: Literal["file_search_result"]
362354

google/genai/_interactions/types/file_citation.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
1717

18-
from typing import Optional
18+
from typing import Dict, Optional
1919
from typing_extensions import Literal
2020

2121
from .._models import BaseModel
@@ -28,6 +28,9 @@ class FileCitation(BaseModel):
2828

2929
type: Literal["file_citation"]
3030

31+
custom_metadata: Optional[Dict[str, object]] = None
32+
"""User provided metadata about the retrieved context."""
33+
3134
document_uri: Optional[str] = None
3235
"""The URI of the file."""
3336

@@ -37,6 +40,12 @@ class FileCitation(BaseModel):
3740
file_name: Optional[str] = None
3841
"""The name of the file."""
3942

43+
media_id: Optional[str] = None
44+
"""Media ID in-case of image citations, if applicable."""
45+
46+
page_number: Optional[int] = None
47+
"""Page number of the cited document, if applicable."""
48+
4049
source: Optional[str] = None
4150
"""Source attributed for a portion of the text."""
4251

google/genai/_interactions/types/file_citation_param.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
from __future__ import annotations
1919

20+
from typing import Dict
2021
from typing_extensions import Literal, Required, TypedDict
2122

2223
__all__ = ["FileCitationParam"]
@@ -27,6 +28,9 @@ class FileCitationParam(TypedDict, total=False):
2728

2829
type: Required[Literal["file_citation"]]
2930

31+
custom_metadata: Dict[str, object]
32+
"""User provided metadata about the retrieved context."""
33+
3034
document_uri: str
3135
"""The URI of the file."""
3236

@@ -36,6 +40,12 @@ class FileCitationParam(TypedDict, total=False):
3640
file_name: str
3741
"""The name of the file."""
3842

43+
media_id: str
44+
"""Media ID in-case of image citations, if applicable."""
45+
46+
page_number: int
47+
"""Page number of the cited document, if applicable."""
48+
3949
source: str
4050
"""Source attributed for a portion of the text."""
4151

google/genai/_interactions/types/file_search_result_content.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,7 @@
2020

2121
from .._models import BaseModel
2222

23-
__all__ = ["FileSearchResultContent", "Result"]
24-
25-
26-
class Result(BaseModel):
27-
"""The result of the File Search."""
28-
29-
custom_metadata: Optional[List[object]] = None
30-
"""User provided metadata about the FileSearchResult."""
23+
__all__ = ["FileSearchResultContent"]
3124

3225

3326
class FileSearchResultContent(BaseModel):
@@ -36,10 +29,10 @@ class FileSearchResultContent(BaseModel):
3629
call_id: str
3730
"""Required. ID to match the ID from the function call block."""
3831

39-
result: List[Result]
40-
"""Required. The results of the File Search."""
41-
4232
type: Literal["file_search_result"]
4333

34+
result: Optional[List[object]] = None
35+
"""Optional. The results of the File Search."""
36+
4437
signature: Optional[str] = None
4538
"""A signature hash for backend validation."""

google/genai/_interactions/types/file_search_result_content_param.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,7 @@
2424
from .._utils import PropertyInfo
2525
from .._models import set_pydantic_config
2626

27-
__all__ = ["FileSearchResultContentParam", "Result"]
28-
29-
30-
class Result(TypedDict, total=False):
31-
"""The result of the File Search."""
32-
33-
custom_metadata: Iterable[object]
34-
"""User provided metadata about the FileSearchResult."""
27+
__all__ = ["FileSearchResultContentParam"]
3528

3629

3730
class FileSearchResultContentParam(TypedDict, total=False):
@@ -40,11 +33,11 @@ class FileSearchResultContentParam(TypedDict, total=False):
4033
call_id: Required[str]
4134
"""Required. ID to match the ID from the function call block."""
4235

43-
result: Required[Iterable[Result]]
44-
"""Required. The results of the File Search."""
45-
4636
type: Required[Literal["file_search_result"]]
4737

38+
result: Iterable[object]
39+
"""Optional. The results of the File Search."""
40+
4841
signature: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
4942
"""A signature hash for backend validation."""
5043

0 commit comments

Comments
 (0)