Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(js/flows): made flow be actually actions, actions can stream, moved flow server to express plugin #1569

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pavelgj
Copy link
Collaborator

@pavelgj pavelgj commented Dec 21, 2024

Removed all express stuff from flows core. Flows are just simple actions now. Actions have the flow interface (including streaming).

Removed auth policy from flows. The policy is now a plugin feature. startFlowServer also moved to the express plugin.

import { startFlowServer, withAuth } from '@genkit-ai/express';

startFlowServer({
  flows: [
    simpleFlow,
    withAuth(flowThatNeedsAuth, authProvider, ({ auth, action, input, request }) => {
      if (!auth) {
        throw new Error('Authorization required.');
      }
    })
  ],
});

run is now ai.run.

Checklist (if applicable):

@pavelgj pavelgj changed the title refactor: made flow be actually actions, actions can stream, moved flow server to express plugin refactor(js/flows): made flow be actually actions, actions can stream, moved flow server to express plugin Dec 21, 2024
@chrisraygill
Copy link
Contributor

Remind me, what's the use case for startFlowServer since we introduced the Express handler?

@pavelgj
Copy link
Collaborator Author

pavelgj commented Dec 22, 2024

Remind me, what's the use case for startFlowServer since we introduced the Express handler?

It much less boilerplate for simple cases. And we have existing users.... I don't want to break them. So I'm moving it rather than removing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants