Skip to content

Commit

Permalink
Initial SDK implementation
Browse files Browse the repository at this point in the history
Co-authored by: Christina Holland <chholland@google.com>
Co-authored by: Alex Astrum <alexastrum@gmail.com>
  • Loading branch information
hsubox76 committed Dec 12, 2023
1 parent b91c036 commit 0a6a222
Show file tree
Hide file tree
Showing 196 changed files with 14,559 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Expected Behavior


## Actual Behavior


## Steps to Reproduce the Problem

1.
1.
1.

## Specifications

- Version:
- Platform:
6 changes: 6 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Fixes #<issue_number_goes_here>

> It's a good idea to open an issue first for discussion.
- [ ] Tests pass
- [ ] Appropriate changes to documentation are included in the PR
28 changes: 28 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: run-tests

on:
pull_request:
push:
branches: main

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['18.x', '20.x']
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: yarn install
run: yarn

- name: run formatting and license check
run: yarn format:check

- name: run unit tests (includes lint)
run: yarn test
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
packages/**/dist/
packages/**/temp/
*.tgz
.DS_Store
testfiles
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"printWidth": 80
}
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Google AI JavaScript SDK

> [!IMPORTANT]
> Thanks for your interest in the Google AI SDKs! **You can start using this SDK and its samples on December 13, 2023.** Until then, check out our [blog post](https://blog.google/technology/ai/google-gemini-ai/) to learn more about Google's Gemini multimodal model.
The Google AI JavaScript SDK enables developers to use Google's state-of-the-art generative AI models (like Gemini) to build AI-powered features and applications.

*More details and information coming soon!*

## License

The contents of this repository are licensed under the
[Apache License, version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
247 changes: 247 additions & 0 deletions config/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,247 @@
/**
* @license
* Copyright 2023 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const path = require("path");

module.exports = {
env: {
browser: true,
es6: true,
node: true,
},
parser: "@typescript-eslint/parser",
plugins: [
"@typescript-eslint",
"@typescript-eslint/tslint",
"import",
"unused-imports",
],
parserOptions: {
ecmaVersion: 2015,
sourceType: "module",
},
overrides: [
{
files: ["**/*.test.ts", "**/{test,testing}/**/*.ts"],
rules: {
// TODO: Use https://www.npmjs.com/package/eslint-plugin-chai-friendly instead
"no-unused-expressions": "off",
"@typescript-eslint/no-explicit-any": "off",
},
},
],
ignorePatterns: ["dist/", ".eslintrc.js"],
rules: {
curly: ["error", "all"],
"guard-for-in": "error",
"no-extra-label": "error",
"no-unused-labels": "error",
"new-parens": "error",
"no-new-wrappers": "error",
"no-debugger": "error",
"no-duplicate-case": "error",
"no-throw-literal": "error",
"no-return-await": "error",
"no-unsafe-finally": "error",
"no-unused-expressions": [
"error",
{
allowShortCircuit: true,
},
],
"no-var": "error",
"object-shorthand": "error",
"prefer-arrow-callback": [
"error",
{
allowNamedFunctions: true,
},
],
"prefer-const": [
"error",
{
destructuring: "all",
},
],
radix: "error",
"unused-imports/no-unused-imports-ts": "error",
"default-case": "error",
eqeqeq: [
"error",
"always",
{
null: "ignore",
},
],
"no-caller": "error",
"no-cond-assign": ["error", "always"],
"use-isnan": "error",
"constructor-super": "error",
"no-restricted-properties": [
"error",
{
object: "it",
property: "skip",
},
{
object: "it",
property: "only",
},
{
object: "describe",
property: "skip",
},
{
object: "describe",
property: "only",
},
{
object: "xit",
},
],
"no-restricted-globals": [
"error",
{ name: "xit" },
{ name: "xdescribe" },
{ name: "parseInt", message: "tsstyle#type-coercion" },
{ name: "parseFloat", message: "tsstyle#type-coercion" },
],
"no-array-constructor": "error",
"sort-imports": [
"error",
{
ignoreCase: false,
ignoreDeclarationSort: true, // don"t want to sort import lines, use eslint-plugin-import instead
ignoreMemberSort: false,
memberSyntaxSortOrder: ["none", "all", "multiple", "single"],
allowSeparatedGroups: true,
},
],
"import/no-default-export": "error",
"import/no-duplicates": "error",
"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.*",
],
peerDependencies: true,
},
],
"@typescript-eslint/array-type": [
"error",
{
default: "array-simple",
},
],
"@typescript-eslint/ban-types": [
"error",
{
types: {
Object: "Use {} or 'object' instead.",
String: "Use 'string' instead.",
Number: "Use 'number' instead.",
Boolean: "Use 'boolean' instead.",
Function: `Avoid the Function type, as it provides little safety for the following reasons:
It provides no type safety when calling the value, which means it's easy to provide the wrong arguments.
It accepts class declarations, which will fail when called, as they are called without the new keyword.`,
},
extendDefaults: false,
},
],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "class",
format: ["PascalCase"],
},
{
selector: "interface",
format: ["PascalCase"],
custom: {
regex: "^I[A-Z]",
match: false,
},
},
],
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
"@typescript-eslint/explicit-member-accessibility": [
"error",
{
accessibility: "no-public",
overrides: {
parameterProperties: "off",
},
},
],
"@typescript-eslint/consistent-type-assertions": [
"error",
{
assertionStyle: "as",
},
],
"@typescript-eslint/no-explicit-any": ["error", { ignoreRestArgs: true }],
"@typescript-eslint/no-namespace": [
"error",
{
allowDeclarations: true,
},
],
"@typescript-eslint/triple-slash-reference": [
"error",
{
path: "never",
types: "never",
lib: "never",
},
],
"@typescript-eslint/no-require-imports": "error",
"@typescript-eslint/no-useless-constructor": "error",
"@typescript-eslint/semi": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
},
],
"@typescript-eslint/no-unused-vars": [
"error",
{
varsIgnorePattern: "^_",
argsIgnorePattern: "^_",
},
],
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/tslint/config": [
"error",
{
rules: {
"jsdoc-format": true,
"arrow-return-shorthand": true,
},
},
],
},
};
Loading

0 comments on commit 0a6a222

Please sign in to comment.