@memberjunction/ai-gemini 4.4.0 → 5.0.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 (2) hide show
  1. package/package.json +3 -3
  2. package/README.md +0 -140
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/ai-gemini",
3
3
  "type": "module",
4
- "version": "4.4.0",
4
+ "version": "5.0.0",
5
5
  "description": "MemberJunction Wrapper for Google Gemini AI Models",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -20,8 +20,8 @@
20
20
  "typescript": "^5.9.3"
21
21
  },
22
22
  "dependencies": {
23
- "@memberjunction/ai": "4.4.0",
24
- "@memberjunction/global": "4.4.0",
23
+ "@memberjunction/ai": "5.0.0",
24
+ "@memberjunction/global": "5.0.0",
25
25
  "@google/genai": "^1.40.0"
26
26
  },
27
27
  "repository": {
package/README.md DELETED
@@ -1,140 +0,0 @@
1
- # @memberjunction/ai-gemini
2
-
3
- MemberJunction AI provider for Google Gemini models. This package provides both LLM and image generation capabilities, supporting Gemini Pro, Flash, and advanced image generation models with native multimodal support, thinking/reasoning, and streaming.
4
-
5
- ## Architecture
6
-
7
- ```mermaid
8
- graph TD
9
- A["GeminiLLM<br/>(Chat Provider)"] -->|extends| B["BaseLLM<br/>(@memberjunction/ai)"]
10
- C["GeminiImageGenerator<br/>(Image Provider)"] -->|extends| D["BaseImageGenerator<br/>(@memberjunction/ai)"]
11
- A -->|wraps| E["GoogleGenAI<br/>(@google/genai)"]
12
- C -->|wraps| E
13
- A -->|provides| F["Chat + Streaming"]
14
- A -->|provides| G["Thinking/Reasoning<br/>Budget Control"]
15
- C -->|provides| H["Image Generation<br/>+ Editing + Variations"]
16
- B -->|registered via| I["@RegisterClass"]
17
- D -->|registered via| I
18
-
19
- style A fill:#7c5295,stroke:#563a6b,color:#fff
20
- style C fill:#7c5295,stroke:#563a6b,color:#fff
21
- style B fill:#2d6a9f,stroke:#1a4971,color:#fff
22
- style D fill:#2d6a9f,stroke:#1a4971,color:#fff
23
- style E fill:#2d8659,stroke:#1a5c3a,color:#fff
24
- style F fill:#b8762f,stroke:#8a5722,color:#fff
25
- style G fill:#b8762f,stroke:#8a5722,color:#fff
26
- style H fill:#b8762f,stroke:#8a5722,color:#fff
27
- style I fill:#b8762f,stroke:#8a5722,color:#fff
28
- ```
29
-
30
- ## Features
31
-
32
- ### LLM (GeminiLLM)
33
- - **Chat Completions**: Full conversational AI with system instructions
34
- - **Streaming**: Real-time response streaming with chunk processing
35
- - **Thinking/Reasoning**: Configurable thinking budget for Gemini 2.5+ and thinking levels for Gemini 3+
36
- - **Multimodal Input**: Native support for text, images, audio, video, and file inputs
37
- - **Message Alternation**: Automatic handling of Gemini's role alternation requirements
38
- - **Safety Handling**: Detection and reporting of content blocking with detailed safety ratings
39
- - **Effort Level Mapping**: Maps MJ effort levels (1-100) to Gemini thinking budgets (0-24576)
40
-
41
- ### Image Generation (GeminiImageGenerator)
42
- - **Text-to-Image**: Generate images using Gemini 3 Pro Image model
43
- - **Image Editing**: Edit existing images using multimodal context
44
- - **Image Variations**: Create variations of existing images
45
- - **Resolution Control**: Support for sizes up to 4K (3840x2160)
46
- - **Style and Quality**: Configurable style and quality parameters
47
-
48
- ## Installation
49
-
50
- ```bash
51
- npm install @memberjunction/ai-gemini
52
- ```
53
-
54
- ## Usage
55
-
56
- ### Chat Completion
57
-
58
- ```typescript
59
- import { GeminiLLM } from '@memberjunction/ai-gemini';
60
-
61
- const llm = new GeminiLLM('your-google-api-key');
62
-
63
- const result = await llm.ChatCompletion({
64
- model: 'gemini-2.5-flash',
65
- messages: [
66
- { role: 'system', content: 'You are a helpful assistant.' },
67
- { role: 'user', content: 'Explain quantum computing.' }
68
- ],
69
- temperature: 0.7
70
- });
71
- ```
72
-
73
- ### Streaming with Thinking
74
-
75
- ```typescript
76
- const result = await llm.ChatCompletion({
77
- model: 'gemini-2.5-pro',
78
- messages: [{ role: 'user', content: 'Solve this math problem step by step.' }],
79
- effortLevel: '75', // High thinking budget
80
- streaming: true,
81
- streamingCallbacks: {
82
- OnContent: (content) => process.stdout.write(content)
83
- }
84
- });
85
-
86
- // Access thinking content
87
- console.log('Thinking:', result.data.choices[0].message.thinking);
88
- ```
89
-
90
- ### Image Generation
91
-
92
- ```typescript
93
- import { GeminiImageGenerator } from '@memberjunction/ai-gemini';
94
-
95
- const generator = new GeminiImageGenerator('your-google-api-key');
96
-
97
- const result = await generator.GenerateImage({
98
- prompt: 'A futuristic city at night',
99
- model: 'gemini-3-pro-image-preview',
100
- size: '2048x2048'
101
- });
102
- ```
103
-
104
- ## Thinking Budget / Effort Level
105
-
106
- The provider maps MJ effort levels to Gemini's thinking system:
107
-
108
- | Effort Level | Gemini 2.5 (Budget) | Gemini 3+ (Level) |
109
- |-------------|---------------------|-------------------|
110
- | 1-5 (Flash only) | 0 (disabled) | MINIMAL |
111
- | 1-33 | 1024-4096 | LOW |
112
- | 34-66 | 4097-12288 | MEDIUM |
113
- | 67-100 | 12289-24576 | HIGH |
114
-
115
- ## Supported Parameters
116
-
117
- | Parameter | Supported | Notes |
118
- |-----------|-----------|-------|
119
- | temperature | Yes | Default 0.5 |
120
- | topP | Yes | Nucleus sampling |
121
- | topK | Yes | Top-K sampling |
122
- | seed | Yes | Deterministic outputs |
123
- | stopSequences | Yes | Custom stop sequences |
124
- | effortLevel | Yes | Maps to thinking budget/level |
125
- | responseFormat | Yes | JSON and text modes |
126
- | streaming | Yes | Real-time streaming |
127
- | frequencyPenalty | No | Not supported by Gemini |
128
- | presencePenalty | No | Not supported by Gemini |
129
- | minP | No | Not supported by Gemini |
130
-
131
- ## Class Registration
132
-
133
- - `GeminiLLM` -- Registered via `@RegisterClass(BaseLLM, 'GeminiLLM')`
134
- - `GeminiImageGenerator` -- Registered via `@RegisterClass(BaseImageGenerator, 'GeminiImageGenerator')`
135
-
136
- ## Dependencies
137
-
138
- - `@memberjunction/ai` - Core AI abstractions
139
- - `@memberjunction/global` - Class registration
140
- - `@google/genai` - Google GenAI SDK