Skip to content

Commit a79ec8f

Browse files
committed
Merge branch 'main' into feat/improve-aspect-ratio-types
Signed-off-by: puretension <[email protected]>
2 parents 4832c85 + beef4e3 commit a79ec8f

File tree

478 files changed

+37853
-19331
lines changed

Some content is hidden

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

478 files changed

+37853
-19331
lines changed

.github/workflows/coverage.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Run code coverage
2+
3+
on:
4+
push:
5+
branches: [ 'main' ]
6+
pull_request:
7+
branches: [ 'main' ]
8+
9+
jobs:
10+
coverage:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 22.x
20+
cache: 'npm'
21+
- run: npm ci
22+
- run: npm run coverage-report

.github/workflows/stale.yml

Lines changed: 9 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
2-
#
3-
# You can adjust the behavior by modifying this file.
4-
# For more information, see:
5-
# https://github.com/actions/stale
6-
name: Mark stale issues and pull requests
1+
# This workflow warns and then closes issues that have had no activity for a specified amount of time.
2+
name: Mark and close stale issues
73

84
on:
95
schedule:
@@ -16,33 +12,22 @@ jobs:
1612
runs-on: ubuntu-latest
1713
permissions:
1814
issues: write
19-
pull-requests: write
2015

2116
steps:
2217
- uses: actions/stale@v5
2318
with:
2419
repo-token: ${{ secrets.GITHUB_TOKEN }}
25-
days-before-issue-stale: 14
26-
days-before-issue-close: 14
20+
days-before-issue-stale: 7
21+
days-before-issue-close: 2
2722
stale-issue-label: "status:stale"
2823
close-issue-reason: not_planned
29-
any-of-labels: "status:awaiting user response,status:more data needed"
24+
any-of-labels: "status:awaiting user response"
25+
remove-stale-when-updated: true
26+
labels-to-remove-when-unstale: 'status:awaiting user response,status:stale'
3027
stale-issue-message: >
31-
Marking this issue as stale since it has been open for 14 days with no activity.
32-
This issue will be closed if no further activity occurs.
28+
This issue has been marked as stale because it has been open for 7 days with no activity. It will be closed in 2 days if no further activity occurs.
3329
close-issue-message: >
34-
This issue was closed because it has been inactive for 28 days.
30+
This issue was closed because it has been inactive for 9 days.
3531
Please post a new issue if you need further assistance. Thanks!
36-
days-before-pr-stale: 14
37-
days-before-pr-close: 14
38-
stale-pr-label: "status:stale"
39-
stale-pr-message: >
40-
Marking this pull request as stale since it has been open for 14 days with no activity.
41-
This PR will be closed if no further activity occurs.
42-
close-pr-message: >
43-
This pull request was closed because it has been inactive for 28 days.
44-
Please open a new pull request if you need further assistance. Thanks!
4532
# Label that can be assigned to issues to exclude them from being marked as stale
4633
exempt-issue-labels: 'override-stale'
47-
# Label that can be assigned to PRs to exclude them from being marked as stale
48-
exempt-pr-labels: "override-stale"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ temp/**/*
66

77
node_modules
88

9+
sdk-samples/js_files_to_run.txt
910
sdk-samples/build/**/*
1011
sdk-samples/web/dist/**/*

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "1.10.0"
2+
".": "1.21.0"
33
}

CHANGELOG.md

Lines changed: 136 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,142 @@
11
# Changelog
22

33

4+
## [1.21.0](https://github.com/googleapis/js-genai/compare/v1.20.0...v1.21.0) (2025-09-25)
5+
6+
7+
### Features
8+
9+
* Add FunctionResponsePart & ToolComputerUse.excludedPredefinedFunctions ([61620f6](https://github.com/googleapis/js-genai/commit/61620f64cc8ca6997e958bda6f61ed52faff71c8))
10+
* Support Imagen 4 Ingredients on Vertex ([56cccfc](https://github.com/googleapis/js-genai/commit/56cccfca02b668ed3bfacc7e757eb821e827e35b))
11+
12+
13+
### Bug Fixes
14+
15+
* [#963](https://github.com/googleapis/js-genai/issues/963) allow leading whitespace before data chunks ([24f4153](https://github.com/googleapis/js-genai/commit/24f4153ea652709e4093dd4f543c2fbebd693dc2))
16+
* Expose `JOB_STATE_RUNNING` and `JOB_STATE_EXPIRED` for Gemini Batches states ([b513c69](https://github.com/googleapis/js-genai/commit/b513c69d2102b94733d2e436d8d1b8a47dd1bbf4))
17+
* initialization of `pre_tuned_model_checkpoint_id` from tuning config. ([2e10e7f](https://github.com/googleapis/js-genai/commit/2e10e7f8d666fb8f0f332834266d9fd0a5d13c34))
18+
19+
## [1.20.0](https://github.com/googleapis/js-genai/compare/v1.19.0...v1.20.0) (2025-09-16)
20+
21+
22+
### Features
23+
24+
* Add 'turn_complete_reason' and 'waiting_for_input' fields. ([cb54332](https://github.com/googleapis/js-genai/commit/cb543326e805cf1fc4f9167b1a8af797dc8a11ca))
25+
* Add `VideoGenerationMaskMode` enum for Veo 2 Editing ([3e850fd](https://github.com/googleapis/js-genai/commit/3e850fdad8b5252608b8287b2e537fb9b0a2f35e))
26+
27+
## [1.19.0](https://github.com/googleapis/js-genai/compare/v1.18.0...v1.19.0) (2025-09-09)
28+
29+
30+
### Features
31+
32+
* Add labels to create tuning job config ([220c4d6](https://github.com/googleapis/js-genai/commit/220c4d6c925d8ebfa3cfccff5ed964df1b775a62))
33+
* Support Veo 2 Editing on Vertex ([6e34fd0](https://github.com/googleapis/js-genai/commit/6e34fd057cc88c300942f231f43e1c120f3a6fe6))
34+
35+
36+
### Bug Fixes
37+
38+
* Enable `id` field in `FunctionCall` for Vertex AI. ([7c6e047](https://github.com/googleapis/js-genai/commit/7c6e047037103a0cc60c799a12dcc3ace3a5ba2f))
39+
40+
## [1.18.0](https://github.com/googleapis/js-genai/compare/v1.17.0...v1.18.0) (2025-09-09)
41+
42+
43+
### Features
44+
45+
* generate the function_call class's converters ([e57a7bc](https://github.com/googleapis/js-genai/commit/e57a7bcc4e30e0f9ddef036bbe50680ebc476e83))
46+
* Implement embed content batches. ([9cb8613](https://github.com/googleapis/js-genai/commit/9cb8613ef7646be0d6392f4da4da3eb6b0e6d5f6))
47+
48+
## [1.17.0](https://github.com/googleapis/js-genai/compare/v1.16.0...v1.17.0) (2025-09-02)
49+
50+
51+
### Features
52+
53+
* Add resolution field for Gemini Developer API Veo 3 generation ([5ce467b](https://github.com/googleapis/js-genai/commit/5ce467b754b82f1a2ba18e75f27962c0764db091))
54+
55+
## [1.16.0](https://github.com/googleapis/js-genai/compare/v1.15.0...v1.16.0) (2025-08-27)
56+
57+
58+
### Features
59+
60+
* add `sdkHttpResponse.headers` to *Delete responses. ([397c602](https://github.com/googleapis/js-genai/commit/397c6022864adfd5113da58977ee036d186e81a2))
61+
* Add add_watermark field for recontext_image (Virtual Try-On, Product Recontext) ([e182fe8](https://github.com/googleapis/js-genai/commit/e182fe89deebf2c0bbe0310c689e444a56351896))
62+
* Add output_gcs_uri to Imagen upscale_image ([8db102a](https://github.com/googleapis/js-genai/commit/8db102a976c6dadcf6596bdd2b378f982da1261b))
63+
* add outputSchema support for MCP ([e2d4e50](https://github.com/googleapis/js-genai/commit/e2d4e507513009ba1bff79f193459772673ac42d))
64+
* Add VALIDATED mode into FunctionCallingConfigMode ([af410e7](https://github.com/googleapis/js-genai/commit/af410e74f540411e809725f809caab40a624ba6f))
65+
* Add VideoGenerationReferenceType enum for generate_videos ([eb17013](https://github.com/googleapis/js-genai/commit/eb170130c2c81b7f149f1d824b813fb3c44db36d))
66+
* Support GenerateVideosSource for Veo GenerateVideos ([2241749](https://github.com/googleapis/js-genai/commit/2241749382f760eb942bf84318f64b2e9c535694))
67+
* support tunings.cancel in the genai SDK for Python, Java, JS, and Go ([2d67d25](https://github.com/googleapis/js-genai/commit/2d67d25d4b7cbdeb6b04caf15cb6b8b3b1033e68))
68+
* Update server test recordings to JSON. ([dd0a033](https://github.com/googleapis/js-genai/commit/dd0a0334375f373964acf9c7d6b4d2b8905226a1))
69+
70+
71+
### Bug Fixes
72+
73+
* **js:** empty env vars should be treated as undefined. ([16a80c0](https://github.com/googleapis/js-genai/commit/16a80c04f0b8353a6c4e64a7d29c171e0c241ae3))
74+
75+
## [1.15.0](https://github.com/googleapis/js-genai/compare/v1.14.0...v1.15.0) (2025-08-18)
76+
77+
78+
### Features
79+
80+
* Support Imagen image segmentation on Vertex ([6b86bae](https://github.com/googleapis/js-genai/commit/6b86baecc425197c2db1b734e93a4a5dcb9a10a4))
81+
* Support Veo 2 Reference Images to Video Generation on Vertex ([6bca6ad](https://github.com/googleapis/js-genai/commit/6bca6ad37edd4ebda024b2eaf617d4ad213a791f))
82+
83+
84+
### Bug Fixes
85+
86+
* **chats:** Drop the validation on part with empty text ([d2602d2](https://github.com/googleapis/js-genai/commit/d2602d2ec47402d567f095c6c621b258432ff896))
87+
* Fix the bug to support Gemini Batch inlined requests system instruction ([843c774](https://github.com/googleapis/js-genai/commit/843c7746edc9497499b8af277f4f3901f31dce9a))
88+
89+
## [1.14.0](https://github.com/googleapis/js-genai/compare/v1.13.0...v1.14.0) (2025-08-13)
90+
91+
92+
### Features
93+
94+
* add an _exclude_fields characteristic in the config for unused values to avoid unnecessary and unused code in converter and type generation. ([15a4504](https://github.com/googleapis/js-genai/commit/15a4504ac3455044bb3ef51440ccbf420168104e))
95+
* enable continuous fine-tuning on a pre-tuned model in the SDK. ([027f09d](https://github.com/googleapis/js-genai/commit/027f09db662ce6b30f737b10b4d2efcb4282a9b6))
96+
* support document name in grounding metadata ([b801236](https://github.com/googleapis/js-genai/commit/b8012365f7ec7917576ca048bbaa37ac9d011795))
97+
* Support exclude_domains in Google Search and Enterprise Web Search ([8ed49f1](https://github.com/googleapis/js-genai/commit/8ed49f171e2a1bf2cfb187869e4682ed2f8bd2fb))
98+
99+
100+
### Bug Fixes
101+
102+
* Replace `gemini-2.5-flash-preview-04-17` with `gemini-2.5-flash`. ([d7f1c30](https://github.com/googleapis/js-genai/commit/d7f1c304554c045cdd8bf710d11178a1d07b2983))
103+
104+
## [1.13.0](https://github.com/googleapis/js-genai/compare/v1.12.0...v1.13.0) (2025-08-06)
105+
106+
107+
### Features
108+
109+
* Add image_size field for Gemini Developer API Imagen 4 generation ([9841ecb](https://github.com/googleapis/js-genai/commit/9841ecb359d57648e284271fdf3a477ca3c5d6f1))
110+
* Add Lyria enum for music generation mode for vocalization ([b05821f](https://github.com/googleapis/js-genai/commit/b05821f5279ba0a579312fb66deafc79bf56fda5))
111+
* allow methods in batch to return headers in sdk_http_response by default ([55a2be4](https://github.com/googleapis/js-genai/commit/55a2be418f132788e5be6266c05ba42bf96c4aa1))
112+
* enable responseId for Gemini Developer API ([40e3a58](https://github.com/googleapis/js-genai/commit/40e3a58e31d09f77eb600c4e472965646ad7dd63))
113+
* Support image recontext on Vertex ([e417867](https://github.com/googleapis/js-genai/commit/e417867f181ca3a577ed6089233d18110b5a6558))
114+
* Support new enum types for UrlRetrievalStatus ([88b47e6](https://github.com/googleapis/js-genai/commit/88b47e6f4bebea188bf7baec437a948e16d703bb))
115+
116+
## [1.12.0](https://github.com/googleapis/js-genai/compare/v1.11.0...v1.12.0) (2025-07-30)
117+
118+
119+
### Features
120+
121+
* allow methods in models to return headers in sdk_http_response by default. ([efdcb8a](https://github.com/googleapis/js-genai/commit/efdcb8a844155127cc58b05cfcb3f4f676613c1a))
122+
* allow methods in tuning to return headers in sdk_http_response by default ([f81c16a](https://github.com/googleapis/js-genai/commit/f81c16a4723c0696e100c5926fe5416263621b8b))
123+
124+
125+
### Bug Fixes
126+
127+
* Correctly populated the Rai filter reasons on Video Generation ([316cdb0](https://github.com/googleapis/js-genai/commit/316cdb05d0bf87a03e463812e48f7c0c8fe5296a))
128+
129+
## [1.11.0](https://github.com/googleapis/js-genai/compare/v1.10.0...v1.11.0) (2025-07-23)
130+
131+
132+
### Features
133+
134+
* Add image_size field for Vertex Imagen 4 generation ([b6cc23e](https://github.com/googleapis/js-genai/commit/b6cc23ee90b576db1529f33ff5c209742baedab8))
135+
* enable function calling for Callable Tool besides McpClient in generateContent. ([90565bd](https://github.com/googleapis/js-genai/commit/90565bda219f4a72bbbe72497c72c34f6ead83b5))
136+
* Introduced Operations.get() which is a generic function to handle all Operation types. ([a6f85c1](https://github.com/googleapis/js-genai/commit/a6f85c1d5848f03b63b7038a0af6567caca295cf))
137+
* return headers for list method in all modules. ([e8591a3](https://github.com/googleapis/js-genai/commit/e8591a3adf024e4667f55610d2069edb52be8f8d))
138+
* Updates to codegen instructions to improve performance for TypeScript ([9c97ec6](https://github.com/googleapis/js-genai/commit/9c97ec645a7ab1e3a2e28319dac54a640e0eda57))
139+
4140
## [1.10.0](https://github.com/googleapis/js-genai/compare/v1.9.0...v1.10.0) (2025-07-17)
5141

6142

README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,30 @@ if you are specifying those, you need to explicitly provide the full
339339
`Content[]` structure making it explicit which Parts are 'spoken' by the model,
340340
or the user. The SDK will throw an exception if you try this.
341341
342+
## Error Handling
343+
344+
To handle errors raised by the API, the SDK provides this [ApiError](https://github.com/googleapis/js-genai/blob/main/src/errors.ts) class.
345+
346+
```typescript
347+
import {GoogleGenAI} from '@google/genai';
348+
const GEMINI_API_KEY = process.env.GEMINI_API_KEY;
349+
350+
const ai = new GoogleGenAI({apiKey: GEMINI_API_KEY});
351+
352+
async function main() {
353+
await ai.models.generateContent({
354+
model: 'non-existent-model',
355+
contents: 'Write a 100-word poem.',
356+
}).catch((e) => {
357+
console.error('error name: ', e.name);
358+
console.error('error message: ', e.message);
359+
console.error('error status: ', e.status);
360+
});
361+
}
362+
363+
main();
364+
```
365+
342366
## How is this different from the other Google AI SDKs
343367
This SDK (`@google/genai`) is Google Deepmind’s "vanilla" SDK for its generative
344368
AI offerings, and is where Google Deepmind adds new AI features.

0 commit comments

Comments
 (0)