genkit icon indicating copy to clipboard operation
genkit copied to clipboard

[Docs] explain how to pass context to runFlow and streamFlow

Open markgoho opened this issue 7 months ago • 0 comments

Is your report related to a problem? Please describe. How do we pass context to runFlow?

Is your report related to a suggestion/improvement? Please describe. The /genkit/context page shows how to add context when calling a flow directly, e.g.

const summarizeHistory = ai.defineFlow(/* ... */);

const summary = await summarizeHistory(friend.uid, {context: {auth: currentUser}});

but when calling this from the front end, e.g.

// Angular component class
menuResource = resource({
  request: () => this.theme(),
  // where does the context go?
  loader: ({ request }) => runFlow<string>({ url: 'menu', input: request }),
});

Additional context FYI, the word context in the template here makes it very difficult for issues pertaining to context

markgoho avatar Apr 06 '25 22:04 markgoho