Skip to content

Commit

Permalink
Json block example updated to 0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
richardgill committed May 29, 2024
1 parent 7885b68 commit b40e7b1
Show file tree
Hide file tree
Showing 14 changed files with 178 additions and 137 deletions.
8 changes: 4 additions & 4 deletions examples/code/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
"lint": "next lint"
},
"dependencies": {
"@llm-ui/code": "^0.9.0",
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"@llm-ui/code": "^0.12.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"html-react-parser": "^5.1.10",
"next": "14.2.3",
"react": "^18",
"react-dom": "^18",
"react-markdown": "^9.0.1",
"remark-gfm": "^4.0.0",
"shiki": "^1.6.0"
"shiki": "^1.6.1"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
Expand Down
8 changes: 4 additions & 4 deletions examples/code/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
"preview": "vite preview"
},
"dependencies": {
"@llm-ui/code": "^0.9.0",
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"@llm-ui/code": "^0.12.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"html-react-parser": "^5.1.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^9.0.1",
"remark-gfm": "^4.0.0",
"shiki": "^1.6.0"
"shiki": "^1.6.1"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
Expand Down
6 changes: 3 additions & 3 deletions examples/json/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"lint": "next lint"
},
"dependencies": {
"@llm-ui/json": "^0.9.0",
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"@llm-ui/json": "^0.12.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"next": "14.2.3",
"react": "^18",
"react-dom": "^18",
Expand Down
7 changes: 6 additions & 1 deletion examples/json/nextjs/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import z from "zod";

const options = {
type: "buttons",
};

const buttonsSchema = z.object({
type: z.literal("buttons"),
buttons: z.array(z.object({ text: z.string() })),
Expand All @@ -22,6 +26,7 @@ const buttonsPrompt = jsonBlockPrompt({
examples: [
{ type: "buttons", buttons: [{ text: "Button 1" }, { text: "Button 2" }] },
],
options,
});
// -------Step 1: Create a markdown component-------

Expand Down Expand Up @@ -75,7 +80,7 @@ const Example = () => {
llmOutput: output,
blocks: [
{
...jsonBlock("buttons"),
...jsonBlock(options),
component: ButtonsComponent,
},
],
Expand Down
6 changes: 3 additions & 3 deletions examples/json/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"preview": "vite preview"
},
"dependencies": {
"@llm-ui/json": "^0.9.0",
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"@llm-ui/json": "^0.12.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^9.0.1",
Expand Down
7 changes: 6 additions & 1 deletion examples/json/vite/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ import ReactMarkdown from "react-markdown";
import remarkGfm from "remark-gfm";
import z from "zod";

const options = {
type: "buttons",
};

const buttonsSchema = z.object({
type: z.literal("buttons"),
buttons: z.array(z.object({ text: z.string() })),
Expand All @@ -22,6 +26,7 @@ const buttonsPrompt = jsonBlockPrompt({
examples: [
{ type: "buttons", buttons: [{ text: "Button 1" }, { text: "Button 2" }] },
],
options,
});
// -------Step 1: Create a markdown component-------

Expand Down Expand Up @@ -75,7 +80,7 @@ const Example = () => {
llmOutput: output,
blocks: [
{
...jsonBlock("buttons"),
...jsonBlock(options),
component: ButtonsComponent,
},
],
Expand Down
4 changes: 2 additions & 2 deletions examples/markdown/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"lint": "next lint"
},
"dependencies": {
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"next": "14.2.3",
"react": "^18",
"react-dom": "^18",
Expand Down
4 changes: 2 additions & 2 deletions examples/markdown/vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"preview": "vite preview"
},
"dependencies": {
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^9.0.1",
Expand Down
10 changes: 5 additions & 5 deletions examples/openai/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@
"lint": "next lint"
},
"dependencies": {
"@llm-ui/code": "^0.9.0",
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"@llm-ui/code": "^0.12.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"html-react-parser": "^5.1.10",
"next": "14.2.3",
"openai": "^4.47.1",
"openai": "^4.47.2",
"react": "^18",
"react-dom": "^18",
"react-markdown": "^9.0.1",
"remark-gfm": "^4.0.0",
"shiki": "^1.6.0"
"shiki": "^1.6.1"
},
"devDependencies": {
"@tailwindcss/typography": "^0.5.13",
Expand Down
10 changes: 5 additions & 5 deletions examples/openai/vite-and-express/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
"preview": "vite preview"
},
"dependencies": {
"@llm-ui/code": "^0.9.0",
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"@llm-ui/code": "^0.12.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"html-react-parser": "^5.1.10",
"openai": "^4.47.1",
"openai": "^4.47.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-markdown": "^9.0.1",
"remark-gfm": "^4.0.0",
"shiki": "^1.6.0",
"shiki": "^1.6.1",
"vite-express": "^0.16.0"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions examples/vercel-ai/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@
"lint": "next lint"
},
"dependencies": {
"@ai-sdk/openai": "^0.0.16",
"@llm-ui/code": "^0.9.0",
"@llm-ui/markdown": "^0.9.0",
"@llm-ui/react": "^0.9.0",
"ai": "^3.1.15",
"@ai-sdk/openai": "^0.0.17",
"@llm-ui/code": "^0.12.0",
"@llm-ui/markdown": "^0.12.0",
"@llm-ui/react": "^0.12.0",
"ai": "^3.1.16",
"html-react-parser": "^5.1.10",
"next": "14.2.3",
"react": "^18",
"react-dom": "^18",
"react-markdown": "^9.0.1",
"remark-gfm": "^4.0.0",
"shiki": "^1.6.0",
"shiki": "^1.6.1",
"zod": "^3.23.8"
},
"devDependencies": {
Expand Down
Loading

0 comments on commit b40e7b1

Please sign in to comment.