Skip to content

Commit d530650

Browse files
feat: [google-ai-generativelanguage] add CODE_RETRIEVAL_QUERY embedding task type (#13846)
- [ ] Regenerate this pull request now. BEGIN_COMMIT_OVERRIDE feat: add CODE_RETRIEVAL_QUERY embedding task type feat: add seed to GenerationConfig feat: add support for ModalityTokenCounts in UsageMetadata responses feat: add support for live API (googleapis/go-genai#275) feat: add support for Veo: PredictLongRunning and generated/downloadable files feat: add minimum, maximum, any_of, property_ordering, default and null type to Schema feat: add support for ModalityTokenCounts in UsageMetadata responses feat: add CODE_RETRIEVAL_QUERY embedding task type feat: add language_code to speech config feat: add ThinkingConfig, MediaResolution, and seed to GenerationConfig END_COMMIT_OVERRIDE PiperOrigin-RevId: 752418245 Source-Link: googleapis/googleapis@dcb6c86 Source-Link: googleapis/googleapis-gen@3461f46 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiMzQ2MWY0NmU3ZWY1MDRkYzliMDYwY2MzZGI3YjBmYmJkM2M5ZWRjZiJ9 BEGIN_NESTED_COMMIT PiperOrigin-RevId: 752332723 Source-Link: googleapis/googleapis@c76b740 Source-Link: googleapis/googleapis-gen@44b4d1a Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWFpLWdlbmVyYXRpdmVsYW5ndWFnZS8uT3dsQm90LnlhbWwiLCJoIjoiNDRiNGQxYWVkNWQ4OTM4M2Q5OGZmZWNkYjRjMmRiZWE2OGMyMjE2MyJ9 END_NESTED_COMMIT --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 7679765 commit d530650

47 files changed

Lines changed: 6280 additions & 205 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/google-ai-generativelanguage/google/ai/generativelanguage/__init__.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@
100100
GoogleSearchRetrieval,
101101
GroundingPassage,
102102
GroundingPassages,
103+
Modality,
104+
ModalityTokenCount,
103105
Part,
104106
Schema,
105107
Tool,
@@ -120,16 +122,31 @@
120122
CreateFileRequest,
121123
CreateFileResponse,
122124
DeleteFileRequest,
125+
DownloadFileRequest,
126+
DownloadFileResponse,
123127
GetFileRequest,
124128
ListFilesRequest,
125129
ListFilesResponse,
126130
)
127131
from google.ai.generativelanguage_v1beta.types.generative_service import (
128132
AttributionSourceId,
133+
AudioTranscriptionConfig,
129134
BatchEmbedContentsRequest,
130135
BatchEmbedContentsResponse,
136+
BidiGenerateContentClientContent,
137+
BidiGenerateContentClientMessage,
138+
BidiGenerateContentRealtimeInput,
139+
BidiGenerateContentServerContent,
140+
BidiGenerateContentServerMessage,
141+
BidiGenerateContentSetup,
142+
BidiGenerateContentSetupComplete,
143+
BidiGenerateContentToolCall,
144+
BidiGenerateContentToolCallCancellation,
145+
BidiGenerateContentToolResponse,
146+
BidiGenerateContentTranscription,
131147
Candidate,
132148
ContentEmbedding,
149+
ContextWindowCompressionConfig,
133150
CountTokensRequest,
134151
CountTokensResponse,
135152
EmbedContentRequest,
@@ -139,18 +156,24 @@
139156
GenerateContentRequest,
140157
GenerateContentResponse,
141158
GenerationConfig,
159+
GoAway,
142160
GroundingAttribution,
143161
GroundingChunk,
144162
GroundingMetadata,
145163
GroundingSupport,
146164
LogprobsResult,
147165
PrebuiltVoiceConfig,
166+
RealtimeInputConfig,
148167
RetrievalMetadata,
149168
SearchEntryPoint,
150169
Segment,
151170
SemanticRetrieverConfig,
171+
SessionResumptionConfig,
172+
SessionResumptionUpdate,
152173
SpeechConfig,
153174
TaskType,
175+
ThinkingConfig,
176+
UsageMetadata,
154177
VoiceConfig,
155178
)
156179
from google.ai.generativelanguage_v1beta.types.model import Model
@@ -178,8 +201,14 @@
178201
UpdatePermissionRequest,
179202
)
180203
from google.ai.generativelanguage_v1beta.types.prediction_service import (
204+
GenerateVideoResponse,
205+
Media,
206+
PredictLongRunningMetadata,
207+
PredictLongRunningRequest,
208+
PredictLongRunningResponse,
181209
PredictRequest,
182210
PredictResponse,
211+
Video,
183212
)
184213
from google.ai.generativelanguage_v1beta.types.retriever import (
185214
Chunk,
@@ -294,10 +323,12 @@
294323
"GoogleSearchRetrieval",
295324
"GroundingPassage",
296325
"GroundingPassages",
326+
"ModalityTokenCount",
297327
"Part",
298328
"Schema",
299329
"Tool",
300330
"ToolConfig",
331+
"Modality",
301332
"Type",
302333
"CountMessageTokensRequest",
303334
"CountMessageTokensResponse",
@@ -311,14 +342,29 @@
311342
"CreateFileRequest",
312343
"CreateFileResponse",
313344
"DeleteFileRequest",
345+
"DownloadFileRequest",
346+
"DownloadFileResponse",
314347
"GetFileRequest",
315348
"ListFilesRequest",
316349
"ListFilesResponse",
317350
"AttributionSourceId",
351+
"AudioTranscriptionConfig",
318352
"BatchEmbedContentsRequest",
319353
"BatchEmbedContentsResponse",
354+
"BidiGenerateContentClientContent",
355+
"BidiGenerateContentClientMessage",
356+
"BidiGenerateContentRealtimeInput",
357+
"BidiGenerateContentServerContent",
358+
"BidiGenerateContentServerMessage",
359+
"BidiGenerateContentSetup",
360+
"BidiGenerateContentSetupComplete",
361+
"BidiGenerateContentToolCall",
362+
"BidiGenerateContentToolCallCancellation",
363+
"BidiGenerateContentToolResponse",
364+
"BidiGenerateContentTranscription",
320365
"Candidate",
321366
"ContentEmbedding",
367+
"ContextWindowCompressionConfig",
322368
"CountTokensRequest",
323369
"CountTokensResponse",
324370
"EmbedContentRequest",
@@ -328,17 +374,23 @@
328374
"GenerateContentRequest",
329375
"GenerateContentResponse",
330376
"GenerationConfig",
377+
"GoAway",
331378
"GroundingAttribution",
332379
"GroundingChunk",
333380
"GroundingMetadata",
334381
"GroundingSupport",
335382
"LogprobsResult",
336383
"PrebuiltVoiceConfig",
384+
"RealtimeInputConfig",
337385
"RetrievalMetadata",
338386
"SearchEntryPoint",
339387
"Segment",
340388
"SemanticRetrieverConfig",
389+
"SessionResumptionConfig",
390+
"SessionResumptionUpdate",
341391
"SpeechConfig",
392+
"ThinkingConfig",
393+
"UsageMetadata",
342394
"VoiceConfig",
343395
"TaskType",
344396
"Model",
@@ -361,8 +413,14 @@
361413
"TransferOwnershipRequest",
362414
"TransferOwnershipResponse",
363415
"UpdatePermissionRequest",
416+
"GenerateVideoResponse",
417+
"Media",
418+
"PredictLongRunningMetadata",
419+
"PredictLongRunningRequest",
420+
"PredictLongRunningResponse",
364421
"PredictRequest",
365422
"PredictResponse",
423+
"Video",
366424
"Chunk",
367425
"ChunkData",
368426
"Condition",

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
)
2525
from .services.model_service import ModelServiceAsyncClient, ModelServiceClient
2626
from .types.citation import CitationMetadata, CitationSource
27-
from .types.content import Blob, Content, Part
27+
from .types.content import Blob, Content, Modality, ModalityTokenCount, Part
2828
from .types.generative_service import (
2929
BatchEmbedContentsRequest,
3030
BatchEmbedContentsResponse,
@@ -77,6 +77,8 @@
7777
"ListModelsRequest",
7878
"ListModelsResponse",
7979
"LogprobsResult",
80+
"Modality",
81+
"ModalityTokenCount",
8082
"Model",
8183
"ModelServiceClient",
8284
"Part",

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1/services/generative_service/transports/rest_base.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,11 @@ def _get_http_options():
286286
"uri": "/v1/{model=tunedModels/*}:generateContent",
287287
"body": "*",
288288
},
289+
{
290+
"method": "post",
291+
"uri": "/v1/{model=dynamic/*}:generateContent",
292+
"body": "*",
293+
},
289294
]
290295
return http_options
291296

@@ -348,6 +353,11 @@ def _get_http_options():
348353
"uri": "/v1/{model=tunedModels/*}:streamGenerateContent",
349354
"body": "*",
350355
},
356+
{
357+
"method": "post",
358+
"uri": "/v1/{model=dynamic/*}:streamGenerateContent",
359+
"body": "*",
360+
},
351361
]
352362
return http_options
353363

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1/types/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
from .citation import CitationMetadata, CitationSource
17-
from .content import Blob, Content, Part
17+
from .content import Blob, Content, Modality, ModalityTokenCount, Part
1818
from .generative_service import (
1919
BatchEmbedContentsRequest,
2020
BatchEmbedContentsResponse,
@@ -45,7 +45,9 @@
4545
"CitationSource",
4646
"Blob",
4747
"Content",
48+
"ModalityTokenCount",
4849
"Part",
50+
"Modality",
4951
"BatchEmbedContentsRequest",
5052
"BatchEmbedContentsResponse",
5153
"Candidate",

packages/google-ai-generativelanguage/google/ai/generativelanguage_v1/types/content.py

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,40 @@
2222
__protobuf__ = proto.module(
2323
package="google.ai.generativelanguage.v1",
2424
manifest={
25+
"Modality",
2526
"Content",
2627
"Part",
2728
"Blob",
29+
"ModalityTokenCount",
2830
},
2931
)
3032

3133

34+
class Modality(proto.Enum):
35+
r"""Content Part modality
36+
37+
Values:
38+
MODALITY_UNSPECIFIED (0):
39+
Unspecified modality.
40+
TEXT (1):
41+
Plain text.
42+
IMAGE (2):
43+
Image.
44+
VIDEO (3):
45+
Video.
46+
AUDIO (4):
47+
Audio.
48+
DOCUMENT (5):
49+
Document, e.g. PDF.
50+
"""
51+
MODALITY_UNSPECIFIED = 0
52+
TEXT = 1
53+
IMAGE = 2
54+
VIDEO = 3
55+
AUDIO = 4
56+
DOCUMENT = 5
57+
58+
3259
class Content(proto.Message):
3360
r"""The base structured datatype containing multi-part content of a
3461
message.
@@ -130,4 +157,26 @@ class Blob(proto.Message):
130157
)
131158

132159

160+
class ModalityTokenCount(proto.Message):
161+
r"""Represents token counting info for a single modality.
162+
163+
Attributes:
164+
modality (google.ai.generativelanguage_v1.types.Modality):
165+
The modality associated with this token
166+
count.
167+
token_count (int):
168+
Number of tokens.
169+
"""
170+
171+
modality: "Modality" = proto.Field(
172+
proto.ENUM,
173+
number=1,
174+
enum="Modality",
175+
)
176+
token_count: int = proto.Field(
177+
proto.INT32,
178+
number=2,
179+
)
180+
181+
133182
__all__ = tuple(sorted(__protobuf__.manifest))

0 commit comments

Comments
 (0)