@google/genai 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,7 +33,7 @@ npm install @google/genai
33
33
 
34
34
  ## Quickstart
35
35
 
36
- The simplest way to get started is to using an API key from
36
+ The simplest way to get started is to use an API key from
37
37
  [Google AI Studio](https://aistudio.google.com/apikey):
38
38
 
39
39
  ```typescript
package/dist/genai.d.ts CHANGED
@@ -2408,6 +2408,8 @@ export declare interface GenerateVideosConfig {
2408
2408
  negativePrompt?: string;
2409
2409
  /** Whether to use the prompt rewriting logic. */
2410
2410
  enhancePrompt?: boolean;
2411
+ /** Whether to generate audio along with the video. */
2412
+ generateAudio?: boolean;
2411
2413
  }
2412
2414
 
2413
2415
  /** A video generation operation. */
@@ -3695,8 +3697,6 @@ export declare interface LiveMusicGenerationConfig {
3695
3697
  muteDrums?: boolean;
3696
3698
  /** Whether the audio output should contain only bass and drums. */
3697
3699
  onlyBassAndDrums?: boolean;
3698
- /** The mode of music generation. Default mode is QUALITY. */
3699
- musicGenerationMode?: MusicGenerationMode;
3700
3700
  }
3701
3701
 
3702
3702
  /** The playback control signal to apply to the music generation. */
@@ -4146,7 +4146,7 @@ export declare enum Modality {
4146
4146
  */
4147
4147
  IMAGE = "IMAGE",
4148
4148
  /**
4149
- * Indicates the model should return images.
4149
+ * Indicates the model should return audio.
4150
4150
  */
4151
4151
  AUDIO = "AUDIO"
4152
4152
  }
@@ -4520,24 +4520,6 @@ export declare interface MultiSpeakerVoiceConfig {
4520
4520
  speakerVoiceConfigs?: SpeakerVoiceConfig[];
4521
4521
  }
4522
4522
 
4523
- /** The mode of music generation. */
4524
- export declare enum MusicGenerationMode {
4525
- /**
4526
- * This value is unused.
4527
- */
4528
- MUSIC_GENERATION_MODE_UNSPECIFIED = "MUSIC_GENERATION_MODE_UNSPECIFIED",
4529
- /**
4530
- * Steer text prompts to regions of latent space with higher quality
4531
- music.
4532
- */
4533
- QUALITY = "QUALITY",
4534
- /**
4535
- * Steer text prompts to regions of latent space with a larger diversity
4536
- of music.
4537
- */
4538
- DIVERSITY = "DIVERSITY"
4539
- }
4540
-
4541
4523
  /** A long-running operation. */
4542
4524
  export declare interface Operation {
4543
4525
  /** The server-assigned name, which is only unique within the same service that originally returns it. If you use the default HTTP mapping, the `name` should be a resource name ending with `operations/{unique_id}`. */
@@ -5860,7 +5842,6 @@ declare namespace types {
5860
5842
  TurnCoverage,
5861
5843
  FunctionResponseScheduling,
5862
5844
  Scale,
5863
- MusicGenerationMode,
5864
5845
  LiveMusicPlaybackControl,
5865
5846
  VideoMetadata,
5866
5847
  Blob_2 as Blob,
package/dist/index.cjs CHANGED
@@ -505,7 +505,7 @@ exports.Modality = void 0;
505
505
  */
506
506
  Modality["IMAGE"] = "IMAGE";
507
507
  /**
508
- * Indicates the model should return images.
508
+ * Indicates the model should return audio.
509
509
  */
510
510
  Modality["AUDIO"] = "AUDIO";
511
511
  })(exports.Modality || (exports.Modality = {}));
@@ -929,24 +929,6 @@ exports.Scale = void 0;
929
929
  */
930
930
  Scale["B_MAJOR_A_FLAT_MINOR"] = "B_MAJOR_A_FLAT_MINOR";
931
931
  })(exports.Scale || (exports.Scale = {}));
932
- /** The mode of music generation. */
933
- exports.MusicGenerationMode = void 0;
934
- (function (MusicGenerationMode) {
935
- /**
936
- * This value is unused.
937
- */
938
- MusicGenerationMode["MUSIC_GENERATION_MODE_UNSPECIFIED"] = "MUSIC_GENERATION_MODE_UNSPECIFIED";
939
- /**
940
- * Steer text prompts to regions of latent space with higher quality
941
- music.
942
- */
943
- MusicGenerationMode["QUALITY"] = "QUALITY";
944
- /**
945
- * Steer text prompts to regions of latent space with a larger diversity
946
- of music.
947
- */
948
- MusicGenerationMode["DIVERSITY"] = "DIVERSITY";
949
- })(exports.MusicGenerationMode || (exports.MusicGenerationMode = {}));
950
932
  /** The playback control signal to apply to the music generation. */
951
933
  exports.LiveMusicPlaybackControl = void 0;
952
934
  (function (LiveMusicPlaybackControl) {
@@ -4356,7 +4338,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
4356
4338
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
4357
4339
  const USER_AGENT_HEADER = 'User-Agent';
4358
4340
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
4359
- const SDK_VERSION = '1.1.0'; // x-release-please-version
4341
+ const SDK_VERSION = '1.2.0'; // x-release-please-version
4360
4342
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
4361
4343
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
4362
4344
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6728,12 +6710,6 @@ function liveMusicGenerationConfigToMldev(apiClient, fromObject) {
6728
6710
  if (fromOnlyBassAndDrums != null) {
6729
6711
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
6730
6712
  }
6731
- const fromMusicGenerationMode = getValueByPath(fromObject, [
6732
- 'musicGenerationMode',
6733
- ]);
6734
- if (fromMusicGenerationMode != null) {
6735
- setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
6736
- }
6737
6713
  return toObject;
6738
6714
  }
6739
6715
  function liveMusicSetConfigParametersToMldev(apiClient, fromObject) {
@@ -7658,12 +7634,6 @@ function liveMusicGenerationConfigFromMldev(apiClient, fromObject) {
7658
7634
  if (fromOnlyBassAndDrums != null) {
7659
7635
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
7660
7636
  }
7661
- const fromMusicGenerationMode = getValueByPath(fromObject, [
7662
- 'musicGenerationMode',
7663
- ]);
7664
- if (fromMusicGenerationMode != null) {
7665
- setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
7666
- }
7667
7637
  return toObject;
7668
7638
  }
7669
7639
  function liveMusicSourceMetadataFromMldev(apiClient, fromObject) {
@@ -8715,6 +8685,9 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
8715
8685
  if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
8716
8686
  throw new Error('enhancePrompt parameter is not supported in Gemini API.');
8717
8687
  }
8688
+ if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
8689
+ throw new Error('generateAudio parameter is not supported in Gemini API.');
8690
+ }
8718
8691
  return toObject;
8719
8692
  }
8720
8693
  function generateVideosParametersToMldev(apiClient, fromObject) {
@@ -10054,6 +10027,12 @@ function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
10054
10027
  if (parentObject !== undefined && fromEnhancePrompt != null) {
10055
10028
  setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
10056
10029
  }
10030
+ const fromGenerateAudio = getValueByPath(fromObject, [
10031
+ 'generateAudio',
10032
+ ]);
10033
+ if (parentObject !== undefined && fromGenerateAudio != null) {
10034
+ setValueByPath(parentObject, ['parameters', 'generateAudio'], fromGenerateAudio);
10035
+ }
10057
10036
  return toObject;
10058
10037
  }
10059
10038
  function generateVideosParametersToVertex(apiClient, fromObject) {
@@ -11210,9 +11189,6 @@ function hasMcpToolUsage(tools) {
11210
11189
  function setMcpUsageHeader(headers) {
11211
11190
  var _a;
11212
11191
  const existingHeader = (_a = headers[GOOGLE_API_CLIENT_HEADER]) !== null && _a !== void 0 ? _a : '';
11213
- if (existingHeader.includes(MCP_LABEL)) {
11214
- return;
11215
- }
11216
11192
  headers[GOOGLE_API_CLIENT_HEADER] = (existingHeader + ` ${MCP_LABEL}`).trimStart();
11217
11193
  }
11218
11194
  // Checks whether the list of tools contains any MCP clients. Will return true
package/dist/index.mjs CHANGED
@@ -503,7 +503,7 @@ var Modality;
503
503
  */
504
504
  Modality["IMAGE"] = "IMAGE";
505
505
  /**
506
- * Indicates the model should return images.
506
+ * Indicates the model should return audio.
507
507
  */
508
508
  Modality["AUDIO"] = "AUDIO";
509
509
  })(Modality || (Modality = {}));
@@ -927,24 +927,6 @@ var Scale;
927
927
  */
928
928
  Scale["B_MAJOR_A_FLAT_MINOR"] = "B_MAJOR_A_FLAT_MINOR";
929
929
  })(Scale || (Scale = {}));
930
- /** The mode of music generation. */
931
- var MusicGenerationMode;
932
- (function (MusicGenerationMode) {
933
- /**
934
- * This value is unused.
935
- */
936
- MusicGenerationMode["MUSIC_GENERATION_MODE_UNSPECIFIED"] = "MUSIC_GENERATION_MODE_UNSPECIFIED";
937
- /**
938
- * Steer text prompts to regions of latent space with higher quality
939
- music.
940
- */
941
- MusicGenerationMode["QUALITY"] = "QUALITY";
942
- /**
943
- * Steer text prompts to regions of latent space with a larger diversity
944
- of music.
945
- */
946
- MusicGenerationMode["DIVERSITY"] = "DIVERSITY";
947
- })(MusicGenerationMode || (MusicGenerationMode = {}));
948
930
  /** The playback control signal to apply to the music generation. */
949
931
  var LiveMusicPlaybackControl;
950
932
  (function (LiveMusicPlaybackControl) {
@@ -4354,7 +4336,7 @@ const CONTENT_TYPE_HEADER = 'Content-Type';
4354
4336
  const SERVER_TIMEOUT_HEADER = 'X-Server-Timeout';
4355
4337
  const USER_AGENT_HEADER = 'User-Agent';
4356
4338
  const GOOGLE_API_CLIENT_HEADER = 'x-goog-api-client';
4357
- const SDK_VERSION = '1.1.0'; // x-release-please-version
4339
+ const SDK_VERSION = '1.2.0'; // x-release-please-version
4358
4340
  const LIBRARY_LABEL = `google-genai-sdk/${SDK_VERSION}`;
4359
4341
  const VERTEX_AI_API_DEFAULT_VERSION = 'v1beta1';
4360
4342
  const GOOGLE_AI_API_DEFAULT_VERSION = 'v1beta';
@@ -6726,12 +6708,6 @@ function liveMusicGenerationConfigToMldev(apiClient, fromObject) {
6726
6708
  if (fromOnlyBassAndDrums != null) {
6727
6709
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
6728
6710
  }
6729
- const fromMusicGenerationMode = getValueByPath(fromObject, [
6730
- 'musicGenerationMode',
6731
- ]);
6732
- if (fromMusicGenerationMode != null) {
6733
- setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
6734
- }
6735
6711
  return toObject;
6736
6712
  }
6737
6713
  function liveMusicSetConfigParametersToMldev(apiClient, fromObject) {
@@ -7656,12 +7632,6 @@ function liveMusicGenerationConfigFromMldev(apiClient, fromObject) {
7656
7632
  if (fromOnlyBassAndDrums != null) {
7657
7633
  setValueByPath(toObject, ['onlyBassAndDrums'], fromOnlyBassAndDrums);
7658
7634
  }
7659
- const fromMusicGenerationMode = getValueByPath(fromObject, [
7660
- 'musicGenerationMode',
7661
- ]);
7662
- if (fromMusicGenerationMode != null) {
7663
- setValueByPath(toObject, ['musicGenerationMode'], fromMusicGenerationMode);
7664
- }
7665
7635
  return toObject;
7666
7636
  }
7667
7637
  function liveMusicSourceMetadataFromMldev(apiClient, fromObject) {
@@ -8713,6 +8683,9 @@ function generateVideosConfigToMldev(apiClient, fromObject, parentObject) {
8713
8683
  if (getValueByPath(fromObject, ['enhancePrompt']) !== undefined) {
8714
8684
  throw new Error('enhancePrompt parameter is not supported in Gemini API.');
8715
8685
  }
8686
+ if (getValueByPath(fromObject, ['generateAudio']) !== undefined) {
8687
+ throw new Error('generateAudio parameter is not supported in Gemini API.');
8688
+ }
8716
8689
  return toObject;
8717
8690
  }
8718
8691
  function generateVideosParametersToMldev(apiClient, fromObject) {
@@ -10052,6 +10025,12 @@ function generateVideosConfigToVertex(apiClient, fromObject, parentObject) {
10052
10025
  if (parentObject !== undefined && fromEnhancePrompt != null) {
10053
10026
  setValueByPath(parentObject, ['parameters', 'enhancePrompt'], fromEnhancePrompt);
10054
10027
  }
10028
+ const fromGenerateAudio = getValueByPath(fromObject, [
10029
+ 'generateAudio',
10030
+ ]);
10031
+ if (parentObject !== undefined && fromGenerateAudio != null) {
10032
+ setValueByPath(parentObject, ['parameters', 'generateAudio'], fromGenerateAudio);
10033
+ }
10055
10034
  return toObject;
10056
10035
  }
10057
10036
  function generateVideosParametersToVertex(apiClient, fromObject) {
@@ -11208,9 +11187,6 @@ function hasMcpToolUsage(tools) {
11208
11187
  function setMcpUsageHeader(headers) {
11209
11188
  var _a;
11210
11189
  const existingHeader = (_a = headers[GOOGLE_API_CLIENT_HEADER]) !== null && _a !== void 0 ? _a : '';
11211
- if (existingHeader.includes(MCP_LABEL)) {
11212
- return;
11213
- }
11214
11190
  headers[GOOGLE_API_CLIENT_HEADER] = (existingHeader + ` ${MCP_LABEL}`).trimStart();
11215
11191
  }
11216
11192
  // Checks whether the list of tools contains any MCP clients. Will return true
@@ -14533,5 +14509,5 @@ class GoogleGenAI {
14533
14509
  }
14534
14510
  }
14535
14511
 
14536
- export { ActivityHandling, AdapterSize, AuthType, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, MusicGenerationMode, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
14512
+ export { ActivityHandling, AdapterSize, AuthType, Behavior, BlockedReason, Caches, Chat, Chats, ComputeTokensResponse, ControlReferenceImage, ControlReferenceType, CountTokensResponse, CreateFileResponse, DeleteCachedContentResponse, DeleteFileResponse, DeleteModelResponse, DynamicRetrievalConfigMode, EditImageResponse, EditMode, EmbedContentResponse, EndSensitivity, FeatureSelectionPreference, FileSource, FileState, Files, FinishReason, FunctionCallingConfigMode, FunctionResponse, FunctionResponseScheduling, GenerateContentResponse, GenerateContentResponsePromptFeedback, GenerateContentResponseUsageMetadata, GenerateImagesResponse, GenerateVideosResponse, GoogleGenAI, HarmBlockMethod, HarmBlockThreshold, HarmCategory, HarmProbability, HarmSeverity, HttpResponse, ImagePromptLanguage, JobState, Language, ListCachedContentsResponse, ListFilesResponse, ListModelsResponse, ListTuningJobsResponse, Live, LiveClientToolResponse, LiveMusicPlaybackControl, LiveMusicServerMessage, LiveSendToolResponseParameters, LiveServerMessage, MaskReferenceImage, MaskReferenceMode, MediaModality, MediaResolution, Modality, Mode, Models, Operations, Outcome, PagedItem, Pager, PersonGeneration, RawReferenceImage, ReplayResponse, SafetyFilterLevel, Scale, Session, StartSensitivity, StyleReferenceImage, SubjectReferenceImage, SubjectReferenceType, TrafficType, TurnCoverage, Type, UpscaleImageResponse, UrlRetrievalStatus, createModelContent, createPartFromBase64, createPartFromCodeExecutionResult, createPartFromExecutableCode, createPartFromFunctionCall, createPartFromFunctionResponse, createPartFromText, createPartFromUri, createUserContent, mcpToTool, setDefaultBaseUrls };
14537
14513
  //# sourceMappingURL=index.mjs.map