@memberjunction/ai-blackforestlabs 4.0.0 → 4.2.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/README.md +107 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,107 @@
1
+ # @memberjunction/ai-blackforestlabs
2
+
3
+ MemberJunction AI provider for Black Forest Labs' FLUX image generation models. This package implements the `BaseImageGenerator` interface to provide text-to-image generation, image editing (inpainting/outpainting), and image variations through BFL's async task-based API.
4
+
5
+ ## Architecture
6
+
7
+ ```mermaid
8
+ graph TD
9
+ A["FLUXImageGenerator<br/>(Provider)"] -->|extends| B["BaseImageGenerator<br/>(@memberjunction/ai)"]
10
+ A -->|submits tasks| C["BFL REST API"]
11
+ A -->|polls| D["Result Endpoint"]
12
+ D -->|returns| E["Image URL"]
13
+ A -->|downloads| F["Generated Image"]
14
+ B -->|registered via| G["@RegisterClass"]
15
+
16
+ style A fill:#7c5295,stroke:#563a6b,color:#fff
17
+ style B fill:#2d6a9f,stroke:#1a4971,color:#fff
18
+ style C fill:#2d8659,stroke:#1a5c3a,color:#fff
19
+ style D fill:#2d8659,stroke:#1a5c3a,color:#fff
20
+ style E fill:#b8762f,stroke:#8a5722,color:#fff
21
+ style F fill:#2d6a9f,stroke:#1a4971,color:#fff
22
+ style G fill:#b8762f,stroke:#8a5722,color:#fff
23
+ ```
24
+
25
+ ## Async Task Flow
26
+
27
+ ```mermaid
28
+ sequenceDiagram
29
+ participant App as Application
30
+ participant FLUX as FLUXImageGenerator
31
+ participant BFL as BFL API
32
+
33
+ App->>FLUX: GenerateImage(params)
34
+ FLUX->>BFL: POST /flux-pro-2 (submit task)
35
+ BFL-->>FLUX: { id: "task-123" }
36
+ loop Poll until ready
37
+ FLUX->>BFL: GET /get_result?id=task-123
38
+ BFL-->>FLUX: { status: "Pending" }
39
+ end
40
+ BFL-->>FLUX: { status: "Ready", result: { sample: "url" } }
41
+ FLUX->>BFL: Download image from URL
42
+ BFL-->>FLUX: Image data
43
+ FLUX-->>App: ImageGenerationResult
44
+ ```
45
+
46
+ ## Features
47
+
48
+ - **Text-to-Image Generation**: Generate photorealistic images using FLUX.2 Pro, FLUX 1.1 Pro, and other FLUX models
49
+ - **Image Editing**: Inpainting and outpainting via FLUX Fill model with mask support
50
+ - **Image Variations**: Create variations using FLUX Kontext Pro for image-to-image generation
51
+ - **Async Task Polling**: Configurable polling with adjustable interval and timeout
52
+ - **Multiple Models**: Support for FLUX.2 Pro (32B), FLUX 1.1 Pro, FLUX Dev, FLUX Schnell, and FLUX Ultra
53
+ - **Seed Reproducibility**: Deterministic generation with seed parameter support
54
+ - **Resolution Control**: Custom width/height and aspect ratio settings up to 4MP
55
+
56
+ ## Installation
57
+
58
+ ```bash
59
+ npm install @memberjunction/ai-blackforestlabs
60
+ ```
61
+
62
+ ## Usage
63
+
64
+ ```typescript
65
+ import { FLUXImageGenerator } from '@memberjunction/ai-blackforestlabs';
66
+
67
+ const generator = new FLUXImageGenerator('your-bfl-api-key');
68
+
69
+ const result = await generator.GenerateImage({
70
+ prompt: 'A serene mountain landscape at sunset',
71
+ model: 'flux-2-pro',
72
+ size: '1536x1024'
73
+ });
74
+
75
+ if (result.success) {
76
+ const image = result.images[0];
77
+ console.log('Image generated, base64 length:', image.base64.length);
78
+ }
79
+ ```
80
+
81
+ ### Configure Polling
82
+
83
+ ```typescript
84
+ generator.setPollingConfig({
85
+ maxWaitTime: 180000, // 3 minutes
86
+ pollInterval: 3000 // 3 seconds
87
+ });
88
+ ```
89
+
90
+ ## Supported Models
91
+
92
+ | Model | ID | Description |
93
+ |-------|-----|-------------|
94
+ | FLUX.2 Pro | `flux-2-pro` | 32B parameter, photorealistic 4MP images |
95
+ | FLUX 1.1 Pro | `flux-1.1-pro` | Production-ready, high-volume workloads |
96
+ | FLUX.1 Dev | `flux-dev` | Open-weights 12B for development |
97
+ | FLUX Schnell | `flux-schnell` | Fast generation |
98
+ | FLUX Ultra | `flux-ultra` | Ultra-high quality |
99
+
100
+ ## Class Registration
101
+
102
+ Registered as `FLUXImageGenerator` via `@RegisterClass(BaseImageGenerator, 'FLUXImageGenerator')`.
103
+
104
+ ## Dependencies
105
+
106
+ - `@memberjunction/ai` - Core AI abstractions (BaseImageGenerator, GeneratedImage)
107
+ - `@memberjunction/global` - Class registration
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/ai-blackforestlabs",
3
3
  "type": "module",
4
- "version": "4.0.0",
4
+ "version": "4.2.0",
5
5
  "description": "MemberJunction Wrapper for Black Forest Labs FLUX Image Generation 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.0.0",
24
- "@memberjunction/global": "4.0.0"
23
+ "@memberjunction/ai": "4.2.0",
24
+ "@memberjunction/global": "4.2.0"
25
25
  },
26
26
  "repository": {
27
27
  "type": "git",