diff --git a/js/core/src/flow.ts b/js/core/src/flow.ts index ce2c4dd1a..52e09bf4e 100644 --- a/js/core/src/flow.ts +++ b/js/core/src/flow.ts @@ -428,8 +428,8 @@ export class Flow< * Options to configure the flow server. */ export interface FlowServerOptions { - /** List of flows to expose via the flow server. If not specified, all registered flows will be exposed. */ - flows?: (CallableFlow | StreamableFlow)[]; + /** List of flows to expose via the flow server. */ + flows: (CallableFlow | StreamableFlow)[]; /** Port to run the server on. In `dev` environment, actual port may be different if chosen port is occupied. Defaults to 3400. */ port?: number; /** CORS options for the server. */ @@ -458,7 +458,7 @@ export class FlowServer { /** Express server instance. Null if server is not running. */ private server: Server | null = null; - constructor(registry: Registry, options?: FlowServerOptions) { + constructor(registry: Registry, options: FlowServerOptions) { this.registry = registry; this.options = { port: 3400, diff --git a/js/doc-snippets/src/flows/express.ts b/js/doc-snippets/src/flows/express.ts index 9b226ede3..b02e2c924 100644 --- a/js/doc-snippets/src/flows/express.ts +++ b/js/doc-snippets/src/flows/express.ts @@ -28,7 +28,9 @@ export const menuSuggestionFlow = ai.defineFlow( } ); -ai.startFlowServer(); +ai.startFlowServer({ + flows: [menuSuggestionFlow], +}); // [END ex01] // [START ex02] diff --git a/js/genkit/src/genkit.ts b/js/genkit/src/genkit.ts index ef4ea92d6..2debb8997 100644 --- a/js/genkit/src/genkit.ts +++ b/js/genkit/src/genkit.ts @@ -1040,7 +1040,7 @@ export class Genkit { } } - startFlowServer(options?: FlowServerOptions): FlowServer { + startFlowServer(options: FlowServerOptions): FlowServer { const flowServer = new FlowServer(this.registry, options); flowServer.start(); return flowServer; diff --git a/js/testapps/flow-sample1/src/index.ts b/js/testapps/flow-sample1/src/index.ts index 4fb2bfced..045bb224b 100644 --- a/js/testapps/flow-sample1/src/index.ts +++ b/js/testapps/flow-sample1/src/index.ts @@ -200,5 +200,3 @@ function generateString(length: number) { } return str.substring(0, length); } - -ai.startFlowServer();