Skip to content

Commit

Permalink
chore: made flows array required on startFlowServer (#1241)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelgj authored Nov 11, 2024
1 parent f1486da commit ff15108
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions js/core/src/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<any, any> | StreamableFlow<any, any>)[];
/** List of flows to expose via the flow server. */
flows: (CallableFlow<any, any> | StreamableFlow<any, any>)[];
/** 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. */
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 3 additions & 1 deletion js/doc-snippets/src/flows/express.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export const menuSuggestionFlow = ai.defineFlow(
}
);

ai.startFlowServer();
ai.startFlowServer({
flows: [menuSuggestionFlow],
});
// [END ex01]

// [START ex02]
Expand Down
2 changes: 1 addition & 1 deletion js/genkit/src/genkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions js/testapps/flow-sample1/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,5 +200,3 @@ function generateString(length: number) {
}
return str.substring(0, length);
}

ai.startFlowServer();

0 comments on commit ff15108

Please sign in to comment.