Skip to content

Commit 0d4fe06

Browse files
authored
Remove monorepo structure and tooling (#226)
1 parent b1e6992 commit 0d4fe06

File tree

98 files changed

+530
-3104
lines changed

Some content is hidden

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

98 files changed

+530
-3104
lines changed

config/.eslintrc.js renamed to .eslintrc.js

+5-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* @license
3-
* Copyright 2023 Google LLC
3+
* Copyright 2024 Google LLC
44
*
55
* Licensed under the Apache License, Version 2.0 (the "License");
66
* you may not use this file except in compliance with the License.
@@ -15,8 +15,6 @@
1515
* limitations under the License.
1616
*/
1717

18-
const path = require("path");
19-
2018
module.exports = {
2119
env: {
2220
browser: true,
@@ -33,6 +31,7 @@ module.exports = {
3331
parserOptions: {
3432
ecmaVersion: 2015,
3533
sourceType: "module",
34+
project: "tsconfig.json",
3635
},
3736
overrides: [
3837
{
@@ -125,7 +124,7 @@ module.exports = {
125124
"error",
126125
{
127126
ignoreCase: false,
128-
ignoreDeclarationSort: true, // don"t want to sort import lines, use eslint-plugin-import instead
127+
ignoreDeclarationSort: true, // don't want to sort import lines, use eslint-plugin-import instead
129128
ignoreMemberSort: false,
130129
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
131130
allowSeparatedGroups: true,
@@ -136,15 +135,7 @@ module.exports = {
136135
"import/no-extraneous-dependencies": [
137136
"error",
138137
{
139-
// Check dependencies from both local package.json
140-
// and from root package.json.
141-
packageDir: [path.join(__dirname, "../"), "./"],
142-
devDependencies: [
143-
"**/*.test.ts",
144-
"**/test/**/*.ts",
145-
"**/testing/**/*.ts",
146-
"*.config.*",
147-
],
138+
packageDir: [__dirname],
148139
peerDependencies: true,
149140
},
150141
],
@@ -182,7 +173,7 @@ module.exports = {
182173
regex: "^I[A-Z]",
183174
match: false,
184175
},
185-
leadingUnderscore: 'allow'
176+
leadingUnderscore: "allow",
186177
},
187178
],
188179
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],

.github/workflows/test.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: run node iTests
6161
env:
6262
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
63-
run: yarn --cwd packages/main test:node:integration
63+
run: yarn test:node:integration
6464

6565
web-integration-test:
6666
runs-on: ubuntu-latest
@@ -81,4 +81,4 @@ jobs:
8181
- name: run web iTests
8282
env:
8383
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
84-
run: yarn --cwd packages/main test:web:integration
84+
run: yarn test:web:integration

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
node_modules
2-
packages/**/dist/
3-
packages/**/temp/
2+
dist/
3+
temp/
44
*.tgz
55
.DS_Store
66
testfiles
File renamed without changes.

CHANGELOG.md

+200-1
Original file line numberDiff line numberDiff line change
@@ -1 +1,200 @@
1-
See [changelog for @google/generative-ai](/packages/main/CHANGELOG.md)
1+
# @google/generative-ai
2+
3+
## 0.17.0
4+
5+
### Minor Changes
6+
7+
- 3b5daae: Fix `Schema` type to reference itself and not a derived type in its `items` array and `properties` map.
8+
9+
## 0.16.0
10+
11+
### Minor Changes
12+
13+
- d2d42ca: Adds `SingleRequestOptions` with `AbortSignal` support to most of the asynchronous methods of `GenerativeModel`, `GoogleAIFileManager` and `ChatSession`.
14+
15+
## 0.15.0
16+
17+
### Minor Changes
18+
19+
- 05b8631: Add FinishReason.LANGUAGE enum value.
20+
21+
### Patch Changes
22+
23+
- e87d5b0: Fix countTokens to include any params set on the model instance.
24+
25+
## 0.14.1
26+
27+
### Patch Changes
28+
29+
- 0c23bb3: Add `CodeExecutionTool` to `Tool` type.
30+
31+
## 0.14.0
32+
33+
### Minor Changes
34+
35+
- fb1c0f2: Add a `cachedContentTokenCount` field to the `UsageMetadata` interface returned by `generateContent` responses.
36+
- 06216be: Add code execution feature.
37+
38+
## 0.13.0
39+
40+
### Minor Changes
41+
42+
- 83ec4ac: Expand the model's `countTokens` method to alternatively accept a `GenerateContentRequest`.
43+
- 5df61d1: Added `GoogleAICacheManager` utility to allow caching large content to be used in inference. This class is exported from the `@google/generative-ai/server` subpath. Breaking change: The `GoogleAIFileManager` class has been moved to be exported from this subpath as well instead of the `/files` subpath.
44+
45+
### Patch Changes
46+
47+
- 1440a05: Removed the `model` field from the internally formatted payload of `countToken` requests as it was unnecessary.
48+
- 03eb57b: Fix missing usageMetadata in streamed aggregated response (#174)
49+
50+
## 0.12.0
51+
52+
### Minor Changes
53+
54+
- 85ff2c4: Added `responseSchema` to `GenerationConfig` to allow user to provide a JSON schema when `responseMimeType` is set to JSON.
55+
56+
## 0.11.5
57+
58+
### Patch Changes
59+
60+
- 42ba6ca: Fix paths to @google/generative-ai/files.
61+
62+
## 0.11.4
63+
64+
### Patch Changes
65+
66+
- ee02ff0: Add additional properties `videoMetadata` and `error` to `FileMetadataResponse` type.
67+
68+
## 0.11.3
69+
70+
### Patch Changes
71+
72+
- c7c0b50: Fixed `FileState` enum values to be strings.
73+
74+
## 0.11.2
75+
76+
### Patch Changes
77+
78+
- cefa8f2: Lifted a restriction in chat sessions that required a specific order of content roles.
79+
80+
## 0.11.1
81+
82+
### Patch Changes
83+
84+
- 819501f: Fix a bug that caused file uploads to be named "undefined" if no file name is provided.
85+
86+
## 0.11.0
87+
88+
### Minor Changes
89+
90+
- 58ab777: Added responseMimeType to GenerationConfig to allow for JSON formatted responses.
91+
92+
### Patch Changes
93+
94+
- c39015c: Fixed a bug where `text()` did not handle multiple `TextPart`s in a single candidate. Added `state` field to `FileMetadataResponse`.
95+
96+
## 0.10.0
97+
98+
### Minor Changes
99+
100+
- 657799a: Added UsageMetadata to GenerateContentResponses.
101+
- 4562366: Add a request option for custom headers
102+
103+
## 0.9.0
104+
105+
### Minor Changes
106+
107+
- ca62400: Allow text-only systemInstruction as well as Part and Content.
108+
- 111e970: Export error classes and add more properties to fetch errors.
109+
110+
## 0.8.0
111+
112+
### Minor Changes
113+
114+
- a89d427: Add GoogleAIFileManager for file uploads.
115+
116+
## 0.7.1
117+
118+
### Patch Changes
119+
120+
- 6ef8cee: Fixed bugs where `RequestOptions`, `generationConfig`, and `safetySettings` were not passed from the model down to some methods.
121+
122+
## 0.7.0
123+
124+
### Minor Changes
125+
126+
- 79b7651: Set default API version to "v1beta" to match Go and Python.
127+
128+
## 0.6.0
129+
130+
### Minor Changes
131+
132+
- 2a1f97c: Add `systemInstruction` feature and forced function calling feature (using `toolConfig`).
133+
134+
### Patch Changes
135+
136+
- 0931d2c: Refactor makeRequest to make fetch mockable.
137+
138+
## 0.5.0
139+
140+
### Minor Changes
141+
142+
- 658a0da: Add `apiClient` configuration option to `RequestOptions`.
143+
144+
## 0.4.0
145+
146+
### Minor Changes
147+
148+
- 790a943: Deprecate functionCall() and add functionCalls().
149+
- e636823: Loosen role field typing on Content.
150+
- 7a45f01: Add option in RequestOptions to change baseUrl.
151+
152+
### Patch Changes
153+
154+
- 3f95168: Fix requestOptions not being passed through countTokens, embedContent, and batchEmbedContents
155+
156+
## 0.3.1
157+
158+
### Patch Changes
159+
160+
- ccd9951: validateChatHistory is now checking that 'parts' property is an array
161+
162+
## 0.3.0
163+
164+
### Minor Changes
165+
166+
- 932e1be: Add `apiVersion` property to `RequestOptions` to allow user to choose API endpoint version.
167+
- 9887465: Added support for function calling
168+
169+
## 0.2.1
170+
171+
### Patch Changes
172+
173+
- 2b0c955: Handle different model prefixes (such as tunedModels/).
174+
175+
## 0.2.0
176+
177+
### Minor Changes
178+
179+
- c64fca1: add request timeout configuration
180+
181+
## 0.1.3
182+
183+
### Patch Changes
184+
185+
- 54839f2: Send API key in header instead of query param.
186+
- 6a4c9c2: Fixed stream hanging
187+
188+
## 0.1.2
189+
190+
### Patch Changes
191+
192+
- 73c2ff9: Fixed UTF-8 handling and chunking for stream output
193+
- fb52d34: Obscure API key in error messages
194+
- 5b5fc7d: Catch unhandled rejections in `sendMessageStream`.
195+
196+
## 0.1.1
197+
198+
### Patch Changes
199+
200+
- Update README to released version and bump to publish new README to npm.

README.md

+8-14
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,12 @@ build with the Gemini API. The Gemini API gives you access to Gemini
77
Gemini models are built from the ground up to be multimodal, so you can reason
88
seamlessly across text, images, and code.
99

10-
> [!CAUTION]
11-
> **Using the Google AI SDK for JavaScript directly from a client-side app is
12-
> recommended for prototyping only.** If you plan to enable billing, we strongly
13-
> recommend that you call the Google AI Gemini API only server-side to keep your
14-
> API key safe. You risk potentially exposing your API key to malicious actors
15-
> if you embed your API key directly in your JavaScript app or fetch it remotely
16-
> at runtime.
10+
> [!CAUTION] **Using the Google AI SDK for JavaScript directly from a
11+
> client-side app is recommended for prototyping only.** If you plan to enable
12+
> billing, we strongly recommend that you call the Google AI Gemini API only
13+
> server-side to keep your API key safe. You risk potentially exposing your API
14+
> key to malicious actors if you embed your API key directly in your JavaScript
15+
> app or fetch it remotely at runtime.
1716
1817
## Get started with the Gemini API
1918

@@ -84,14 +83,9 @@ access and utilize the Gemini model for various use cases.
8483

8584
## Documentation
8685

87-
Check out the docs for this SDK here in the repo and in particular
88-
[GoogleGenerativeAI](/docs/reference/main/generative-ai.md) and
89-
[GoogleAIFileManager](/docs/reference/files/generative-ai.googleaifilemanager.md).
90-
91-
See also the
86+
See the
9287
[Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/) or
93-
[ai.google.dev](https://ai.google.dev) for more generic documentation about the
94-
Gemini API.
88+
[ai.google.dev](https://ai.google.dev) for complete documentation.
9589

9690
## Contributing
9791

packages/main/api-extractor.json renamed to api-extractor.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../config/api-extractor.json",
2+
"extends": "./config/api-extractor.json",
33
"mainEntryPointFilePath": "<projectFolder>/dist/src/index.d.ts",
44
"apiReport": {
55
"reportFileName": "<unscopedPackageName>.api.md"

packages/main/api-extractor.server.json renamed to api-extractor.server.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"extends": "../../config/api-extractor.json",
2+
"extends": "./config/api-extractor.json",
33
"mainEntryPointFilePath": "<projectFolder>/dist/src/server/index.d.ts",
44
"apiReport": {
55
"reportFileName": "<unscopedPackageName>-server.api.md"

config/api-extractor.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
137137
* DEFAULT VALUE: "<projectFolder>/etc/"
138138
*/
139-
"reportFolder": "<projectFolder>/../../common/api-review/"
139+
"reportFolder": "<projectFolder>/common/api-review/"
140140

141141
/**
142142
* Specifies the folder where the temporary report file is written. The file name portion is determined by

lerna.json

-5
This file was deleted.

0 commit comments

Comments
 (0)