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

Update StreamUI documentation for advanced use cases (Agentic workflow) #2421

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

derekyhsieh
Copy link

@derekyhsieh derekyhsieh commented Jul 25, 2024

Add advanced use case for nesting streamUI functions within toolcalls for streaming text for long running tool-calls (code generation) that require constant UI updates via text streaming

@derekyhsieh derekyhsieh changed the title Stream UI advanced Update StreamUI documentation for advanced use cases Jul 25, 2024
@derekyhsieh derekyhsieh changed the title Update StreamUI documentation for advanced use cases Update StreamUI documentation for advanced use cases (Agentic workflow) Jul 25, 2024
Comment on lines +219 to +237
generate: async function* ({ specifications }) {
yield <LoadingComponent message="Generating dashboard..." />;

const dashboardResult = await streamUI({
model: openai('gpt-4'),
prompt: `Create a dashboard with the following specifications: ${specifications}`,
text: ({ content, done, delta }) => {
// Handle streaming text updates here
return <DashboardGenerationProgress content={content} />;
},
tools: {
// Additional tools for dashboard generation can be defined here
}
});

return <DashboardComponent>{dashboardResult.value}</DashboardComponent>;
},
},
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit torn about this pattern and whether we want to promote it, since it leads to complications with creating a consistent chat history, especially with parallel tool calling.

I plan to revisit this once I'm done with the streamUI refactoring.

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

Successfully merging this pull request may close these issues.

2 participants