Skip to content

Updates to set up ai page #8092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/pages/[platform]/ai/set-up-ai/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ const schema = a.schema({
chat: a.conversation({
aiModel: a.ai.model('Claude 3 Haiku'),
systemPrompt: 'You are a helpful assistant',
}),
})
.authorization((allow) => allow.owner()),
// highlight-end

// This adds a new generation route to your Amplify Data backend.
Expand Down Expand Up @@ -179,7 +180,7 @@ Call `Amplify.configure()` with the **amplify_outputs.json** file where the Reac

```tsx title="src/main.tsx"
import { Amplify } from 'aws-amplify';
import outputs from '../../amplify_outputs.json';
import outputs from '../amplify_outputs.json';

Amplify.configure(outputs);
```
Expand Down Expand Up @@ -314,12 +315,13 @@ export const { useAIConversation, useAIGeneration } = createAIHooks(client);
<InlineFilter filters={["react"]}>

```tsx title="src/App.tsx"
import { Flex, TextAreaField, Loader, Text, View } from "@aws-amplify/ui-react"
import { useAIGeneration } from "@/client";
import * as React from 'react';
import { Flex, TextAreaField, Loader, Text, View, Button } from "@aws-amplify/ui-react"
import { useAIGeneration } from "./client";

export default function App() {
const [description, setDescription] = React.useState("");
const [{ data, isLoading, hasError }, generateRecipe] =
const [{ data, isLoading }, generateRecipe] =
useAIGeneration("generateRecipe");

const handleClick = async () => {
Expand Down