@jz92/ai-provider 0.3.1 → 0.3.2

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
@@ -1,4 +1,4 @@
1
- # @jz92/ai-provider
1
+ # @jithin/ai-provider
2
2
 
3
3
  A zero-config AI routing layer for Node.js and Next.js projects.
4
4
 
@@ -52,7 +52,7 @@ For production (Vercel, AWS, etc.) you only need an API key from your chosen pro
52
52
  ## Installation
53
53
 
54
54
  ```bash
55
- npm install @jz92/ai-provider
55
+ npm install @jithin/ai-provider
56
56
  ```
57
57
 
58
58
  After install, a setup guide prints automatically telling you exactly which peer deps to install based on the providers you want to use. The short version:
@@ -81,18 +81,18 @@ npm install @ai-sdk/mistral # → MISTRAL_API_KEY
81
81
  ## Usage
82
82
 
83
83
  ```typescript
84
- import { generateStructured, generatePlainText } from '@jz92/ai-provider'
84
+ import { generateStructured, generatePlainText } from '@jithin/ai-provider'
85
85
  import { z } from 'zod'
86
86
 
87
87
  // Structured output — returns validated, typed JSON
88
88
  const result = await generateStructured({
89
89
  systemPrompt: 'Extract data. Respond in JSON only.',
90
- prompt: 'My name is Jithin and I live in Maidenhead.',
90
+ prompt: 'Find all orders placed in the last 30 days with status delivered.',
91
91
  schema: z.object({ name: z.string(), city: z.string() }),
92
92
  cacheKey: `extract:${input}`, // optional — skips API on repeat calls
93
93
  })
94
94
 
95
- console.log(result.data) // { name: 'Jithin', city: 'Maidenhead' }
95
+ console.log(result.data) // { collection: 'orders', operation: 'find', query: { ... } }
96
96
  console.log(result.provider) // 'ollama' locally · 'anthropic' in prod
97
97
  console.log(result.fromCache) // true on cache hit
98
98
 
@@ -263,7 +263,7 @@ ollama create my-feature -f modelfiles/Modelfile.my-feature
263
263
  OLLAMA_MODEL=my-feature
264
264
  ```
265
265
 
266
- A `Modelfile.template` is included at `node_modules/@jz92/ai-provider/modelfiles-template/Modelfile.template`.
266
+ A `Modelfile.template` is included at `node_modules/@jithin/ai-provider/modelfiles-template/Modelfile.template`.
267
267
 
268
268
  ---
269
269
 
@@ -286,7 +286,7 @@ Your responsibilities as a consumer:
286
286
  The package throws `AIProviderError` with a typed `code` and a clear actionable message. You never see raw SDK errors.
287
287
 
288
288
  ```typescript
289
- import { generateStructured, AIProviderError } from '@jz92/ai-provider'
289
+ import { generateStructured, AIProviderError } from '@jithin/ai-provider'
290
290
 
291
291
  try {
292
292
  const result = await generateStructured({ ... })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jz92/ai-provider",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Environment-aware AI provider for portfolio projects. Local dev → Ollama, deployed → any cloud provider.",
5
5
  "author": "jz92",
6
6
  "license": "MIT",
@@ -1,33 +1,35 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- // Runs after npm install — prints a clear setup guide
4
- // so consumers know exactly which peer deps to install.
5
-
6
3
  const reset = '\x1b[0m'
7
4
  const bold = '\x1b[1m'
8
5
  const cyan = '\x1b[36m'
9
6
  const yellow = '\x1b[33m'
10
7
  const green = '\x1b[32m'
11
8
  const dim = '\x1b[2m'
9
+ const red = '\x1b[31m'
12
10
 
13
11
  console.log(`
14
12
  ${bold}@jz92/ai-provider${reset} installed successfully.
15
13
 
16
14
  ${yellow}Next: install the provider adapters you need.${reset}
17
15
 
18
- ${bold}Local dev (Ollama — free, no API key):${reset}
19
- ${cyan}npm install ollama-ai-provider${reset}
20
- ${dim}Then: brew install ollama && ollama pull qwen2.5-coder:14b${reset}
16
+ ${bold}Always required:${reset}
17
+ ${cyan}npm install ai zod${reset}
21
18
 
22
- ${bold}Cloud providers (install only what you use):${reset}
19
+ ${bold}Cloud providers install only what you use:${reset}
23
20
  ${cyan}npm install @ai-sdk/anthropic${reset} ${dim}→ ANTHROPIC_API_KEY https://console.anthropic.com${reset}
24
21
  ${cyan}npm install @ai-sdk/openai${reset} ${dim}→ OPENAI_API_KEY https://platform.openai.com/api-keys${reset}
25
22
  ${cyan}npm install @ai-sdk/google${reset} ${dim}→ GOOGLE_GENERATIVE_AI_API_KEY https://aistudio.google.com${reset}
26
23
  ${cyan}npm install @ai-sdk/groq${reset} ${dim}→ GROQ_API_KEY https://console.groq.com/keys${reset}
27
24
  ${cyan}npm install @ai-sdk/mistral${reset} ${dim}→ MISTRAL_API_KEY https://console.mistral.ai${reset}
28
25
 
29
- ${bold}Required in all cases:${reset}
30
- ${cyan}npm install ai zod${reset}
26
+ ${bold}Local dev with Ollama (devDependency — not for production):${reset}
27
+ ${cyan}npm install ollama-ai-provider --save-dev --legacy-peer-deps${reset}
28
+ ${dim}Then: brew install ollama && ollama pull qwen2.5-coder:14b${reset}
29
+
30
+ ${red}Note:${reset} ollama-ai-provider@1.2.0 conflicts with zod@4.
31
+ ${dim}--legacy-peer-deps is required until ollama-ai-provider updates.${reset}
32
+ ${dim}This does not affect production builds — devDependencies are excluded on Vercel/AWS.${reset}
31
33
 
32
34
  ${bold}Set NODE_ENV in your .env:${reset}
33
35
  ${dim}development${reset} → Ollama (free, local)