feat: 0.3.0 add Vercel AI SDK adapter, streaming, hybrid fix, polish - #2
Merged
Conversation
Builds on 0.2.0's adapter foundation. Three production gaps closed
and one quality polish pass.
- src/adapters/ai-sdk.ts: new ctx-opt/ai-sdk entry point. withOptimizer(fn,
config) wraps any AI SDK function (generateText, streamText,
generateObject, streamObject). trimMessages(messages, config) for the
pre-process pattern. ai is an optional peer dep.
- Streaming: stream: true on chat.completions.create / messages.create
now correctly forwards the SDK's async-iterable stream after running
optimization. The Anthropic adapter also wraps client.messages.stream().
- src/strategies/{relevance,summarizer}.ts: support per-strategy
recentWindow override. This unblocks the hybrid pipeline: setting
relevance.recentWindow larger than summarizer.recentWindow gives the
summarizer real compressible material. The known-limitation note from
0.2.0 is resolved with a test that asserts llmCall fires.
- src/anthropic-tokens.ts: countMessageTokensWithAnthropic helper that
delegates to client.messages.countTokens for exact counts on claude-*
models. Replaces the README's "roll your own wrapper" note.
- .github/ISSUE_TEMPLATE/*.yml, PULL_REQUEST_TEMPLATE.md, CONTRIBUTING.md
for repo polish.
- 21 → 52 → 68 tests across three releases. Typecheck, build, and all
68 tests green.
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
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.
Builds on 0.2.0's adapter foundation. Three production gaps closed and one quality polish pass.