Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: vercel/ai
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ai@3.0.5
Choose a base ref
...
head repository: vercel/ai
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ai@3.0.6
Choose a head ref
  • 9 commits
  • 32 files changed
  • 7 contributors

Commits on Mar 5, 2024

  1. Add check-docs-links script for discovering broken doc links (#1085)

    conroywhitney authored Mar 5, 2024
    Copy the full SHA
    9595a99 View commit details
  2. fix: Streamable UI .append() missing the initial node (#1099)

    shuding authored Mar 5, 2024
    Copy the full SHA
    08a5308 View commit details
  3. Add warning when streamables are not closed for a while during develo…

    …pment (#1105)
    
    Co-authored-by: Max Leiter <max.leiter@vercel.com>
    shuding and MaxLeiter authored Mar 5, 2024
    Copy the full SHA
    9348f06 View commit details

Commits on Mar 6, 2024

  1. Upgrade to latest Next.js for AI RSC demo (#1109)

    shuding authored Mar 6, 2024
    Copy the full SHA
    f159bc1 View commit details
  2. Fixed mismatched function name in demo (#1116)

    changesbyjames authored Mar 6, 2024
    Copy the full SHA
    bb94b2b View commit details
  3. Parse tool call arguments for onToolCall callback. (#1113)

    lgrammel authored Mar 6, 2024
    Copy the full SHA
    f6ae717 View commit details
  4. Add changeset for onToolCall change. (#1117)

    lgrammel authored Mar 6, 2024
    Copy the full SHA
    1355ad0 View commit details
  5. fix: Fix type resolution when moduleResolution is set to node (#1118

    )
    shuding authored Mar 6, 2024
    Copy the full SHA
    8be9404 View commit details
  6. Version Packages (#1107)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Mar 6, 2024
    Copy the full SHA
    fed61dd View commit details
118 changes: 118 additions & 0 deletions check-docs-links.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
const fs = require('fs').promises;
const path = require('path');
const glob = require('glob');
let chalk;

// For the times when we know that we shouldn't resolve something
// e.g., the `/prompt` page is a relative link, but is not in the docs
const knownBrokenLinks = [
{ from: '/docs/concepts/prompt-engineering.mdx', to: '/prompt' },
];

const hrefLinkRegex = /href="(.*?)"/g;
const markdownLinkRegex = /\[.*?\]\((.*?)\)/g;

const verbose = process.argv.includes('--verbose');

const hasExtension = link => path.extname(link);

const isExternalLink = link => link.startsWith('http') || link.startsWith('//');

const isKnownBrokenLink = (from, to) => {
return knownBrokenLinks.some(skip => skip.from === from && skip.to === to);
};

const resolveLink = ({ docsRoot, file, link }) => {
let resolvedLink = link;

// For absolute paths, prepend the documentation root path
// For relative paths, resolve the path from the current file
if (resolvedLink.startsWith('/')) {
resolvedLink = path.join(docsRoot, resolvedLink);
} else if (resolvedLink.startsWith('./')) {
resolvedLink = path.resolve(path.dirname(file), resolvedLink);
}

// If the resolvedLink has an anchor, only use the root
if (resolvedLink.includes('#')) {
const [linkPath, _anchor] = resolvedLink.split('#');
resolvedLink = linkPath;
}

// Add markdown extension
resolvedLink += '.mdx';

return resolvedLink;
};

const shouldSkip = (from, to) => {
return isKnownBrokenLink(from, to) || isExternalLink(to) || hasExtension(to);
};

async function checkMarkdownLinks(baseDir) {
const files = glob.sync(`${baseDir}/**/*.mdx`);
let errorCount = 0;
chalk = (await import('chalk')).default;

for (const file of files) {
const content = await fs.readFile(file, 'utf8');
const relativeFilePath = `/${path.relative(baseDir, file)}`;

const links = [];
let match;

// Gather all Markdown links
while ((match = markdownLinkRegex.exec(content)) !== null) {
links.push(match[1]); // Capture the link
}

// Gather all HTML href links
while ((match = hrefLinkRegex.exec(content)) !== null) {
links.push(match[1]); // Capture the href value
}

// Iterate over the combined list of links
for (const link of links) {
if (shouldSkip(relativeFilePath, link)) {
verbose && console.log(chalk.grey(${relativeFilePath} -> ${link}`));
continue;
}

const resolvedLink = resolveLink({ docsRoot, file, link });
const relativeLinkPath = `/${path.relative(baseDir, resolvedLink)}`;

try {
await fs.access(resolvedLink);
verbose &&
console.log(
chalk.green(
`✓ ${relativeFilePath} -> ${link} (${relativeLinkPath})`,
),
);
} catch (error) {
errorCount += 1;
console.error(
chalk.red(`✖ ${relativeFilePath} -> ${link} (${relativeLinkPath})`),
);
}
}
}

// After all links have been checked
if (errorCount > 0) {
console.error(
chalk.red(
`\n✖ ${errorCount} broken link(s) detected. Exiting with error.\n`,
),
);
process.exit(1); // Exit with a non-zero exit code to indicate error
} else {
console.log(
chalk.green('\n✓ No broken links found. Exiting successfully.\n'),
);
process.exit(0); // Exit with zero to indicate success
}
}

const docsRoot = path.resolve(__dirname, './docs/pages');
checkMarkdownLinks(docsRoot);
2 changes: 1 addition & 1 deletion docs/pages/docs/index.mdx
Original file line number Diff line number Diff line change
@@ -194,7 +194,7 @@ export function A({ href, children }) {
<IntegrationCard href="/docs/guides/providers/cohere" title="Cohere" description="Cohere is an AI platform for enterprise. The Vercel AI SDK provides a simple way to use Cohere's command models in your frontend web applications." />
<IntegrationCard href="/docs/guides/providers/anthropic" title="Anthropic" description="Anthropic is an AI research and deployment company. The Vercel AI SDK provides a simple way to use Anthropic's Claude models in your frontend web applications." />
<IntegrationCard href="/docs/guides/providers/replicate" title="Replicate" description="Replicate is an on-demand AI model hosting platform. The Vercel AI SDK provides a simple way to use Replicate models in your frontend web applications." />
<IntegrationCard href="/docs/guides/providers/hugging-face" title="Hugging Face" description="Hugging Face is a collaboration and model hosting platform for the machine learning community. The Vercel AI SDK provides a simple way to use Hugging Face models in your frontend web applications." />
<IntegrationCard href="/docs/guides/providers/huggingface" title="Hugging Face" description="Hugging Face is a collaboration and model hosting platform for the machine learning community. The Vercel AI SDK provides a simple way to use Hugging Face models in your frontend web applications." />
<IntegrationCard href="/docs/guides/providers/fireworks" title="Fireworks" description="Fireworks is a lightning-fast LLM inference platform. The Vercel AI SDK provides a simple way to use Fireworks.ai's models in your frontend web applications." />
<IntegrationCard href="/docs/guides/providers/perplexity" title="Perplexity" description="Perplexity AI is an answer engine that combines AI with web search to provide ready-made answers to user questions in natural language. The Vercel AI SDK provides a simple way to use Perplexity's models in your frontend web applications." />
<IntegrationCard href="/docs/guides/providers/inkeep" title="Inkeep" description="Inkeep's AI chat service provides answers grounded in your company's documentation, blogs, support tickets, and other sources. The Vercel AI SDK provides a simple way to use Inkeep's RAG service to build a custom support and search copilot." />
2 changes: 1 addition & 1 deletion examples/next-ai-rsc/app/action.tsx
Original file line number Diff line number Diff line change
@@ -258,7 +258,7 @@ Besides that, you can also chat with users and do some calculations if needed.`,
...aiState.get(),
{
role: 'function',
name: 'list_stocks',
name: 'get_events',
content: JSON.stringify(events),
},
]);
2 changes: 1 addition & 1 deletion examples/next-ai-rsc/package.json
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@
"d3-scale": "^4.0.2",
"date-fns": "^3.3.1",
"geist": "^1.2.2",
"next": "14.1.2-canary.4",
"next": "14.1.2",
"next-themes": "^0.2.1",
"openai": "^4.28.4",
"react": "^18",
2 changes: 1 addition & 1 deletion examples/next-anthropic/package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
},
"dependencies": {
"@anthropic-ai/sdk": "0.15.0",
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"react": "18.2.0",
"react-dom": "^18.2.0"
2 changes: 1 addition & 1 deletion examples/next-aws-bedrock/package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
},
"dependencies": {
"@aws-sdk/client-bedrock-runtime": "3.451.0",
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"react": "18.2.0",
"react-dom": "^18.2.0"
2 changes: 1 addition & 1 deletion examples/next-fireworks/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"openai": "4.16.1",
"react": "18.2.0",
2 changes: 1 addition & 1 deletion examples/next-google-generative-ai/package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
},
"dependencies": {
"@google/generative-ai": "0.1.1",
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"react": "18.2.0",
"react-dom": "^18.2.0"
2 changes: 1 addition & 1 deletion examples/next-huggingface/package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
"dependencies": {
"@huggingface/inference": "^2.5.1",
"next": "14.1.1",
"ai": "3.0.5",
"ai": "3.0.6",
"react": "18.2.0",
"react-dom": "^18.2.0"
},
2 changes: 1 addition & 1 deletion examples/next-inkeep/package.json
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
},
"dependencies": {
"@inkeep/ai-api": "^0.1.8",
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"react": "18.2.0",
"react-dom": "^18.2.0"
2 changes: 1 addition & 1 deletion examples/next-langchain/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"ai": "3.0.5",
"ai": "3.0.6",
"langchain": "^0.0.196",
"next": "14.1.1",
"react": "18.2.0",
2 changes: 1 addition & 1 deletion examples/next-mistral/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"@mistralai/mistralai": "0.1.3",
"react": "18.2.0",
2 changes: 1 addition & 1 deletion examples/next-openai-pages/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"openai": "4.16.1",
"react": "18.2.0",
2 changes: 1 addition & 1 deletion examples/next-openai-rate-limits/package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
"dependencies": {
"@upstash/ratelimit": "^0.4.3",
"@vercel/kv": "^0.2.2",
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"openai": "4.16.1",
"react": "18.2.0",
2 changes: 1 addition & 1 deletion examples/next-openai/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"openai": "4.16.1",
"react": "18.2.0",
2 changes: 1 addition & 1 deletion examples/next-perplexity/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"ai": "3.0.5",
"ai": "3.0.6",
"next": "14.1.1",
"openai": "4.16.1",
"react": "18.2.0",
2 changes: 1 addition & 1 deletion examples/nuxt-openai/package.json
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@
"@vue/runtime-core": "^3.3.4",
"@vue/runtime-dom": "^3.3.4",
"@vue/shared": "^3.3.4",
"ai": "3.0.5",
"ai": "3.0.6",
"nuxt": "^3.6.5",
"openai": "4.16.1",
"tailwindcss": "^3.3.3",
2 changes: 1 addition & 1 deletion examples/solidstart-openai/package.json
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
"dependencies": {
"@solidjs/meta": "0.29.3",
"@solidjs/router": "0.8.2",
"ai": "3.0.5",
"ai": "3.0.6",
"openai": "4.16.1",
"solid-js": "1.8.7",
"solid-start": "0.3.10",
2 changes: 1 addition & 1 deletion examples/sveltekit-openai/package.json
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
},
"dependencies": {
"openai": "4.16.1",
"ai": "3.0.5"
"ai": "3.0.6"
},
"devDependencies": {
"@fontsource/fira-mono": "^4.5.10",
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -13,7 +13,8 @@
"publint": "turbo publint",
"test": "turbo test --filter=ai...",
"ci:release": "turbo clean && turbo build --filter=ai... && changeset publish",
"ci:version": "changeset version && node .github/scripts/cleanup-examples-changesets.mjs && pnpm install --no-frozen-lockfile"
"ci:version": "changeset version && node .github/scripts/cleanup-examples-changesets.mjs && pnpm install --no-frozen-lockfile",
"check-docs-links": "node ./check-docs-links.js"
},
"lint-staged": {
"*": [
@@ -22,6 +23,7 @@
},
"devDependencies": {
"@changesets/cli": "^2.22.0",
"chalk": "^5.3.0",
"eslint": "^7.32.0",
"eslint-config-vercel-ai": "workspace:*",
"husky": "^8.0.0",
8 changes: 8 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# ai

## 3.0.6

### Patch Changes

- 1355ad0: Fix: experimental_onToolCall is called with parsed tool args
- 9348f06: ai/rsc: improve dev error and warnings by trying to detect hanging streams
- 8be9404: fix type resolution

## 3.0.5

### Patch Changes
13 changes: 3 additions & 10 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ai",
"version": "3.0.5",
"version": "3.0.6",
"license": "Apache-2.0",
"sideEffects": false,
"main": "./dist/index.js",
@@ -40,44 +40,37 @@
".": {
"types": "./dist/index.d.ts",
"import": "./dist/index.mjs",
"module": "./dist/index.mjs",
"require": "./dist/index.js"
},
"./rsc": {
"types": "./rsc/dist/index.d.mts",
"types": "./rsc/dist/index.d.ts",
"react-server": "./rsc/dist/rsc-server.mjs",
"import": "./rsc/dist/rsc-client.mjs",
"module": "./rsc/dist/rsc-client.mjs"
"import": "./rsc/dist/rsc-client.mjs"
},
"./prompts": {
"types": "./prompts/dist/index.d.ts",
"import": "./prompts/dist/index.mjs",
"module": "./prompts/dist/index.mjs",
"require": "./prompts/dist/index.js"
},
"./react": {
"types": "./react/dist/index.d.ts",
"react-server": "./react/dist/index.server.mjs",
"import": "./react/dist/index.mjs",
"module": "./react/dist/index.mjs",
"require": "./react/dist/index.js"
},
"./svelte": {
"types": "./svelte/dist/index.d.ts",
"import": "./svelte/dist/index.mjs",
"module": "./svelte/dist/index.mjs",
"require": "./svelte/dist/index.js"
},
"./vue": {
"types": "./vue/dist/index.d.ts",
"import": "./vue/dist/index.mjs",
"module": "./vue/dist/index.mjs",
"require": "./vue/dist/index.js"
},
"./solid": {
"types": "./solid/dist/index.d.ts",
"import": "./solid/dist/index.mjs",
"module": "./solid/dist/index.mjs",
"require": "./solid/dist/index.js"
}
},
Loading