Skip to content

Conversation

@ra-jeev
Copy link
Contributor

@ra-jeev ra-jeev commented Aug 30, 2024

Utility composable for handling Workers AI LLM responses from api endpoints.

Supports streaming/non-streaming responses from a single generator function.

Typical usage:

const response = useAIChat('/api/chat', model, params)();

for await (const chunk of response) {
  // Do something with the response chunks
  // Single chunk for non-streaming case      
}

@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 30, 2024

commit: fc83b41

pnpm add https://pkg.pr.new/nuxt-hub/core/@nuxthub/core@250

Open in Stackblitz

@ra-jeev ra-jeev marked this pull request as ready for review August 30, 2024 15:36
@ra-jeev
Copy link
Contributor Author

ra-jeev commented Aug 30, 2024

@atinux please review the new composable. Instead of having two separate functions for streaming/non-streaming cases, merged into one.

Have also changed the playground AI UI & api endpoint little bit to test the composable.

Thanks,
Rajeev

@atinux atinux changed the title useAIChat composable for LLM responses docs: document useChat() from Vercel AI SDK Aug 31, 2024
@atinux atinux merged commit cca4c4b into nuxt-hub:main Aug 31, 2024
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