@standardagents/google 0.0.1-dev.ffffff → 0.14.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.
Files changed (3) hide show
  1. package/LICENSE.txt +48 -0
  2. package/README.md +138 -3
  3. package/package.json +12 -12
package/LICENSE.txt ADDED
@@ -0,0 +1,48 @@
1
+ PROPRIETARY SOFTWARE LICENSE
2
+
3
+ Copyright (c) 2024-2025 FormKit Inc. All Rights Reserved.
4
+
5
+ UNLICENSED - DO NOT USE
6
+
7
+ This software and associated documentation files (the "Software") are the sole
8
+ and exclusive property of FormKit Inc. ("FormKit").
9
+
10
+ USE RESTRICTIONS
11
+
12
+ The Software is UNLICENSED and proprietary. NO PERMISSION is granted to use,
13
+ copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
14
+ the Software, or to permit persons to whom the Software is furnished to do so,
15
+ under any circumstances, without prior written authorization from FormKit Inc.
16
+
17
+ UNAUTHORIZED USE PROHIBITED
18
+
19
+ Any use of this Software without a valid, written license agreement signed by
20
+ authorized officers of FormKit Inc. is strictly prohibited and constitutes
21
+ unauthorized use and infringement of FormKit's intellectual property rights.
22
+
23
+ LICENSING INQUIRIES
24
+
25
+ Organizations interested in licensing this Software should contact:
26
+ enterprise@formkit.com
27
+
28
+ A written license agreement must be executed before any use of this Software
29
+ is authorized.
30
+
31
+ NO WARRANTY
32
+
33
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
36
+ FORMKIT INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
37
+ AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
38
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39
+
40
+ GOVERNING LAW
41
+
42
+ This license shall be governed by and construed in accordance with the laws
43
+ of the jurisdiction in which FormKit Inc. is incorporated, without regard to
44
+ its conflict of law provisions.
45
+
46
+ FormKit Inc.
47
+ https://formkit.com
48
+ enterprise@formkit.com
package/README.md CHANGED
@@ -1,7 +1,142 @@
1
1
  # @standardagents/google
2
2
 
3
- Stub prerelease package for Standard Agents Google/Gemini provider publishing setup.
3
+ Google Gemini and Imagen provider for Standard Agents.
4
4
 
5
- Current bootstrap version: `0.0.1-dev.ffffff`
5
+ This package exports a Standard Agents provider factory for Google's Gemini chat/multimodal models and Imagen image models. It handles:
6
6
 
7
- This package will be wired into the normal monorepo release flow after trusted publishing is configured.
7
+ - model discovery via the Google model list API
8
+ - Standard Agents message and tool translation to Google `generateContent` requests
9
+ - Gemini text, JSON, tools, and multimodal inputs
10
+ - Imagen generation and image-edit style requests
11
+ - usage and cost calculation from Google usage metadata
12
+
13
+ ## Install
14
+
15
+ ```bash
16
+ npm install @standardagents/google @standardagents/spec
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```ts
22
+ import { google } from '@standardagents/google';
23
+
24
+ const provider = google({
25
+ apiKey: process.env.GOOGLE_API_KEY!,
26
+ });
27
+
28
+ const result = await provider.generate({
29
+ model: 'gemini-2.5-flash',
30
+ messages: [
31
+ {
32
+ role: 'user',
33
+ content: 'Write a one sentence summary of Saturn.',
34
+ },
35
+ ],
36
+ });
37
+
38
+ console.log(result.content);
39
+ console.log(result.usage?.cost);
40
+ ```
41
+
42
+ ## Factory
43
+
44
+ The package exports:
45
+
46
+ - `google(config)` - provider factory
47
+ - `GoogleProvider` - provider class
48
+ - `googleProviderOptions` - Zod schema for provider-specific options
49
+
50
+ Factory config follows `ProviderFactoryConfig` from `@standardagents/spec`:
51
+
52
+ ```ts
53
+ type ProviderFactoryConfig = {
54
+ apiKey: string;
55
+ baseUrl?: string;
56
+ timeout?: number;
57
+ };
58
+ ```
59
+
60
+ ## Supported Features
61
+
62
+ The provider exposes capabilities per model where available. In practice:
63
+
64
+ - Gemini models support text generation, streaming, tool calling, and multimodal input
65
+ - Gemma hosted models support text and selected multimodal inputs, with more limited tool support
66
+ - Imagen models support image generation/edit-style requests and are handled as non-streaming image models
67
+
68
+ Use `getModels()` and `getModelCapabilities()` to inspect the currently available surface:
69
+
70
+ ```ts
71
+ const models = await provider.getModels?.();
72
+ const capabilities = await provider.getModelCapabilities?.('gemini-2.5-pro');
73
+ ```
74
+
75
+ ## Provider Options
76
+
77
+ This package validates Google-specific provider options through `google.providerOptions`.
78
+
79
+ Common options:
80
+
81
+ - `candidateCount`
82
+ - `responseModalities`
83
+ - `safetySettings`
84
+ - `thinkingConfig`
85
+ - `imageConfig`
86
+ - `numberOfImages`
87
+ - `aspectRatio`
88
+ - `negativePrompt`
89
+ - `guidanceScale`
90
+ - `outputMimeType`
91
+ - `language`
92
+ - `editMode`
93
+
94
+ Example:
95
+
96
+ ```ts
97
+ const result = await provider.generate({
98
+ model: 'gemini-2.5-pro',
99
+ messages: [
100
+ { role: 'user', content: 'Return valid JSON with a title and summary.' },
101
+ ],
102
+ responseFormat: {
103
+ type: 'json',
104
+ schema: {
105
+ type: 'object',
106
+ properties: {
107
+ title: { type: 'string' },
108
+ summary: { type: 'string' },
109
+ },
110
+ required: ['title', 'summary'],
111
+ },
112
+ },
113
+ providerOptions: {
114
+ candidateCount: 1,
115
+ safetySettings: [
116
+ { category: 'HARM_CATEGORY_HARASSMENT', threshold: 'BLOCK_ONLY_HIGH' },
117
+ ],
118
+ },
119
+ });
120
+ ```
121
+
122
+ ## Images
123
+
124
+ For multimodal Gemini requests, pass Standard Agents image parts or image attachments and the provider will translate them to Google inline parts. For Imagen requests, the provider will route through the image generation path automatically when the target model is an Imagen model.
125
+
126
+ ## Debugging
127
+
128
+ Use `inspectRequest()` to view the transformed Google-native request body:
129
+
130
+ ```ts
131
+ const inspected = await provider.inspectRequest?.({
132
+ model: 'gemini-2.5-flash',
133
+ messages: [{ role: 'user', content: 'hello' }],
134
+ });
135
+
136
+ console.log(inspected?.body);
137
+ ```
138
+
139
+ ## Notes
140
+
141
+ - Model IDs are normalized so variants like `google/...`, `models/...`, and `publishers/google/models/...` resolve to the same pricing and capability entries where possible.
142
+ - Cost is computed from Google usage metadata and pricing tables when available; Google does not currently return a direct monetary cost field for Gemini requests.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@standardagents/google",
3
- "version": "0.0.1-dev.ffffff",
3
+ "version": "0.14.0",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "restricted",
@@ -20,13 +20,6 @@
20
20
  "dist",
21
21
  "README.md"
22
22
  ],
23
- "scripts": {
24
- "build": "tsup",
25
- "dev": "tsup --watch",
26
- "typecheck": "tsc --noEmit",
27
- "test": "cd ../.. && vitest --dir packages/google",
28
- "test:run": "cd ../.. && vitest run --dir packages/google"
29
- },
30
23
  "dependencies": {
31
24
  "@google/genai": "^1.47.0",
32
25
  "zod": "^4.3.5"
@@ -35,9 +28,9 @@
35
28
  "@standardagents/spec": "^0.10.0"
36
29
  },
37
30
  "devDependencies": {
38
- "@standardagents/spec": "workspace:*",
39
31
  "tsup": "^8.3.5",
40
- "typescript": "^5.9.0"
32
+ "typescript": "^5.9.0",
33
+ "@standardagents/spec": "0.14.0"
41
34
  },
42
35
  "keywords": [
43
36
  "standardagents",
@@ -48,5 +41,12 @@
48
41
  "llm"
49
42
  ],
50
43
  "author": "FormKit Inc.",
51
- "license": "UNLICENSED"
52
- }
44
+ "license": "UNLICENSED",
45
+ "scripts": {
46
+ "build": "tsup",
47
+ "dev": "tsup --watch",
48
+ "typecheck": "tsc --noEmit",
49
+ "test": "cd ../.. && vitest --dir packages/google",
50
+ "test:run": "cd ../.. && vitest run --dir packages/google"
51
+ }
52
+ }