Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
josefaidt committed Nov 26, 2024
2 parents 91241f7 + b850c31 commit 8c3ef69
Show file tree
Hide file tree
Showing 26 changed files with 3,958 additions and 1,484 deletions.
4 changes: 3 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -1614,7 +1614,9 @@
"ampx",
"autodetection",
"jamba",
"webauthn"
"webauthn",
"knowledgebases",
"rehype"
],
"flagWords": ["hte", "full-stack", "Full-stack", "Full-Stack", "sudo"],
"patterns": [
Expand Down
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"private": true,
"dependencies": {
"@aws-amplify/amplify-cli-core": "^4.3.9",
"@aws-amplify/ui-react": "^6.3.1",
"@aws-amplify/ui-react": "^6.7.0",
"@aws-amplify/ui-react-ai": "^1.0.0",
"@docsearch/react": "3",
"ajv": "^8.16.0",
"aws-amplify": "^6.0.9",
"next": "^14.2.3",
"next": "^14.2.18",
"next-image-export-optimizer": "^1.8.3",
"next-transpile-modules": "^9.0.0",
"parse-imports": "^1.1.0",
Expand Down Expand Up @@ -89,6 +90,7 @@
"minimatch": "3.1.2",
"decode-uri-component": "0.2.1",
"**/fast-xml-parser": "4.4.1",
"cross-spawn": "^7.0.5",
"semver": "7.5.2",
"tough-cookie": "4.1.3",
"aws-cdk-lib": "2.80.0",
Expand Down
Binary file added public/images/user.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions src/components/AI/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import { Avatar } from '@aws-amplify/ui-react';
import { ConversationMessage } from '@aws-amplify/ui-react-ai';
import { AmplifyLogo } from '@/components/GlobalNav/components/icons';

export const UserAvatar = () => {
return <Avatar src="/images/user.jpg" />;
};

export const AssistantAvatar = () => {
return (
<Avatar backgroundColor={'primary.20'}>
<AmplifyLogo />
</Avatar>
);
};

export const MESSAGES: ConversationMessage[] = [
{
conversationId: 'foobar',
id: '1',
content: [{ text: 'Hello' }],
role: 'user' as const,
createdAt: new Date(2023, 4, 21, 15, 23).toISOString()
},
{
conversationId: 'foobar',
id: '2',
content: [
{
text: 'Hello! I am your virtual assistant how may I help you?'
}
],
role: 'assistant' as const,
createdAt: new Date(2023, 4, 21, 15, 24).toISOString()
}
];

export const MESSAGES_RESPONSE_COMPONENTS: ConversationMessage[] = [
{
conversationId: 'foobar',
id: '1',
content: [{ text: 'Whats the weather in San Jose?' }],
role: 'user' as const,
createdAt: new Date(2023, 4, 21, 15, 23).toISOString()
},
{
conversationId: 'foobar',
id: '2',
content: [
{
text: 'Let me get the weather for San Jose for you.'
},
{
toolUse: {
name: 'AMPLIFY_UI_WeatherCard',
input: { city: 'San Jose' },
toolUseId: '1234'
}
}
],
role: 'assistant' as const,
createdAt: new Date(2023, 4, 21, 15, 24).toISOString()
}
];
29 changes: 29 additions & 0 deletions src/components/UIWrapper/UWrapper.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {
createTheme,
defaultDarkModeOverride,
ThemeProvider,
View
} from '@aws-amplify/ui-react';
import * as React from 'react';
import { LayoutContext } from '../Layout';

const theme = createTheme({
name: 'default-amplify-ui-theme',
overrides: [defaultDarkModeOverride]
});

export const UIWrapper = ({ children }: React.PropsWithChildren) => {
const { colorMode } = React.useContext(LayoutContext);

return (
<ThemeProvider theme={theme} colorMode={colorMode}>
<View
borderRadius="small"
padding="large"
boxShadow={`0 0 0 2px ${theme.tokens.colors.neutral[20]}`}
>
{children}
</View>
</ThemeProvider>
);
};
1 change: 1 addition & 0 deletions src/components/UIWrapper/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { UIWrapper } from './UWrapper';
65 changes: 65 additions & 0 deletions src/directory/directory.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,71 @@ export const directory = {
}
]
},
{
path: 'src/pages/[platform]/ai/index.mdx',
children: [
{
path: 'src/pages/[platform]/ai/set-up-ai/index.mdx'
},
{
path: 'src/pages/[platform]/ai/concepts/index.mdx',
children: [
{
path: 'src/pages/[platform]/ai/concepts/architecture/index.mdx'
},
{
path: 'src/pages/[platform]/ai/concepts/models/index.mdx'
},
{
path: 'src/pages/[platform]/ai/concepts/prompting/index.mdx'
},
{
path: 'src/pages/[platform]/ai/concepts/inference-configuration/index.mdx'
},
{
path: 'src/pages/[platform]/ai/concepts/streaming/index.mdx'
},
{
path: 'src/pages/[platform]/ai/concepts/tools/index.mdx'
}
]
},
{
path: 'src/pages/[platform]/ai/conversation/index.mdx',
children: [
{
path: 'src/pages/[platform]/ai/conversation/ai-conversation/index.mdx'
},
{
path: 'src/pages/[platform]/ai/conversation/connect-your-frontend/index.mdx'
},
{
path: 'src/pages/[platform]/ai/conversation/history/index.mdx'
},
{
path: 'src/pages/[platform]/ai/conversation/tools/index.mdx'
},
{
path: 'src/pages/[platform]/ai/conversation/context/index.mdx'
},
{
path: 'src/pages/[platform]/ai/conversation/response-components/index.mdx'
},
{
path: 'src/pages/[platform]/ai/conversation/knowledge-base/index.mdx'
}
]
},
{
path: 'src/pages/[platform]/ai/generation/index.mdx',
children: [
{
path: 'src/pages/[platform]/ai/generation/data-extraction/index.mdx'
}
]
}
]
},
{
path: 'src/pages/[platform]/build-ui/index.mdx',
children: [
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[platform]/ai/concepts/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const meta = {
title: "Concepts",
description:
"Learn about what Amplify AI provisions and get an overview about generative AI concepts and terminology.",
route: '/[platform]/ai-kit/overview',
route: '/[platform]/ai/concepts',
platforms: [
"javascript",
"react-native",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ All generative AI routes in Amplify accept inference configuration as optional p

```ts
a.generation({
aiModel: a.ai.model("Claude 3 Haiku"),
aiModel: a.ai.model("Claude 3.5 Haiku"),
systemPrompt: `You are a helpful assistant`,
inferenceConfiguration: {
temperature: 0.2,
Expand Down
19 changes: 12 additions & 7 deletions src/pages/[platform]/ai/concepts/models/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,32 @@ Always refer to [Bedrock pricing](https://aws.amazon.com/bedrock/pricing/) for t
The Amplify AI Kit uses Bedrock's [Converse API](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference.html) to leverage a unified API across models. Most models have different structures to how they best work with input and how they format their output. For example, ...

### AI21 Labs
* [Jamba 1.5 Large](https://aws.amazon.com/blogs/aws/jamba-1-5-family-of-models-by-ai21-labs-is-now-available-in-amazon-bedrock/)
* [Jamba 1.5 Mini](https://aws.amazon.com/blogs/aws/jamba-1-5-family-of-models-by-ai21-labs-is-now-available-in-amazon-bedrock/)

* Jamba 1.5 Large
* Jamba 1.5 Mini
[Bedrock documentation about AI21 models](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-ai21.html)

### Anthropic
* Claude 3 Haiku
* Claude 3.5 Haiku
* Claude 3 Sonnet
* Claude 3 Opus
* Claude 3.5 Sonnet
https://docs.anthropic.com/en/docs/about-claude/models
* Claude 3.5 Sonnet v2
[Bedrock documentation about Anthropic models](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-claude.html)

### Cohere
* Command R
* Command R+
[Bedrock documentation about Cohere models](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-cohere.html)

### Meta
### Meta Llama
* Llama 3.1
[Bedrock documentation about Meta Llama models](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-meta.html)

### Mistral
### Mistral AI
* Large
* Large 2
[Bedrock documentation about Mistral AI models](https://docs.aws.amazon.com/bedrock/latest/userguide/model-parameters-mistral.html)


The Amplify AI Kit makes use of ["tools"](/[platform]/ai/concepts/tools) for both generation and conversation routes. [The models it supports must support tool use in the Converse API](https://docs.aws.amazon.com/bedrock/latest/userguide/conversation-inference-supported-models-features.html).
Expand Down Expand Up @@ -115,7 +120,7 @@ Using the Amplify AI Kit you can easily use different models for different funct
```ts
const schema = a.schema({
summarizer: a.generation({
aiModel: a.ai.model("Claude 3 Haiku")
aiModel: a.ai.model("Claude 3.5 Haiku")
})
})
```
Expand Down
2 changes: 1 addition & 1 deletion src/pages/[platform]/ai/concepts/prompting/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ All AI routes in the Amplify AI kit require a system prompt. This will be used i

```ts
reviewSummarizer: a.generation({
aiModel: a.ai.model("Claude 3.5 Sonnet"),
aiModel: a.ai.model("Claude 3.5 Haiku"),
systemPrompt: `
You are a helpful assistant that summarizes reviews
for an ecommerce site.
Expand Down
Loading

0 comments on commit 8c3ef69

Please sign in to comment.