Skip to content

Add Vercel AI SDK cookbook (closes #257) - #373

Merged
HarshaNalluru merged 16 commits into
usemoss:mainfrom
SiddhantSwan12:feat/vercel-ai-sdk-cookbook
Jul 15, 2026
Merged

Add Vercel AI SDK cookbook (closes #257)#373
HarshaNalluru merged 16 commits into
usemoss:mainfrom
SiddhantSwan12:feat/vercel-ai-sdk-cookbook

Conversation

@SiddhantSwan12

Copy link
Copy Markdown
Contributor

Closes #257
Adds a new cookbook at examples/cookbook/vercel-ai-sdk/ showing how to use @moss-tools/vercel-sdk with the Vercel AI SDK, following the same layout as the existing examples/cookbook/langchain/ cookbook.

What's included

  • moss_vercel.ts - a small CLI example that prebinds mossSearchTool to an index and answers questions with generateText, with an optional streamText mode
    • package.json - minimal dependencies (@moss-tools/vercel-sdk, @moss-dev/moss, ai, @ai-sdk/openai, zod, dotenv)
    • .env.example - placeholder environment variables, no real credentials
    • README.md - setup and usage instructions

Testing

This is a documentation/example addition. Verified the example code against the published @moss-tools/vercel-sdk API (mossSearchTool({ client, indexName })) as documented in packages/vercel-sdk.

This file defines the project metadata, dependencies, and scripts for the Vercel AI SDK example.
Added a README for the Vercel AI SDK Cookbook demonstrating how to integrate Moss semantic search.
@CLAassistant

CLAassistant commented Jul 13, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds a new TypeScript cookbook under examples/cookbook/vercel-ai-sdk/ demonstrating how to use the repo’s @moss-tools/vercel-sdk tools with the Vercel AI SDK (generateText / streamText), and updates the root README to reference it.

Changes:

  • Add a new vercel-ai-sdk cookbook with a seeding script, CLI Q&A script, and environment template.
  • Document setup and usage in a new cookbook README.
  • Update the root README integration link + examples tree to include the new cookbook.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
README.md Adds the cookbook to the examples tree + points the Vercel AI SDK integration link to the new cookbook.
examples/cookbook/vercel-ai-sdk/README.md New cookbook documentation (currently has Markdown rendering issues per comments).
examples/cookbook/vercel-ai-sdk/package.json Defines minimal dependencies and seed/start scripts for the cookbook.
examples/cookbook/vercel-ai-sdk/.env.example Example env vars for Moss + OpenAI configuration.
examples/cookbook/vercel-ai-sdk/seed_data.ts Provides small sample documents for end-to-end seeding.
examples/cookbook/vercel-ai-sdk/create_index.ts Seeds an index (needs to delete existing index first to be rerunnable).
examples/cookbook/vercel-ai-sdk/moss_vercel.ts CLI example that wires mossSearchTool into generateText/streamText (needs formatting fixes).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread examples/cookbook/vercel-ai-sdk/seed_data.ts Outdated
Comment thread examples/cookbook/vercel-ai-sdk/create_index.ts
Comment thread examples/cookbook/vercel-ai-sdk/moss_vercel.ts
Comment thread examples/cookbook/vercel-ai-sdk/moss_vercel.ts
Comment thread examples/cookbook/vercel-ai-sdk/moss_vercel.ts
Comment thread examples/cookbook/vercel-ai-sdk/README.md Outdated
Comment thread examples/cookbook/vercel-ai-sdk/README.md Outdated
Comment thread examples/cookbook/vercel-ai-sdk/README.md Outdated
Comment thread examples/cookbook/vercel-ai-sdk/README.md Outdated
Comment thread README.md Outdated
SiddhantSwan12 and others added 5 commits July 14, 2026 00:22
…potency

Applies all 10 suggested fixes from the Copilot code review:
- Fix indentation in moss_vercel.ts, create_index.ts, and seed_data.ts
- Make create_index.ts idempotent by deleting an existing index before recreating it
- Fix broken Markdown list nesting in the cookbook README
- Fix cookbook tree indentation in the root README

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Removed the local requireEnv function and imported it from utils.js.
The previously pinned ^1.0.0 was stale and incompatible with ai ^7.0.0. Verified on npm that @ai-sdk/openai 4.0.11 (latest) is the version aligned with the ai v7 major.
@Sravan1011

Copy link
Copy Markdown
Contributor

@HarshaNalluru go ahead with the merge, I have reviewed it

@HarshaNalluru
HarshaNalluru merged commit 7246804 into usemoss:main Jul 15, 2026
17 checks passed
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.

[Feature]: Vercel AI SDK Cookbook

5 participants