@ragpipe/plugin-gemini 0.0.1 → 0.1.0-alpha.1

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 +68 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,68 @@
1
+ # @ragpipe/plugin-gemini
2
+
3
+ Google Gemini embedding and generation plugin for [ragpipe](https://github.com/yungblud/ragpipe).
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ pnpm add ragpipe @ragpipe/plugin-gemini
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```ts
14
+ import { defineConfig } from "ragpipe";
15
+ import { geminiEmbedding, geminiGeneration } from "@ragpipe/plugin-gemini";
16
+
17
+ export default defineConfig({
18
+ embedding: geminiEmbedding({
19
+ apiKey: process.env.GEMINI_API_KEY ?? "",
20
+ model: "gemini-embedding-001", // default
21
+ }),
22
+ generation: geminiGeneration({
23
+ apiKey: process.env.GEMINI_API_KEY ?? "",
24
+ model: "gemini-2.5-flash", // default
25
+ systemPrompt: "Answer based on the provided context.",
26
+ }),
27
+ // ... vectorStore
28
+ });
29
+ ```
30
+
31
+ ## API
32
+
33
+ ### `geminiEmbedding(options)`
34
+
35
+ Returns an `EmbeddingPlugin` that calls the Gemini Embedding API.
36
+
37
+ | Option | Type | Default | Description |
38
+ |---|---|---|---|
39
+ | `apiKey` | `string` | — | Google AI API key (required) |
40
+ | `model` | `string` | `"gemini-embedding-001"` | Embedding model name |
41
+
42
+ - **Dimensions**: 3072
43
+ - **Rate limit**: 800ms between calls (built-in)
44
+ - **Batch support**: `embedMany()` uses `batchEmbedContents` for efficient bulk embedding
45
+
46
+ ### `geminiGeneration(options)`
47
+
48
+ Returns a `GenerationPlugin` that calls the Gemini Content Generation API.
49
+
50
+ | Option | Type | Default | Description |
51
+ |---|---|---|---|
52
+ | `apiKey` | `string` | — | Google AI API key (required) |
53
+ | `model` | `string` | `"gemini-2.5-flash"` | Generation model name |
54
+ | `systemPrompt` | `string` | `"Answer based on the provided context."` | Default system instruction |
55
+
56
+ - **Streaming**: `generateStream()` returns an `AsyncIterable<string>` via SSE
57
+ - **History**: Pass `{ history }` to include conversation context
58
+ - **Per-call override**: Pass `{ systemPrompt }` at call time to override the default
59
+
60
+ ## Get an API Key
61
+
62
+ 1. Go to [Google AI Studio](https://makersuite.google.com/app/apikey)
63
+ 2. Create an API key
64
+ 3. Set it as `GEMINI_API_KEY` in your environment
65
+
66
+ ## License
67
+
68
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ragpipe/plugin-gemini",
3
- "version": "0.0.1",
3
+ "version": "0.1.0-alpha.1",
4
4
  "description": "Gemini embedding and generation plugin for ragpipe",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "main": "./dist/index.cjs",
31
31
  "module": "./dist/index.js",
32
32
  "types": "./dist/index.d.ts",
33
- "files": ["dist"],
33
+ "files": ["dist", "README.md"],
34
34
  "scripts": {
35
35
  "build": "tsup",
36
36
  "dev": "tsup --watch",