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

[JS] Simplify syntax to call flows #391

Closed
chrisraygill opened this issue Jun 12, 2024 · 0 comments · Fixed by #795
Closed

[JS] Simplify syntax to call flows #391

chrisraygill opened this issue Jun 12, 2024 · 0 comments · Fixed by #795
Assignees
Labels
feature New feature or request js
Milestone

Comments

@chrisraygill
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Current syntax to call flows does not feel ergonomic const response = await runFlow(menuSuggestionFlow, "French");. Flows are just special functions, so I want them to be able to call them more like regular functions.

Describe the solution you'd like

const myFlow = defineFlow() -> await myFlow()
const myFlow = defineStreamingFlow() -> const {stream, result} = await myFlow()

Being able to call flows like normal functions is a huge ergonomic win - it's qualitatively different than the alternatives because you get all the observability benefits but you use it like you just defined a normal function.

Describe alternatives you've considered

Some alternative ideas

Alternate 1

myFlow.run(...)
myFlow.stream(...)

Alternate 2

myFlow(...)
myFlow.stream(...)

Alternate 3

myFlow().run()
myFlow().runWithStreaming()

Additional context

N/A

@chrisraygill chrisraygill added feature New feature or request js labels Jun 12, 2024
@chrisraygill chrisraygill changed the title [JS] Simplify syntax call flows [JS] Simplify syntax to call flows Jun 12, 2024
@chrisraygill chrisraygill moved this to Needs Triage in Genkit Backlog Jul 18, 2024
@chrisraygill chrisraygill removed the status in Genkit Backlog Jul 18, 2024
@chrisraygill chrisraygill moved this to Discuss in Genkit Backlog Jul 19, 2024
@i14h i14h added this to the js-0.6.0 milestone Aug 12, 2024
@apascal07 apascal07 assigned apascal07 and unassigned pavelgj Aug 15, 2024
@apascal07 apascal07 moved this from Discuss to In Progress in Genkit Backlog Aug 26, 2024
@apascal07 apascal07 moved this from In Progress to Done in Genkit Backlog Sep 9, 2024
@apascal07 apascal07 closed this as completed by moving to Done in Genkit Backlog Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request js
Projects
Status: Done
4 participants