-
Notifications
You must be signed in to change notification settings - Fork 0
feat(llm-sdk): add runtime.generate() for non-streaming responses #22
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…mponents
- Add BackButton compound component (auto-connected to context)
- Add ThreadPicker compound wrapper (auto-connected, renders only with persistence)
- Add ChevronLeftIcon to icons
- ChatView now supports Header/Footer children for view-specific layouts
- Memoize context value to prevent unnecessary re-renders
- Add accessibility props (aria-label, disabled override) to BackButton
Usage:
<CopilotChat.ChatView>
<CopilotChat.Header>
<CopilotChat.BackButton />
<CopilotChat.ThreadPicker />
</CopilotChat.Header>
</CopilotChat.ChatView>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add Compound Components section to chat.mdx with examples for Root, HomeView, ChatView, Header, Footer, Input, Suggestions, BackButton, and ThreadPicker components - Document view-specific headers pattern - Add useCopilotChatContext hook documentation - Add new semantic CSS classes to customizations.mdx Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Expand SDK response formats to include JSON (Non-Streaming) for batch processing and simpler integrations. - Update documentation with new examples for using `generateText()` and `runtime.chat()` methods. - Clarify when to use non-streaming responses, including use cases for logging and analytics. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Allows passing custom headers with each request to the runtime endpoint. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add a clean non-streaming API similar to Vercel AI SDK's generateText().
## New API
```typescript
const result = await runtime.generate(body);
// Raw access
result.text // Generated text
result.messages // All messages
result.toolCalls // Tool calls
result.success // Boolean
// CopilotChat format
result.toResponse() // { success, content, messages, ... }
```
## Changes
- Add `GenerateResult` class with `toResponse()` method
- Add `runtime.generate()` method to Runtime class
- Add `GenerateOptions` type for options (signal, httpRequest, onFinish)
- Update Express demo with `/api/chat/generate` endpoints
- Update NextJS demo with generate route
- Update create-ai-copilot templates with generate examples
- Update documentation
## API Comparison
| Mode | Raw Format | CopilotChat Format |
|------|------------|-------------------|
| Streaming | `stream().collect()` | `stream().toResponse()` |
| Non-streaming | `generate().text` | `generate().toResponse()` |
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Rohitjoshi9023
approved these changes
Jan 27, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
runtime.generate()method for clean non-streaming API (similar to Vercel AI SDK'sgenerateText())GenerateResultclass withtoResponse()for CopilotChat-compatible formatNew API
API Comparison
stream().collect()stream().toResponse()generate().textgenerate().toResponse()Usage Examples
Next.js:
Express:
Test plan
/api/chat/generateendpoint🤖 Generated with Claude Code