@gullabs/any-llm 0.6.0 → 0.7.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.
package/README.md CHANGED
@@ -28,11 +28,12 @@ import {
28
28
 
29
29
  const client = createClient({
30
30
  adapters: [geminiAdapter()],
31
- pricing: geminiPricingSource(),
31
+ pricingSources: { google: geminiPricingSource() },
32
32
  })
33
33
 
34
34
  const summarize = defineCallSite({
35
35
  id: 'summarize',
36
+ provider: 'google',
36
37
  model: 'gemini-2.5-flash',
37
38
  jsonSchema: {
38
39
  type: 'object',
@@ -52,7 +53,7 @@ const result = await client.runStructured(
52
53
  { auth: { apiKey: process.env.GEMINI_API_KEY! } },
53
54
  )
54
55
 
55
- const descriptor = defaultGeminiRegistry.resolve('gemini-3.5-flash')
56
+ const descriptor = defaultGeminiRegistry.resolve('google', 'gemini-3.5-flash')
56
57
  if (!descriptor) throw new Error('unknown model')
57
58
 
58
59
  const parsedConfig = descriptor.configSchema.parse({
package/dist/index.cjs CHANGED
@@ -6,7 +6,7 @@ var google = require('@gullabs/google');
6
6
  // src/index.ts
7
7
 
8
8
  // package.json
9
- var version = "0.6.0";
9
+ var version = "0.7.0";
10
10
 
11
11
  // src/index.ts
12
12
  var ANY_LLM_VERSION = version;
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";;;;;;;;AAEE,IAAA,OAAA,GAAW,OAAA;;;ACcN,IAAM,eAAA,GAA0B","file":"index.cjs","sourcesContent":["{\n \"name\": \"@gullabs/any-llm\",\n \"version\": \"0.6.0\",\n \"description\": \"Batteries-included any-llm client for Gemini: engine, adapter, and Google SDK in one install.\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/gullabs/any-llm.git\",\n \"directory\": \"packages/any-llm\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n }\n },\n \"files\": [\n \"dist\",\n \"skills\"\n ],\n \"scripts\": {\n \"build\": \"tsup\"\n },\n \"dependencies\": {\n \"@google/genai\": \"^1.45.0 || ^2\",\n \"@gullabs/core\": \"workspace:*\",\n \"@gullabs/google\": \"workspace:*\"\n },\n \"engines\": {\n \"node\": \">=20.9.0\"\n },\n \"sideEffects\": false,\n \"keywords\": [\n \"llm\",\n \"gemini\",\n \"google-genai\",\n \"ai\",\n \"tokens\",\n \"cost\",\n \"usage\",\n \"observability\",\n \"typescript\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"homepage\": \"https://github.com/gullabs/any-llm/tree/main/packages/any-llm#readme\",\n \"bugs\": \"https://github.com/gullabs/any-llm/issues\"\n}\n","/**\n * @gullabs/any-llm — batteries-included public entrypoint.\n *\n * This package is the default client install path. It re-exports the core\n * engine and Gemini adapter while depending on the Gemini SDK for a one-package\n * setup.\n *\n * @module\n */\n\nexport * from '@gullabs/core'\nexport * from '@gullabs/google'\n\nimport { version } from '../package.json'\n\n/** Library version, sourced from package.json at build time. */\nexport const ANY_LLM_VERSION: string = version\n"]}
1
+ {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";;;;;;;;AAEE,IAAA,OAAA,GAAW,OAAA;;;ACcN,IAAM,eAAA,GAA0B","file":"index.cjs","sourcesContent":["{\n \"name\": \"@gullabs/any-llm\",\n \"version\": \"0.7.0\",\n \"description\": \"Batteries-included any-llm client for Gemini: engine, adapter, and Google SDK in one install.\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/gullabs/any-llm.git\",\n \"directory\": \"packages/any-llm\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n }\n },\n \"files\": [\n \"dist\",\n \"skills\"\n ],\n \"scripts\": {\n \"build\": \"tsup\"\n },\n \"dependencies\": {\n \"@google/genai\": \"^1.45.0 || ^2\",\n \"@gullabs/core\": \"workspace:*\",\n \"@gullabs/google\": \"workspace:*\"\n },\n \"engines\": {\n \"node\": \">=20.9.0\"\n },\n \"sideEffects\": false,\n \"keywords\": [\n \"llm\",\n \"gemini\",\n \"google-genai\",\n \"ai\",\n \"tokens\",\n \"cost\",\n \"usage\",\n \"observability\",\n \"typescript\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"homepage\": \"https://github.com/gullabs/any-llm/tree/main/packages/any-llm#readme\",\n \"bugs\": \"https://github.com/gullabs/any-llm/issues\"\n}\n","/**\n * @gullabs/any-llm — batteries-included public entrypoint.\n *\n * This package is the default client install path. It re-exports the core\n * engine and Gemini adapter while depending on the Gemini SDK for a one-package\n * setup.\n *\n * @module\n */\n\nexport * from '@gullabs/core'\nexport * from '@gullabs/google'\n\nimport { version } from '../package.json'\n\n/** Library version, sourced from package.json at build time. */\nexport const ANY_LLM_VERSION: string = version\n"]}
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ export * from '@gullabs/google';
4
4
  // src/index.ts
5
5
 
6
6
  // package.json
7
- var version = "0.6.0";
7
+ var version = "0.7.0";
8
8
 
9
9
  // src/index.ts
10
10
  var ANY_LLM_VERSION = version;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";;;;;;AAEE,IAAA,OAAA,GAAW,OAAA;;;ACcN,IAAM,eAAA,GAA0B","file":"index.js","sourcesContent":["{\n \"name\": \"@gullabs/any-llm\",\n \"version\": \"0.6.0\",\n \"description\": \"Batteries-included any-llm client for Gemini: engine, adapter, and Google SDK in one install.\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/gullabs/any-llm.git\",\n \"directory\": \"packages/any-llm\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n }\n },\n \"files\": [\n \"dist\",\n \"skills\"\n ],\n \"scripts\": {\n \"build\": \"tsup\"\n },\n \"dependencies\": {\n \"@google/genai\": \"^1.45.0 || ^2\",\n \"@gullabs/core\": \"workspace:*\",\n \"@gullabs/google\": \"workspace:*\"\n },\n \"engines\": {\n \"node\": \">=20.9.0\"\n },\n \"sideEffects\": false,\n \"keywords\": [\n \"llm\",\n \"gemini\",\n \"google-genai\",\n \"ai\",\n \"tokens\",\n \"cost\",\n \"usage\",\n \"observability\",\n \"typescript\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"homepage\": \"https://github.com/gullabs/any-llm/tree/main/packages/any-llm#readme\",\n \"bugs\": \"https://github.com/gullabs/any-llm/issues\"\n}\n","/**\n * @gullabs/any-llm — batteries-included public entrypoint.\n *\n * This package is the default client install path. It re-exports the core\n * engine and Gemini adapter while depending on the Gemini SDK for a one-package\n * setup.\n *\n * @module\n */\n\nexport * from '@gullabs/core'\nexport * from '@gullabs/google'\n\nimport { version } from '../package.json'\n\n/** Library version, sourced from package.json at build time. */\nexport const ANY_LLM_VERSION: string = version\n"]}
1
+ {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";;;;;;AAEE,IAAA,OAAA,GAAW,OAAA;;;ACcN,IAAM,eAAA,GAA0B","file":"index.js","sourcesContent":["{\n \"name\": \"@gullabs/any-llm\",\n \"version\": \"0.7.0\",\n \"description\": \"Batteries-included any-llm client for Gemini: engine, adapter, and Google SDK in one install.\",\n \"type\": \"module\",\n \"license\": \"Apache-2.0\",\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git+https://github.com/gullabs/any-llm.git\",\n \"directory\": \"packages/any-llm\"\n },\n \"main\": \"./dist/index.cjs\",\n \"module\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"types\": \"./dist/index.d.ts\",\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\"\n }\n },\n \"files\": [\n \"dist\",\n \"skills\"\n ],\n \"scripts\": {\n \"build\": \"tsup\"\n },\n \"dependencies\": {\n \"@google/genai\": \"^1.45.0 || ^2\",\n \"@gullabs/core\": \"workspace:*\",\n \"@gullabs/google\": \"workspace:*\"\n },\n \"engines\": {\n \"node\": \">=20.9.0\"\n },\n \"sideEffects\": false,\n \"keywords\": [\n \"llm\",\n \"gemini\",\n \"google-genai\",\n \"ai\",\n \"tokens\",\n \"cost\",\n \"usage\",\n \"observability\",\n \"typescript\"\n ],\n \"publishConfig\": {\n \"access\": \"public\"\n },\n \"homepage\": \"https://github.com/gullabs/any-llm/tree/main/packages/any-llm#readme\",\n \"bugs\": \"https://github.com/gullabs/any-llm/issues\"\n}\n","/**\n * @gullabs/any-llm — batteries-included public entrypoint.\n *\n * This package is the default client install path. It re-exports the core\n * engine and Gemini adapter while depending on the Gemini SDK for a one-package\n * setup.\n *\n * @module\n */\n\nexport * from '@gullabs/core'\nexport * from '@gullabs/google'\n\nimport { version } from '../package.json'\n\n/** Library version, sourced from package.json at build time. */\nexport const ANY_LLM_VERSION: string = version\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gullabs/any-llm",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Batteries-included any-llm client for Gemini: engine, adapter, and Google SDK in one install.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -25,8 +25,8 @@
25
25
  ],
26
26
  "dependencies": {
27
27
  "@google/genai": "^1.45.0 || ^2",
28
- "@gullabs/core": "0.5.0",
29
- "@gullabs/google": "0.6.0"
28
+ "@gullabs/core": "0.7.0",
29
+ "@gullabs/google": "0.7.0"
30
30
  },
31
31
  "engines": {
32
32
  "node": ">=20.9.0"
@@ -40,7 +40,7 @@ explicitly. `createClient()` itself takes no credentials.
40
40
  // bypassed with `as any` it throws LlmError({ kind: 'invalid_auth' }) before any I/O.
41
41
  const client = createClient({
42
42
  adapters: [geminiAdapter()],
43
- pricing: geminiPricingSource(),
43
+ pricingSources: { google: geminiPricingSource() },
44
44
  })
45
45
  await client.generate(request, {} as GenerateOptions)
46
46
 
@@ -54,6 +54,18 @@ before any network call is made. Vertex AI (ADC/service-account auth) is **not
54
54
  supported** — it was removed and is a roadmap item only; do not write code assuming
55
55
  `{ vertex: { project, location } }` works.
56
56
 
57
+ ## #2 gotcha: identity is `(provider, model)`, not a bare `model` string
58
+
59
+ Every `generate()`/`runStructured()` request and every `defineCallSite()` requires an
60
+ explicit top-level `provider` (e.g. `'google'`, `'claude-cli'`, `'codex-cli'`) alongside
61
+ the bare, provider-native `model` string. The engine routes by `req.provider` directly
62
+ — it never derives, parses, or guesses a provider from `model`, and it never accepts a
63
+ slash-joined string like `'google/gemini-2.5-flash'`. A request with no `provider`, an
64
+ unconfigured `provider`, or a `(provider, model)` pair the registry doesn't recognize is
65
+ rejected with `LlmError({ kind: 'bad_request' })` before any I/O. This also means the
66
+ same bare model id can exist under multiple providers with different config schemas —
67
+ `resolve()` always takes both.
68
+
57
69
  ## Quickstart
58
70
 
59
71
  ```ts
@@ -62,11 +74,12 @@ import { createClient, geminiPricingSource, geminiAdapter } from '@gullabs/any-l
62
74
 
63
75
  const client = createClient({
64
76
  adapters: [geminiAdapter()],
65
- pricing: geminiPricingSource(),
77
+ pricingSources: { google: geminiPricingSource() },
66
78
  })
67
79
 
68
80
  const result = await client.generate(
69
81
  {
82
+ provider: 'google',
70
83
  model: 'gemini-2.5-flash',
71
84
  messages: [{ role: 'user', parts: [{ kind: 'text', text: 'Hello!' }] }],
72
85
  },
@@ -89,6 +102,7 @@ import { defineCallSite } from '@gullabs/core'
89
102
 
90
103
  const summarize = defineCallSite({
91
104
  id: 'summarize-article', // persisted as callSiteId on every record
105
+ provider: 'google',
92
106
  model: 'gemini-2.5-flash',
93
107
  system: 'You are a concise summarizer.',
94
108
  userTemplate: 'Summarize this article in 3 sentences:\n\n{{article}}',
@@ -113,7 +127,7 @@ Treat model config as descriptor-owned:
113
127
  ```ts
114
128
  import { defaultGeminiRegistry } from '@gullabs/core'
115
129
 
116
- const descriptor = defaultGeminiRegistry.resolve('gemini-3.5-flash')
130
+ const descriptor = defaultGeminiRegistry.resolve('google', 'gemini-3.5-flash')
117
131
  if (!descriptor) throw new Error('unknown model')
118
132
 
119
133
  // UI/forms:
@@ -147,11 +161,12 @@ import type { StandardSchemaV1 } from '@gullabs/core'
147
161
 
148
162
  const client = createClient({
149
163
  adapters: [geminiAdapter()],
150
- pricing: geminiPricingSource(),
164
+ pricingSources: { google: geminiPricingSource() },
151
165
  })
152
166
 
153
167
  const result = await client.generate(
154
168
  {
169
+ provider: 'google',
155
170
  model: 'gemini-2.5-flash',
156
171
  messages: [{ role: 'user', parts: [{ kind: 'text', text: 'Rate this PR 1-10.' }] }],
157
172
  output: {
@@ -222,11 +237,13 @@ try {
222
237
 
223
238
  Bad input or config throws `bad_request` (or `invalid_auth`) **before any I/O** —
224
239
  nothing is silently clamped, coerced, or defaulted around a typo. Examples already
225
- enforced by the engine/adapter: an unrouteable `model` string, a config value that
226
- fails the selected descriptor schema, a `reasoning.budgetTokens` set on a model whose
227
- API only supports `reasoning.effort`, duplicate adapter/middleware `id`s, and a
228
- grounding + structured-output combination outside the exact documented Gemini support
229
- set.
240
+ enforced by the engine/adapter: a request or call site with no `provider`, a `provider`
241
+ that doesn't match any configured adapter, a `(provider, model)` pair absent from the
242
+ registry (including a bare model string with a slash, like `'google/gemini-2.5-flash'`
243
+ — slash strings are never parsed), a config value that fails the selected descriptor
244
+ schema, a `reasoning.budgetTokens` set on a model whose API only supports
245
+ `reasoning.effort`, duplicate adapter/middleware `id`s, and a grounding +
246
+ structured-output combination outside the exact documented Gemini support set.
230
247
 
231
248
  **Do not add defensive fallback/clamping code around this library.** If a call throws
232
249
  `bad_request`, fix the input — do not catch-and-retry with a "safer" guessed value; the
@@ -272,6 +289,8 @@ Exact model reminders:
272
289
 
273
290
  - Forgetting `opts.auth` on a `generate()`/`runStructured()` call — it is required on
274
291
  every call, not just once at `createClient()` time.
292
+ - Omitting `provider` (or writing a slash-joined `'provider/model'` string) on a request
293
+ or call site — `provider` is a required top-level field; the engine never derives it.
275
294
  - Assuming `process.env.GEMINI_API_KEY` (or similar) is read automatically — it is
276
295
  never read by this library; the host must resolve and pass the key itself.
277
296
  - Assuming `result.output`'s shape is validated — it is `unknown`; validate it yourself