Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove monorepo structure and tooling #226

Merged
merged 4 commits into from
Aug 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 4 additions & 13 deletions config/.eslintrc.js → .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* @license
* Copyright 2023 Google LLC
* Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -15,8 +15,6 @@
* limitations under the License.
*/

const path = require("path");

module.exports = {
env: {
browser: true,
Expand All @@ -33,6 +31,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 2015,
sourceType: "module",
project: "tsconfig.json",
},
overrides: [
{
Expand Down Expand Up @@ -136,15 +135,7 @@ module.exports = {
"import/no-extraneous-dependencies": [
"error",
{
// Check dependencies from both local package.json
// and from root package.json.
packageDir: [path.join(__dirname, "../"), "./"],
devDependencies: [
"**/*.test.ts",
"**/test/**/*.ts",
"**/testing/**/*.ts",
"*.config.*",
],
packageDir: [__dirname],
peerDependencies: true,
},
],
Expand Down Expand Up @@ -182,7 +173,7 @@ module.exports = {
regex: "^I[A-Z]",
match: false,
},
leadingUnderscore: 'allow'
leadingUnderscore: "allow",
},
],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ jobs:
- name: run node iTests
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: yarn --cwd packages/main test:node:integration
run: yarn test:node:integration

web-integration-test:
runs-on: ubuntu-latest
Expand All @@ -81,4 +81,4 @@ jobs:
- name: run web iTests
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
run: yarn --cwd packages/main test:web:integration
run: yarn test:web:integration
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
node_modules
packages/**/dist/
packages/**/temp/
dist/
temp/
*.tgz
.DS_Store
testfiles
File renamed without changes.
201 changes: 200 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1 +1,200 @@
See [changelog for @google/generative-ai](/packages/main/CHANGELOG.md)
# @google/generative-ai

## 0.17.0

### Minor Changes

- 3b5daae: Fix `Schema` type to reference itself and not a derived type in its `items` array and `properties` map.

## 0.16.0

### Minor Changes

- d2d42ca: Adds `SingleRequestOptions` with `AbortSignal` support to most of the asynchronous methods of `GenerativeModel`, `GoogleAIFileManager` and `ChatSession`.

## 0.15.0

### Minor Changes

- 05b8631: Add FinishReason.LANGUAGE enum value.

### Patch Changes

- e87d5b0: Fix countTokens to include any params set on the model instance.

## 0.14.1

### Patch Changes

- 0c23bb3: Add `CodeExecutionTool` to `Tool` type.

## 0.14.0

### Minor Changes

- fb1c0f2: Add a `cachedContentTokenCount` field to the `UsageMetadata` interface returned by `generateContent` responses.
- 06216be: Add code execution feature.

## 0.13.0

### Minor Changes

- 83ec4ac: Expand the model's `countTokens` method to alternatively accept a `GenerateContentRequest`.
- 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.

### Patch Changes

- 1440a05: Removed the `model` field from the internally formatted payload of `countToken` requests as it was unnecessary.
- 03eb57b: Fix missing usageMetadata in streamed aggregated response (#174)

## 0.12.0

### Minor Changes

- 85ff2c4: Added `responseSchema` to `GenerationConfig` to allow user to provide a JSON schema when `responseMimeType` is set to JSON.

## 0.11.5

### Patch Changes

- 42ba6ca: Fix paths to @google/generative-ai/files.

## 0.11.4

### Patch Changes

- ee02ff0: Add additional properties `videoMetadata` and `error` to `FileMetadataResponse` type.

## 0.11.3

### Patch Changes

- c7c0b50: Fixed `FileState` enum values to be strings.

## 0.11.2

### Patch Changes

- cefa8f2: Lifted a restriction in chat sessions that required a specific order of content roles.

## 0.11.1

### Patch Changes

- 819501f: Fix a bug that caused file uploads to be named "undefined" if no file name is provided.

## 0.11.0

### Minor Changes

- 58ab777: Added responseMimeType to GenerationConfig to allow for JSON formatted responses.

### Patch Changes

- c39015c: Fixed a bug where `text()` did not handle multiple `TextPart`s in a single candidate. Added `state` field to `FileMetadataResponse`.

## 0.10.0

### Minor Changes

- 657799a: Added UsageMetadata to GenerateContentResponses.
- 4562366: Add a request option for custom headers

## 0.9.0

### Minor Changes

- ca62400: Allow text-only systemInstruction as well as Part and Content.
- 111e970: Export error classes and add more properties to fetch errors.

## 0.8.0

### Minor Changes

- a89d427: Add GoogleAIFileManager for file uploads.

## 0.7.1

### Patch Changes

- 6ef8cee: Fixed bugs where `RequestOptions`, `generationConfig`, and `safetySettings` were not passed from the model down to some methods.

## 0.7.0

### Minor Changes

- 79b7651: Set default API version to "v1beta" to match Go and Python.

## 0.6.0

### Minor Changes

- 2a1f97c: Add `systemInstruction` feature and forced function calling feature (using `toolConfig`).

### Patch Changes

- 0931d2c: Refactor makeRequest to make fetch mockable.

## 0.5.0

### Minor Changes

- 658a0da: Add `apiClient` configuration option to `RequestOptions`.

## 0.4.0

### Minor Changes

- 790a943: Deprecate functionCall() and add functionCalls().
- e636823: Loosen role field typing on Content.
- 7a45f01: Add option in RequestOptions to change baseUrl.

### Patch Changes

- 3f95168: Fix requestOptions not being passed through countTokens, embedContent, and batchEmbedContents

## 0.3.1

### Patch Changes

- ccd9951: validateChatHistory is now checking that 'parts' property is an array

## 0.3.0

### Minor Changes

- 932e1be: Add `apiVersion` property to `RequestOptions` to allow user to choose API endpoint version.
- 9887465: Added support for function calling

## 0.2.1

### Patch Changes

- 2b0c955: Handle different model prefixes (such as tunedModels/).

## 0.2.0

### Minor Changes

- c64fca1: add request timeout configuration

## 0.1.3

### Patch Changes

- 54839f2: Send API key in header instead of query param.
- 6a4c9c2: Fixed stream hanging

## 0.1.2

### Patch Changes

- 73c2ff9: Fixed UTF-8 handling and chunking for stream output
- fb52d34: Obscure API key in error messages
- 5b5fc7d: Catch unhandled rejections in `sendMessageStream`.

## 0.1.1

### Patch Changes

- Update README to released version and bump to publish new README to npm.
22 changes: 8 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@ build with the Gemini API. The Gemini API gives you access to Gemini
Gemini models are built from the ground up to be multimodal, so you can reason
seamlessly across text, images, and code.

> [!CAUTION]
> **Using the Google AI SDK for JavaScript directly from a client-side app is
> recommended for prototyping only.** If you plan to enable billing, we strongly
> recommend that you call the Google AI Gemini API only server-side to keep your
> API key safe. You risk potentially exposing your API key to malicious actors
> if you embed your API key directly in your JavaScript app or fetch it remotely
> at runtime.
> [!CAUTION] **Using the Google AI SDK for JavaScript directly from a
> client-side app is recommended for prototyping only.** If you plan to enable
> billing, we strongly recommend that you call the Google AI Gemini API only
> server-side to keep your API key safe. You risk potentially exposing your API
> key to malicious actors if you embed your API key directly in your JavaScript
> app or fetch it remotely at runtime.

## Get started with the Gemini API

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

## Documentation

Check out the docs for this SDK here in the repo and in particular
[GoogleGenerativeAI](/docs/reference/main/generative-ai.md) and
[GoogleAIFileManager](/docs/reference/files/generative-ai.googleaifilemanager.md).

See also the
See the
[Gemini API Cookbook](https://github.com/google-gemini/gemini-api-cookbook/) or
[ai.google.dev](https://ai.google.dev) for more generic documentation about the
Gemini API.
[ai.google.dev](https://ai.google.dev) for complete documentation.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion packages/main/api-extractor.json → api-extractor.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../config/api-extractor.json",
"extends": "./config/api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/dist/src/index.d.ts",
"apiReport": {
"reportFileName": "<unscopedPackageName>.api.md"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "../../config/api-extractor.json",
"extends": "./config/api-extractor.json",
"mainEntryPointFilePath": "<projectFolder>/dist/src/server/index.d.ts",
"apiReport": {
"reportFileName": "<unscopedPackageName>-server.api.md"
Expand Down
2 changes: 1 addition & 1 deletion config/api-extractor.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@
* SUPPORTED TOKENS: <projectFolder>, <packageName>, <unscopedPackageName>
* DEFAULT VALUE: "<projectFolder>/etc/"
*/
"reportFolder": "<projectFolder>/../../common/api-review/"
"reportFolder": "<projectFolder>/common/api-review/"

/**
* Specifies the folder where the temporary report file is written. The file name portion is determined by
Expand Down
5 changes: 0 additions & 5 deletions lerna.json

This file was deleted.

Loading
Loading