MCPcopy Create free account
hub / github.com/TanStack/ai / createGenerationContext

Function createGenerationContext

packages/ai/src/activities/middleware/run.ts:16–34  ·  view source on GitHub ↗
(args: {
  requestId: string
  activity: GenerationMiddlewareContext['activity']
  provider: string
  model: string
  modelOptions?: unknown
  createId: (prefix: string) => string
})

Source from the content-addressed store, hash-verified

14 * so `source` is fixed to `'server'` and `context` to `undefined`.
15 */
16export function createGenerationContext(args: {
17 requestId: string
18 activity: GenerationMiddlewareContext['activity']
19 provider: string
20 model: string
21 modelOptions?: unknown
22 createId: (prefix: string) => string
23}): GenerationMiddlewareContext {
24 return {
25 requestId: args.requestId,
26 activity: args.activity,
27 provider: args.provider,
28 model: args.model,
29 modelOptions: args.modelOptions,
30 source: 'server',
31 createId: args.createId,
32 context: undefined,
33 }
34}
35
36/**
37 * Run a single lifecycle hook across each middleware in registration order,

Callers 6

runGenerateTranscriptionFunction · 0.90
runGenerateAudioFunction · 0.90
runGenerateImageFunction · 0.90
runCreateVideoJobFunction · 0.90
runGenerateSpeechFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected