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.4
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.5
Choose a head ref
  • 10 commits
  • 36 files changed
  • 9 contributors

Commits on Mar 4, 2024

  1. Update disclaimer in ai-rsc example (#1089)

    jeremyphilemon authored Mar 4, 2024
    Copy the full SHA
    9d49c62 View commit details
  2. Small fixes for useActions docs (#1083)

    MaxLeiter authored Mar 4, 2024
    Copy the full SHA
    062e45b View commit details
  3. Ensure ESM files import including the extension (#1088)

    timneutkens authored Mar 4, 2024
    Copy the full SHA
    5ee96ca View commit details
  4. Rename rsc/rsc-types.ts to rsc/index.ts to fix issues importing ai/rsc (

    briann authored Mar 4, 2024
    Copy the full SHA
    7eef3ae View commit details
  5. Move assistant response back to docs/api-reference. (#1086)

    lgrammel authored Mar 4, 2024
    Copy the full SHA
    9d51863 View commit details
  6. fix: Fix type declaration, upgrade bundler and clean up example (#1091)

    shuding authored Mar 4, 2024
    Copy the full SHA
    e25f3ca View commit details
  7. example: Upgrade Next.js for the RSC demo (#1094)

    shuding authored Mar 4, 2024
    Copy the full SHA
    d43d919 View commit details
  8. Update to Anthropic SDK 0.15.0 (#1097)

    lgrammel authored Mar 4, 2024
    Copy the full SHA
    65c821a View commit details
  9. Add changeset for Anthropic

    jaredpalmer committed Mar 4, 2024
    Copy the full SHA
    a973f1e View commit details
  10. Version Packages (#1095)

    Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
    github-actions[bot] and github-actions[bot] authored Mar 4, 2024
    Copy the full SHA
    fe18cc3 View commit details
Showing with 290 additions and 130 deletions.
  1. 0 docs/pages/docs/api-reference/{providers → }/assistant-response.mdx
  2. +29 −9 docs/pages/docs/api-reference/generative-ui/use-actions.mdx
  3. +1 −1 docs/pages/docs/guides/providers/anthropic.mdx
  4. +1 −2 examples/next-ai-rsc/app/page.tsx
  5. +3 −2 examples/next-ai-rsc/components/empty-screen.tsx
  6. +13 −13 examples/next-ai-rsc/components/llm-stocks/stock-purchase.tsx
  7. +2 −3 examples/next-ai-rsc/components/llm-stocks/stock.tsx
  8. +5 −5 examples/next-ai-rsc/components/llm-stocks/stocks.tsx
  9. +2 −2 examples/next-ai-rsc/package.json
  10. +1 −1 examples/next-anthropic/app/api/chat/route.ts
  11. +2 −2 examples/next-anthropic/package.json
  12. +1 −1 examples/next-aws-bedrock/package.json
  13. +1 −1 examples/next-fireworks/package.json
  14. +1 −1 examples/next-google-generative-ai/package.json
  15. +1 −1 examples/next-huggingface/package.json
  16. +1 −1 examples/next-inkeep/package.json
  17. +1 −1 examples/next-langchain/package.json
  18. +1 −1 examples/next-mistral/package.json
  19. +1 −1 examples/next-openai-pages/package.json
  20. +1 −1 examples/next-openai-rate-limits/package.json
  21. +1 −1 examples/next-openai/package.json
  22. +1 −1 examples/next-perplexity/package.json
  23. +1 −1 examples/nuxt-openai/package.json
  24. +1 −1 examples/solidstart-openai/package.json
  25. +1 −1 examples/sveltekit-openai/package.json
  26. +7 −0 packages/core/CHANGELOG.md
  27. +4 −4 packages/core/package.json
  28. 0 packages/core/rsc/{rsc-types.ts → index.ts}
  29. +2 −2 packages/core/rsc/package.json
  30. +1 −1 packages/core/rsc/provider.tsx
  31. +1 −1 packages/core/rsc/rsc-client.ts
  32. 0 packages/core/rsc/{rsc-shared.ts → rsc-shared.mts}
  33. +3 −3 packages/core/streams/anthropic-stream.test.ts
  34. +18 −4 packages/core/streams/anthropic-stream.ts
  35. +3 −2 packages/core/tsup.config.ts
  36. +178 −59 pnpm-lock.yaml
38 changes: 29 additions & 9 deletions docs/pages/docs/api-reference/generative-ui/use-actions.mdx
Original file line number Diff line number Diff line change
@@ -16,29 +16,49 @@ This is particularly useful for building interfaces that require user interactio
<Tabs items={['Next.js (App Router)']}>
<Tab>
```tsx filename="app/action.tsx"
import { createAI, createStreamableUI } from 'ai/rsc';

async function getStockPrice() {
// ...
}

async function viewStock(symbol: string) {
"use server"

const price = getStockPrice(symbol);
const uiStream = createUIStream();
const uiStream = createStreamableUI(<div>Loading...</div>);

uiStream.close(
<div>
{symbol}: {price}
</div>
);
// If you don't wrap this in an IIFE, the stream will block
// on the await call the Loading state will never be sent
// to the client.
(async () => {
const price = await getStockPrice(symbol);

uiStream.close(
<div>
{symbol}: {price}
</div>
);
})();

return {
id: Date.now(),
display: uiStream.value,
};
}

export const AI = createAI({
actions: {
viewStock,
},
});
```

```tsx filename="app/components/button.tsx"
import { AI } from '../action';

export function Button({ setMessages }) {
const { viewStock } = useActions();
const [messages, setMessages] = useUIState();
const { viewStock } = useActions<typeof AI>();
const [messages, setMessages] = useUIState<typeof AI>();

return (
<button
2 changes: 1 addition & 1 deletion docs/pages/docs/guides/providers/anthropic.mdx
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@ export async function POST(req: Request) {
const { messages } = await req.json();

// Ask Claude for a streaming chat completion given the prompt
const response = await anthropic.beta.messages.create({
const response = await anthropic.messages.create({
messages,
model: 'claude-2.1',
stream: true,
3 changes: 1 addition & 2 deletions examples/next-ai-rsc/app/page.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

import { useEffect, useRef, useState } from 'react';

import { useUIState, useActions, useAIState } from 'ai/rsc';
import { useUIState, useActions } from 'ai/rsc';
import { UserMessage } from '@/components/llm-stocks/message';

import { type AI } from './action';
@@ -19,7 +19,6 @@ import { IconArrowElbow, IconPlus } from '@/components/ui/icons';
import { Button } from '@/components/ui/button';
import { ChatList } from '@/components/chat-list';
import { EmptyScreen } from '@/components/empty-screen';
import { toast } from '@/components/ui/use-toast';

export default function Page() {
const [messages, setMessages] = useUIState<typeof AI>();
5 changes: 3 additions & 2 deletions examples/next-ai-rsc/components/empty-screen.tsx
Original file line number Diff line number Diff line change
@@ -66,8 +66,9 @@ export function EmptyScreen({
))}
</div>
</div>
<p className="leading-normal text-muted-foreground text-[0.8rem] text-center">
Note: This is not real financial advice.
<p className="leading-normal text-muted-foreground text-[0.8rem] text-center max-w-96 ml-auto mr-auto">
Note: Data and latency are simulated for illustrative purposes and
should not be considered as financial advice.
</p>
</div>
);
26 changes: 13 additions & 13 deletions examples/next-ai-rsc/components/llm-stocks/stock-purchase.tsx
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ export function Purchase({
);
const [history, setHistory] = useAIState<typeof AI>();
const [, setMessages] = useUIState<typeof AI>();
const { confirmPurchase } = useActions();
const { confirmPurchase } = useActions<typeof AI>();

// Unique identifier for this UI component.
const id = useId();
@@ -55,8 +55,8 @@ export function Purchase({
}

return (
<div className="rounded-xl bg-zinc-950 p-4 text-green-400 border">
<div className="float-right inline-block rounded-full bg-white/10 px-2 py-1 text-xs">
<div className="p-4 text-green-400 border rounded-xl bg-zinc-950">
<div className="inline-block float-right px-2 py-1 text-xs rounded-full bg-white/10">
+1.23% ↑
</div>
<div className="text-lg text-zinc-300">{name}</div>
@@ -65,7 +65,7 @@ export function Purchase({
<div className="mt-4 text-zinc-200">{purchasingUI}</div>
) : (
<>
<div className="relative mt-6 pb-6">
<div className="relative pb-6 mt-6">
<p>Shares to purchase</p>
<input
id="labels-range-input"
@@ -74,46 +74,46 @@ export function Purchase({
onChange={onSliderChange}
min="10"
max="1000"
className="h-1 w-full cursor-pointer appearance-none rounded-lg bg-zinc-600 accent-green-500 dark:bg-zinc-700"
className="w-full h-1 rounded-lg appearance-none cursor-pointer bg-zinc-600 accent-green-500 dark:bg-zinc-700"
/>
<span className="absolute bottom-1 start-0 text-xs text-zinc-400">
<span className="absolute text-xs bottom-1 start-0 text-zinc-400">
10
</span>
<span className="absolute bottom-1 start-1/3 -translate-x-1/2 text-xs text-zinc-400 rtl:translate-x-1/2">
<span className="absolute text-xs -translate-x-1/2 bottom-1 start-1/3 text-zinc-400 rtl:translate-x-1/2">
100
</span>
<span className="absolute bottom-1 start-2/3 -translate-x-1/2 text-xs text-zinc-400 rtl:translate-x-1/2">
<span className="absolute text-xs -translate-x-1/2 bottom-1 start-2/3 text-zinc-400 rtl:translate-x-1/2">
500
</span>
<span className="absolute bottom-1 end-0 text-xs text-zinc-400">
<span className="absolute text-xs bottom-1 end-0 text-zinc-400">
1000
</span>
</div>

<div className="mt-6">
<p>Total cost</p>
<div className="flex items-center sm:items-end sm:gap-2 text-xl sm:text-3xl font-bold flex-wrap">
<div className="flex flex-wrap items-center text-xl font-bold sm:items-end sm:gap-2 sm:text-3xl">
<div className="flex flex-col basis-1/3 sm:basis-auto sm:flex-row sm:items-center sm:gap-2 tabular-nums">
{value}
<span className="mb-1 text-sm font-normal text-zinc-600 dark:text-zinc-400 sm:mb-0">
shares
</span>
</div>
<div className="basis-1/3 text-center sm:basis-auto">×</div>
<div className="text-center basis-1/3 sm:basis-auto">×</div>
<span className="flex flex-col basis-1/3 sm:basis-auto sm:flex-row sm:items-center sm:gap-2 tabular-nums">
${price}
<span className="mb-1 ml-1 text-sm font-normal text-zinc-600 dark:text-zinc-400 sm:mb-0">
per share
</span>
</span>
<div className="basis-full text-center sm:text-left sm:basis-auto border-t border-t-zinc-700 mt-2 pt-2 sm:border-0 sm:mt-0 sm:pt-0">
<div className="pt-2 mt-2 text-center border-t basis-full sm:text-left sm:basis-auto border-t-zinc-700 sm:border-0 sm:mt-0 sm:pt-0">
= <span>{formatNumber(value * price)}</span>
</div>
</div>
</div>

<button
className="mt-6 w-full rounded-lg bg-green-500 dark:bg-green-500 px-4 py-2 text-zinc-900"
className="w-full px-4 py-2 mt-6 bg-green-500 rounded-lg dark:bg-green-500 text-zinc-900"
onClick={async () => {
const response = await confirmPurchase(name, price, value);
setPurchasingUI(response.purchasingUI);
5 changes: 2 additions & 3 deletions examples/next-ai-rsc/components/llm-stocks/stock.tsx
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ import type { AI } from '../../app/action';

export function Stock({ name = 'DOGE', price = 12.34, delta = 1 }) {
const [history, setHistory] = useAIState<typeof AI>();
const [selectedDuration, setSelectedDuration] = useState('6M');
const id = useId();

const [priceAtTime, setPriceAtTime] = useState({
@@ -144,7 +143,6 @@ export function Stock({ name = 'DOGE', price = 12.34, delta = 1 }) {
) : null}

<svg
className="uch-psvg"
viewBox="0 0 250.0 168.0"
height="150"
width="100%"
@@ -183,14 +181,15 @@ export function Stock({ name = 'DOGE', price = 12.34, delta = 1 }) {
<path
d="M 0 42.86 L 0.89 46.26 L 1.78 44.3 L 2.68 44.24 L 3.57 42 L 4.46 43.42 L 5.35 43.62 L 6.25 47 L 7.14 47.65 L 8.03 47.69 L 8.92 45.55 L 9.82 43.19 L 10.71 43.9 L 11.6 42.83 L 12.49 42.81 L 13.39 46.75 L 14.28 43.06 L 15.17 40.8 L 16.06 39.72 L 16.96 39.77 L 17.85 45.77 L 18.74 44.93 L 19.63 44.35 L 20.53 40.29 L 21.42 42.77 L 22.31 42.12 L 23.2 43.4 L 24.1 47.95 L 24.99 50.15 L 25.88 48.59 L 26.77 42.18 L 27.67 44.1 L 28.56 39.91 L 29.45 44.92 L 30.34 47.62 L 31.24 48.06 L 32.13 47.67 L 33.02 56.47 L 33.91 57.74 L 34.8 65.48 L 35.7 64.47 L 36.59 47.25 L 37.48 58.26 L 38.37 52.04 L 39.27 55.8 L 40.16 92.92 L 41.05 105.2 L 41.94 102 L 42.84 106.14 L 43.73 78.71 L 44.62 104.6 L 45.51 96.58 L 46.41 67.56 L 47.3 69.53 L 48.19 69.99 L 49.08 66.75 L 49.98 69.72 L 50.87 70.13 L 51.76 71.3 L 52.65 70.03 L 53.55 67.92 L 54.44 66.41 L 55.33 97.12 L 56.22 95.93 L 57.12 95.03 L 58.01 95.09 L 58.9 65.56 L 59.79 65.12 L 60.69 82.42 L 61.58 74.7 L 62.47 71.13 L 63.36 82.43 L 64.26 96.02 L 65.15 100.36 L 66.04 98.6 L 66.93 103.37 L 67.82 102.12 L 68.72 97.08 L 69.61 89.74 L 70.5 90.7 L 71.39 93.46 L 72.29 94.24 L 73.18 97.8 L 74.07 97.88 L 74.96 96.63 L 75.86 96.27 L 76.75 97.15 L 77.64 100.12 L 78.53 100.51 L 79.43 106.59 L 80.32 104.54 L 81.21 100.31 L 82.1 118.76 L 83 106.24 L 83.89 114.8 L 84.78 174.89 L 85.67 122.28 L 86.57 149.25 L 87.46 151.47 L 88.35 153.38 L 89.24 153.5 L 90.14 149.24 L 91.03 122.44 L 91.92 122.08 L 92.81 147.16 L 93.71 147.46 L 94.6 119.13 L 95.49 117.97 L 96.38 122.22 L 97.28 116.38 L 98.17 119.53 L 99.06 119.65 L 99.95 120.15 L 100.84 120.22 L 101.74 121.28 L 102.63 121.4 L 103.52 122.97 L 104.41 122.15 L 105.31 120.6 L 106.2 116.55 L 107.09 122.23 L 107.98 120.96 L 108.88 119.54 L 109.77 120.19 L 110.66 120.99 L 111.55 119.92 L 112.45 115.69 L 113.34 116.33 L 114.23 116.07 L 115.12 115.34 L 116.02 111.34 L 116.91 107.23 L 117.8 113.21 L 118.69 98.77 L 119.59 97.04 L 120.48 96.56 L 121.37 96.36 L 122.26 99.7 L 123.16 103.33 L 124.05 100.38 L 124.94 99.68 L 125.83 99.02 L 126.73 102.56 L 127.62 103.25 L 128.51 103.38 L 129.4 104.89 L 130.3 118.07 L 131.19 100.82 L 132.08 103.06 L 132.97 103.47 L 133.86 99.8 L 134.76 111.28 L 135.65 107.73 L 136.54 107.46 L 137.43 108.08 L 138.33 109.82 L 139.22 110.94 L 140.11 111.3 L 141 108.14 L 141.9 109.35 L 142.79 108.38 L 143.68 99.08 L 144.57 99.02 L 145.47 98.61 L 146.36 99.07 L 147.25 99.26 L 148.14 95.1 L 149.04 92.08 L 149.93 92.76 L 150.82 92.87 L 151.71 83.31 L 152.61 82.93 L 153.5 84.86 L 154.39 84.12 L 155.28 94.08 L 156.18 93.31 L 157.07 94.23 L 157.96 94.58 L 158.85 99.33 L 159.75 80 L 160.64 90.28 L 161.53 84.07 L 162.42 68.37 L 163.32 76.88 L 164.21 81.78 L 165.1 80.72 L 165.99 73.89 L 166.88 77.14 L 167.78 67.58 L 168.67 59.82 L 169.56 61.91 L 170.45 61.07 L 171.35 73.74 L 172.24 77.02 L 173.13 78.61 L 174.02 71.59 L 174.92 68.24 L 175.81 72.14 L 176.7 65.37 L 177.59 76.73 L 178.49 88.02 L 179.38 88.01 L 180.27 88.27 L 181.16 86.23 L 182.06 86.14 L 182.95 89.54 L 183.84 94.16 L 184.73 97.72 L 185.63 81.52 L 186.52 92.85 L 187.41 94.14 L 188.3 93.06 L 189.2 92.64 L 190.09 92.44 L 190.98 91.75 L 191.87 90.53 L 192.77 88.27 L 193.66 85.44 L 194.55 82.26 L 195.44 85.08 L 196.34 85.65 L 197.23 53.43 L 198.12 72.01 L 199.01 38.37 L 199.9 69.43 L 200.8 74.46 L 201.69 74.22 L 202.58 82.46 L 203.47 77.01 L 204.37 87.8 L 205.26 91.56 L 206.15 76.69 L 207.04 76.46 L 207.94 78.13 L 208.83 80.06 L 209.72 92.79 L 210.61 87.74 L 211.51 88.21 L 212.4 88.47 L 213.29 87.35 L 214.18 89.69 L 215.08 77.37 L 215.97 87.95 L 216.86 75.16 L 217.75 70.47 L 218.65 85.11 L 219.54 88.1 L 220.43 88.06 L 221.32 86.34 L 222.22 76.91 L 223.11 75.33 L 224 73.6 L 224.89 25.31 L 225.79 44.14 L 226.68 43.93 L 227.57 45.13 L 228.46 44.03 L 229.36 35.73 L 230.25 33.65 L 231.14 34.81 L 232.03 17.64 L 232.92 21.13 L 233.82 19.37 L 234.71 24.66 L 235.6 23.87 L 236.49 22.56 L 237.39 28.48 L 238.28 25.33 L 239.17 28.51 L 240.06 30.83 L 240.96 35.79 L 241.85 34.6 L 242.74 31.2 L 243.63 32.97 L 244.53 33.01 L 245.42 31.38 L 246.31 30.21 L 247.2 27.75 L 248.1 25.27 L 248.99 23 L 249.88 23 L 250 23 L 2000 0 L 2000 1000 L -1000 1000"
clipPath="url(#range-id-tsuid_31)"
className="range-normal-line"
vectorEffect="non-scaling-stroke"
stroke="none"
strokeWidth={2}
fill='url("#fill-id-tsuid_31")'
></path>
<path
clipPath="url(#mask-_f1bJZYLUHqWpxc8Prs2meA_32)"
d="M 0 42.86 L 0.89 46.26 L 1.78 44.3 L 2.68 44.24 L 3.57 42 L 4.46 43.42 L 5.35 43.62 L 6.25 47 L 7.14 47.65 L 8.03 47.69 L 8.92 45.55 L 9.82 43.19 L 10.71 43.9 L 11.6 42.83 L 12.49 42.81 L 13.39 46.75 L 14.28 43.06 L 15.17 40.8 L 16.06 39.72 L 16.96 39.77 L 17.85 45.77 L 18.74 44.93 L 19.63 44.35 L 20.53 40.29 L 21.42 42.77 L 22.31 42.12 L 23.2 43.4 L 24.1 47.95 L 24.99 50.15 L 25.88 48.59 L 26.77 42.18 L 27.67 44.1 L 28.56 39.91 L 29.45 44.92 L 30.34 47.62 L 31.24 48.06 L 32.13 47.67 L 33.02 56.47 L 33.91 57.74 L 34.8 65.48 L 35.7 64.47 L 36.59 47.25 L 37.48 58.26 L 38.37 52.04 L 39.27 55.8 L 40.16 92.92 L 41.05 105.2 L 41.94 102 L 42.84 106.14 L 43.73 78.71 L 44.62 104.6 L 45.51 96.58 L 46.41 67.56 L 47.3 69.53 L 48.19 69.99 L 49.08 66.75 L 49.98 69.72 L 50.87 70.13 L 51.76 71.3 L 52.65 70.03 L 53.55 67.92 L 54.44 66.41 L 55.33 97.12 L 56.22 95.93 L 57.12 95.03 L 58.01 95.09 L 58.9 65.56 L 59.79 65.12 L 60.69 82.42 L 61.58 74.7 L 62.47 71.13 L 63.36 82.43 L 64.26 96.02 L 65.15 100.36 L 66.04 98.6 L 66.93 103.37 L 67.82 102.12 L 68.72 97.08 L 69.61 89.74 L 70.5 90.7 L 71.39 93.46 L 72.29 94.24 L 73.18 97.8 L 74.07 97.88 L 74.96 96.63 L 75.86 96.27 L 76.75 97.15 L 77.64 100.12 L 78.53 100.51 L 79.43 106.59 L 80.32 104.54 L 81.21 100.31 L 82.1 118.76 L 83 106.24 L 83.89 114.8 L 84.78 174.89 L 85.67 122.28 L 86.57 149.25 L 87.46 151.47 L 88.35 153.38 L 89.24 153.5 L 90.14 149.24 L 91.03 122.44 L 91.92 122.08 L 92.81 147.16 L 93.71 147.46 L 94.6 119.13 L 95.49 117.97 L 96.38 122.22 L 97.28 116.38 L 98.17 119.53 L 99.06 119.65 L 99.95 120.15 L 100.84 120.22 L 101.74 121.28 L 102.63 121.4 L 103.52 122.97 L 104.41 122.15 L 105.31 120.6 L 106.2 116.55 L 107.09 122.23 L 107.98 120.96 L 108.88 119.54 L 109.77 120.19 L 110.66 120.99 L 111.55 119.92 L 112.45 115.69 L 113.34 116.33 L 114.23 116.07 L 115.12 115.34 L 116.02 111.34 L 116.91 107.23 L 117.8 113.21 L 118.69 98.77 L 119.59 97.04 L 120.48 96.56 L 121.37 96.36 L 122.26 99.7 L 123.16 103.33 L 124.05 100.38 L 124.94 99.68 L 125.83 99.02 L 126.73 102.56 L 127.62 103.25 L 128.51 103.38 L 129.4 104.89 L 130.3 118.07 L 131.19 100.82 L 132.08 103.06 L 132.97 103.47 L 133.86 99.8 L 134.76 111.28 L 135.65 107.73 L 136.54 107.46 L 137.43 108.08 L 138.33 109.82 L 139.22 110.94 L 140.11 111.3 L 141 108.14 L 141.9 109.35 L 142.79 108.38 L 143.68 99.08 L 144.57 99.02 L 145.47 98.61 L 146.36 99.07 L 147.25 99.26 L 148.14 95.1 L 149.04 92.08 L 149.93 92.76 L 150.82 92.87 L 151.71 83.31 L 152.61 82.93 L 153.5 84.86 L 154.39 84.12 L 155.28 94.08 L 156.18 93.31 L 157.07 94.23 L 157.96 94.58 L 158.85 99.33 L 159.75 80 L 160.64 90.28 L 161.53 84.07 L 162.42 68.37 L 163.32 76.88 L 164.21 81.78 L 165.1 80.72 L 165.99 73.89 L 166.88 77.14 L 167.78 67.58 L 168.67 59.82 L 169.56 61.91 L 170.45 61.07 L 171.35 73.74 L 172.24 77.02 L 173.13 78.61 L 174.02 71.59 L 174.92 68.24 L 175.81 72.14 L 176.7 65.37 L 177.59 76.73 L 178.49 88.02 L 179.38 88.01 L 180.27 88.27 L 181.16 86.23 L 182.06 86.14 L 182.95 89.54 L 183.84 94.16 L 184.73 97.72 L 185.63 81.52 L 186.52 92.85 L 187.41 94.14 L 188.3 93.06 L 189.2 92.64 L 190.09 92.44 L 190.98 91.75 L 191.87 90.53 L 192.77 88.27 L 193.66 85.44 L 194.55 82.26 L 195.44 85.08 L 196.34 85.65 L 197.23 53.43 L 198.12 72.01 L 199.01 38.37 L 199.9 69.43 L 200.8 74.46 L 201.69 74.22 L 202.58 82.46 L 203.47 77.01 L 204.37 87.8 L 205.26 91.56 L 206.15 76.69 L 207.04 76.46 L 207.94 78.13 L 208.83 80.06 L 209.72 92.79 L 210.61 87.74 L 211.51 88.21 L 212.4 88.47 L 213.29 87.35 L 214.18 89.69 L 215.08 77.37 L 215.97 87.95 L 216.86 75.16 L 217.75 70.47 L 218.65 85.11 L 219.54 88.1 L 220.43 88.06 L 221.32 86.34 L 222.22 76.91 L 223.11 75.33 L 224 73.6 L 224.89 25.31 L 225.79 44.14 L 226.68 43.93 L 227.57 45.13 L 228.46 44.03 L 229.36 35.73 L 230.25 33.65 L 231.14 34.81 L 232.03 17.64 L 232.92 21.13 L 233.82 19.37 L 234.71 24.66 L 235.6 23.87 L 236.49 22.56 L 237.39 28.48 L 238.28 25.33 L 239.17 28.51 L 240.06 30.83 L 240.96 35.79 L 241.85 34.6 L 242.74 31.2 L 243.63 32.97 L 244.53 33.01 L 245.42 31.38 L 246.31 30.21 L 247.2 27.75 L 248.1 25.27 L 248.99 23 L 249.88 23 L 250 23 L 2000 0 L 2000 1000 L -1000 1000"
vectorEffect="non-scaling-stroke"
stroke="#34a853"
style={{ fill: 'url(#chart-grad-_f1bJZYLUHqWpxc8Prs2meA_33)' }}
></path>
10 changes: 5 additions & 5 deletions examples/next-ai-rsc/components/llm-stocks/stocks.tsx
Original file line number Diff line number Diff line change
@@ -6,14 +6,14 @@ import type { AI } from '../../app/action';

export function Stocks({ stocks }: { stocks: any[] }) {
const [, setMessages] = useUIState<typeof AI>();
const { submitUserMessage } = useActions();
const { submitUserMessage } = useActions<typeof AI>();

return (
<div className="flex flex-col sm:flex-row text-sm gap-2 mb-4 overflow-y-scroll pb-4">
<div className="flex flex-col gap-2 pb-4 mb-4 overflow-y-scroll text-sm sm:flex-row">
{stocks.map(stock => (
<button
key={stock.symbol}
className="bg-zinc-900 text-left p-2 rounded-lg flex flex-row gap-2 cursor-pointer hover:bg-zinc-800 sm:w-52"
className="flex flex-row gap-2 p-2 text-left rounded-lg cursor-pointer bg-zinc-900 hover:bg-zinc-800 sm:w-52"
onClick={async () => {
const response = await submitUserMessage(`View ${stock.symbol}`);
setMessages(currentMessages => [...currentMessages, response]);
@@ -27,8 +27,8 @@ export function Stocks({ stocks }: { stocks: any[] }) {
{stock.delta > 0 ? '↑' : '↓'}
</div>
<div className="flex flex-col">
<div className="text-zinc-300 bold uppercase">{stock.symbol}</div>
<div className="text-zinc-500 text-base">${stock.price}</div>
<div className="uppercase text-zinc-300 bold">{stock.symbol}</div>
<div className="text-base text-zinc-500">${stock.price}</div>
</div>
<div className="flex flex-col ml-auto">
<div
4 changes: 2 additions & 2 deletions examples/next-ai-rsc/package.json
Original file line number Diff line number Diff line change
@@ -19,13 +19,13 @@
"@radix-ui/react-tooltip": "^1.0.7",
"@vercel/analytics": "^1.2.2",
"@vercel/kv": "^1.0.1",
"ai": "3.0.4",
"ai": "latest",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"d3-scale": "^4.0.2",
"date-fns": "^3.3.1",
"geist": "^1.2.2",
"next": "14.1.1",
"next": "14.1.2-canary.4",
"next-themes": "^0.2.1",
"openai": "^4.28.4",
"react": "^18",
2 changes: 1 addition & 1 deletion examples/next-anthropic/app/api/chat/route.ts
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ export async function POST(req: Request) {
const { messages } = await req.json();

// Ask Claude for a streaming chat completion given the prompt
const response = await anthropic.beta.messages.create({
const response = await anthropic.messages.create({
messages,
model: 'claude-2.1',
stream: true,
4 changes: 2 additions & 2 deletions examples/next-anthropic/package.json
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@
"lint": "next lint"
},
"dependencies": {
"@anthropic-ai/sdk": "0.12.0",
"ai": "3.0.4",
"@anthropic-ai/sdk": "0.15.0",
"ai": "3.0.5",
"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.4",
"ai": "3.0.5",
"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.4",
"ai": "3.0.5",
"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.4",
"ai": "3.0.5",
"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.4",
"ai": "3.0.5",
"react": "18.2.0",
"react-dom": "^18.2.0"
},
Loading