Changelog
Recent Updates (October 2025)
Vercel AI SDK Support Added
Vercel AI SDK now fully supported! You can now use Captain with Vercel AI SDK in two ways:
-
Context Parsing Method (New): Embed context directly in user messages
-
Standard Method (Recommended): Use OpenAI SDK with
extra_body
See Vercel AI SDK Guide for complete documentation.
Bug Fixes & Improvements
✅ Fixed: DirectReducer systemPrompt Error
- Issue: Requests with small context (<40k tokens) were failing with
JSONPath '$.initOutput.systemPrompt' could not be found - Fix: Added systemPrompt field to DirectReducer path in infinite-input Lambda
- Impact: Vercel AI SDK and small context requests now work correctly
✅ Fixed: Large Context systemPrompt Error
- Issue: Requests with large context (>40k tokens requiring chunking) had missing systemPrompt
- Fix: Added systemPrompt field to chunked/large context path
- Impact: All large context requests now include proper system instructions
✅ Fixed: Tool Calling with Empty Context
- Issue: Tool calling requests with empty
input_textfield were rejected - Fix: Updated input validation to accept
input_text !== undefinedinstead of truthy check - Impact: Tool calling now works with or without context
✅ Fixed: Infinite Input Mode Detection
- Issue: Requests with
input_text=""(empty string) weren't detected as infinite input mode - Fix: Changed detection from
!!event.input_texttoevent.input_text !== undefined - Impact: Tool calling and empty context requests now route correctly
Working Features (Verified)
All client implementations confirmed working:
- ✅ Vercel AI SDK - Context parsing method
- ✅ OpenAI Python SDK - Standard and file upload
- ✅ OpenAI JavaScript SDK - Standard method
- ✅ Tool Calling - All modes (with/without context)
- ✅ Large Context - Multi-million token processing
- ✅ Streaming - Real-time responses
- ✅ File Upload - S3-based large file handling
Known Issues
Streaming Connection Stability
- Issue: Some tool calling requests with streaming may experience premature connection closure
- Status: Backend processing completes successfully, client may see connection error
- Workaround: Use
stream=Falsefor tool calling if experiencing issues - Impact: Low - functionality works, only affects streaming UX
Migration Guide
If you're using Vercel AI SDK
Before:
After (Option 1 - Context Parsing):
After (Option 2 - Recommended):
// Use OpenAI SDK instead
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.runcaptain.com/v1',
//...
});
// Use extra_body parameter
extra_body: {
captain: { context: yourContext }
}
If you're using Tool Calling
No changes needed - tool calling now works with or without context:
# Works with context
response = client.chat.completions.create(
model="captain-voyager-latest",
messages=[...],
tools=tools,
extra_body={"captain": {"context": "Your context"}}
)
# Works without context
response = client.chat.completions.create(
model="captain-voyager-latest",
messages=[...],
tools=tools
)
Technical Details
Architecture Changes
- infinite-input Lambda (
index.ts) - Line 255: Changed input validation to
event.input_text !== undefined - Line 304: Added
systemPromptto DirectReducer return - Line 372: Added
systemPromptto large context return -
Line 400: Enhanced infinite input mode detection
-
API Endpoint (
chat_completions.py) - Lines 425-458: Added context parsing from user messages
-
Format:
context: <text>, query: <question> -
Documentation
- Updated Vercel AI SDK guide with context parsing
- Added working examples for all SDKs
- Updated comparison tables
Testing Performed
- ✅ Small context (<40k tokens) - Vercel AI SDK
- ✅ Large context (>40k tokens) - File upload
- ✅ Tool calling with context
- ✅ Tool calling without context
- ✅ Streaming responses
- ✅ Custom system prompts
- ✅ Multi-language support
Next Steps
Check out these guides to get started:
- Vercel AI SDK Guide - JavaScript/TypeScript integration
- Getting Started - Python and JavaScript SDKs
- Tool Calling - Function calling guide
- API Reference - Complete API documentation
Support
Found an issue? Have questions?
- Documentation: docs.runcaptain.com
- Email: support@runcaptain.com
- GitHub: github.com/runcaptain/captain