-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.ts
More file actions
54 lines (51 loc) · 1.94 KB
/
config.ts
File metadata and controls
54 lines (51 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { devLocalVectorstore } from '@genkit-ai/dev-local-vectorstore';
import { googleAI } from '@genkit-ai/google-genai';
import { genkit } from 'genkit';
import { version } from 'os';
import { Readable } from 'stream';
// Initialize Genkit with the Google AI plugin
export const ai = genkit({
// Ensure Dotprompt prompts in `src/prompts` are discovered at runtime
promptDir: './src/prompts',
plugins: [
googleAI({ experimental_debugTraces: true }),
devLocalVectorstore([
{
indexName: process.env.VECTORSTORE_INDEX ?? 'Based',
embedder: googleAI.embedder('gemini-embedding-001'),
},
]),
],
model: googleAI.model('gemini-2.5-flash', {
temperature: 0.8,
maxOutputTokens: 65000,
topK: 40,
topP: 0.95,
stopSequences: ['\n\n'],
codeExecution: true,
contextCache: true,
functionCallingConfig: { mode: 'AUTO' },
googleSearchRetrieval: true,
groundedGeneration: true,
toolConfig: { default: { mode: 'AUTO', allowParallelCalls: true } },
structuredOutput: { enabled: true },
stream: true,
output: { format: 'json' },
safetySettings: [],
thinkingConfig: { thinkingBudget: -1, showThoughts: true }, // Enable thinking process for debugging
mediaResolution: 'MEDIA_RESOLUTION_LOW',
responseMimeType: 'application/json',
imageGenerationConfig: { maxImages: 1, imageSize: 'IMAGE_SIZE_512' },
responseMedia: ['TEXT', 'IMAGE'],
entityExtractionConfig: { enabled: true, modelVersion: 'ENTITY_EXTRACTION_MODEL_VERSION_V1' },
config: {
tools: [{ googleSearch: {} }],
},
}),
});
export { z } from 'genkit';
// Export the configured index name so flows can reference it explicitly
export const VECTORSTORE_INDEX = process.env.VECTORSTORE_INDEX ?? 'Based';
// Context provider notes (see docs/runbook-context.md):
// - Provide `context.auth` with { uid, rawToken } when available
// - Attach `trace.requestId` to correlate traces across agents and flows