Skip to content

Commit

Permalink
Pull latest fork into repo (#3)
Browse files Browse the repository at this point in the history
* fix: close browser after URL processing with Playwright (aws-samples#341) (aws-samples#346)

Co-authored-by: edamame8888 <edamame_8888@yahoo.co.jp>

* Localized generation params text (ja) (aws-samples#343)

* i18n ja (generation param)

* fix

* npm audit (aws-samples#348)

* fix (aws-samples#354)

* fix (aws-samples#355)

* fix css

* fix

* fix

* Feature: Conversation Quick Starter (aws-samples#356)

* add conversation quick start

* fix ci

* fix

* fix

* fix bugs

* fix

* docs: update README.md (aws-samples#363)

comapny -> company

* fix

* Fix publish API error (aws-samples#353)

* Fix publish API error

* Fix conversation not found in publish API caused by permission error

Grant permission for sqs consumer handler to read the secret

* skip CF logging in unsupported regions (aws-samples#367)

* CloudFront does not support standard log delivery in all regions
  * https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/AccessLogs.html#access-logs-choosing-s3-bucket

* add keyboard command and fix bug

* add ErrorBoundary

* fix ui

* Add agent for published api (aws-samples#373)

* add agent for published api

* format

* fix

* patch (aws-samples#376)

* fix bg-color and i18n en

* add ladle add Alert Stories

* fix

* fix (aws-samples#379)

* create shortcut key modal

* fix lint error

* Bump braces from 3.0.2 to 3.0.3 in /cdk (aws-samples#380)

Bumps [braces](https://github.com/micromatch/braces) from 3.0.2 to 3.0.3.
- [Changelog](https://github.com/micromatch/braces/blob/master/CHANGELOG.md)
- [Commits](micromatch/braces@3.0.2...3.0.3)

---
updated-dependencies:
- dependency-name: braces
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Introduce poetry (aws-samples#381)

* add poetry

* wip

* fix ga workflow

* fix readme on backend

* fix notation for dev dependencies

* update lock

* downgrade tenacity

* fix (aws-samples#382)

* Bump urllib3 from 2.2.1 to 2.2.2 in /backend (aws-samples#383)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.2.1...2.2.2)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: add support for Sonnet 3.5 (aws-samples#387)

Co-authored-by: Gabriel Koo <gabriel.koo@macbook>

* styled fixed

* rm font-semibold

* fix question icon

* fix button send icon

* fix button send style

* add shift right

* fix

* imple the feature of attach text file

* remove unnecessary icon

* gix send button

* Update index.html (aws-samples#384)

* update

* fix (aws-samples#402)

* fix (aws-samples#407)

* Feat/continue to generate (aws-samples#401)

* imple the feature of continue to generate

* refactor code based on review

* refactor code

* refactor code

* fix lang resources

* fix lang resources

* fix lang resources

* fix test cases

* revert to non ja and en lang resource

* fixed based on review

* add comment for non-striming use

* revert to lang resource

* fixed strip handling of generated messages

* add continue to generate feature for published api

* Fixes to show/hide controls for continue generate button

* fixed button show/hide handling

* fixed button show/hide handling

* add pre-signed url permission (aws-samples#411)

* imple changes based on discussions

* imple changes based on discussions

* fixed for mypi checks

* update file extension determination

* fixed lint suggestion

* fix (aws-samples#414)

* fix

* create useIsWindows hooks

* fix en

* fix button

* rm browser

* button stories

* add button copy

* add stories

* add atoms

* npm audit fix

* fix style

* refactoring routes

* fix

* Changed logic for determining which text files can be attached

* dix dir name

* add meta for norobots (aws-samples#420)

LGTM!

* update componentize attachment icons

* remove unnecessary function definitions

* fixed lint suggestion

* update alert message transition

* update alert to useSnackbar

* update variable name

* fixed lint suggestion

* update cdk version (aws-samples#422)

* add skelton

* add slider

* add status sync bot

* add status sync bot

* SwitchBedrockModel

* add toggle

* add tooltip

* update

* fix

* early retrun

* fix

* fix

* fix

* create post streaming status

* fix (aws-samples#425)

* Bump urllib3 from 2.2.1 to 2.2.2 in /backend/embedding (aws-samples#419)

Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.2.1 to 2.2.2.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](urllib3/urllib3@2.2.1...2.2.2)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat: number of NAT gateways is customizable (aws-samples#426)

* NAT Gatewayの数をcdk.jsonでカスタマイズできるようにする

* テストケース修正

* インデント修正

* readme修正

* type修正。NATゲートウェイをNAT Gatewayに表記を統一

* Bump certifi from 2024.6.2 to 2024.7.4 in /backend/embedding (aws-samples#429)

Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.6.2 to 2024.7.4.
- [Commits](certifi/python-certifi@2024.06.02...2024.07.04)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Supports multiple IDPs (aws-samples#404)

* Update index.html

* Supports multiple IDPs

* Bump certifi from 2024.6.2 to 2024.7.4 in /backend (aws-samples#431)

Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.6.2 to 2024.7.4.
- [Commits](certifi/python-certifi@2024.06.02...2024.07.04)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Feat/ipv6 disabled (aws-samples#427)

* add ipv6 disable feature

* update error messages

* update document

* update document

* fixed issues based on review comments

* fix typo in deploy.yml (aws-samples#437)

* Feature: Use a Bedrock Knowledge Base as RAG source (Backend) (aws-samples#428)

* wip

* refactor: apply sfn to invoke ecs task

* wip

* wip

* fix

* fix fe

* fix poetry timoeut

* fix

* s3 validation

* lint

* omit instruction from kb

* lint

* Fix super-easy deployment script (aws-samples#442)

- Fix BuildSpec errors of CodeBuild
  - Escape double quotes properly.
  - Change type of `version` from string to number.
- Change argument name: `--region` to `--bedrock-region`

* Fix: Ensure full visibility of chat input on narrow screens

- Refactor main container to use flex column layout
Fixes aws-samples#445

* fix

* fix

* fix

* fix

* fix routes

* fix

* fix

* fix

* fix

* Add a command line argument `--version` to bin.sh (aws-samples#444)

* Add a command line argument `--version` to bin.sh
- Add a command line argument `--version` to bin.sh.
- Use the specified version as the tag name for git clone.

* Add guidance for super-easy deployment failures

* Reflect review comments for pull request aws-samples#444
- aws-samples#444 (comment)
- aws-samples#444 (comment)

* fix pb

* add (aws-samples#456)

* add (aws-samples#460)

* update(readme): update contributor highlights (aws-samples#462)

[Workflow Run]: https://github.com/aws-samples/bedrock-claude-chat/actions/runs/9990669915

------

*Automatically created by projen via the "upgrade-contributor-highlights" workflow*

Signed-off-by: github-actions <github-actions@github.com>
Co-authored-by: github-actions <github-actions@github.com>

* Fix: contributor highlight workflow (aws-samples#457)

* fix

* including sore when print top 20

* fix: git commit / pr

* comment out for workflow test

* fix: add base branch

* fix index

* fix

* remove test codes

* remove branch condition

* Refactoring with Bedrock Converse API (aws-samples#448)

* refactor

* fix

* chore: lint

* omit validation

* revert top k

* fix: topk

* fix topk diff

* fix: topk max

* lint

* fix (aws-samples#464)

* Allow `Admin` users to create / publish a customized bot (aws-samples#469)

* Add commit hook  (aws-samples#472)

* create lefthook.yml

* update doc

* fix mypy conf

* fix lefthook

* fix lefthook

* split sub

* fix hook

* fix

* remove test

* remove test

* Non-text document upload directly on chat window (aws-samples#467)

* add

* black format

* chore: lint

* chore: variable name consistency (AttachmentType)

* add checking not to excess 10MB which is api gateway response size limit

* merge v1

* chore: eslint deps ignore

* fix: size limit to 6MB

* change: image size

* chore: remove eslint-disabled-line

* fix: size check bug

* Fix: Screen transition occurs due to unintended key input

* Fix: Destination of screen transition by keyboard shortcut when using custom bot

* Refactor detection logic of keyboard shortcuts

* Fix: Focus moves due to unintentional keystrokes

* Move detection logic of 'focus chat input' keyboard shortcut from `Textarea` to `ChatPage`

* Add attribute to `BotSummary` to determine whether the bot using Bedrock KnowledgeBase (aws-samples#480)

* add

* lint

* Upgrade AWS Amplify to version 6
- aws-amplify 6.4.3
- @aws-amplify/ui-react 6.1.14

* Fixed eslint warning 'tailwindcss/enforces-shorthand'

* Bump fast-xml-parser and @aws-sdk/client-secrets-manager

Bumps [fast-xml-parser](https://github.com/NaturalIntelligence/fast-xml-parser) to 4.4.1 and updates ancestor dependency [@aws-sdk/client-secrets-manager](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-secrets-manager). These dependencies need to be updated together.


Updates `fast-xml-parser` from 4.2.5 to 4.4.1
- [Release notes](https://github.com/NaturalIntelligence/fast-xml-parser/releases)
- [Changelog](https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/CHANGELOG.md)
- [Commits](NaturalIntelligence/fast-xml-parser@v4.2.5...v4.4.1)

Updates `@aws-sdk/client-secrets-manager` from 3.576.0 to 3.623.0
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-secrets-manager/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.623.0/clients/client-secrets-manager)

---
updated-dependencies:
- dependency-name: fast-xml-parser
  dependency-type: indirect
- dependency-name: "@aws-sdk/client-secrets-manager"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update AWS Amplify to version 6.4.4

* Add youtube overview video link to README (aws-samples#484)

* add

* fix

* embed

* fix

* Add Ladle stories
Added stories
- Helper
  - Shortcuts
- InputText
  - Text
  - URL
  - Date
  - Number
- ListItemBot
  - MyBots
  - RecentlyUsedSharedBots
  - ApiManagement
  - Analytics
- ModalDialog
  - AddApiKey
  - ClearConversations
  - DeleteApi
  - DeleteApiKey
  - DeleteBot
  - DeleteConversation
  - Feedback
  - InstructionsSamples
  - SelectLanguage
    - Performed refactoring
  - ShareBot
- PopoverMenu
  - ChatHeader
- Progress
- Select
  - Ideal
  - Clearable
- Textarea
  - Ideal
  - NoBorder

Fixed story name
- Skelton -> Skeleton
  - Indeal -> Ideal

* Refactor `ChatPage`, `ChatListDrawer` and related components
`useChat`
- Add `conversationError`
  - Move the error handling code to `ChatPage`
- Remove dependencies
  - `useNavigate`
  - `useTranslation`
  - `useSnackbar`

`ChatMessage`
- Move the action handling code to `ChatPage`
  - Submit feedback
- Move the code to get related documents to `ChatPage`
- Remove dependencies
  - `useChat`

`InputChatContent`
- Move the appearance control code to `ChatPage`
  - hasRegenerate / disabledRegenerate
  - hasContinue / disabledContinue
  - isLoading
- Remove dependencies
  - `useChat`

`TextInputChatContent`
- Move the appearance control code to `ChatPage`
  - hasRegenerate / disabledRegenerate
  - isLoading
- Remove dependencies
  - `useChat`

`ChatListDrawer`
- Move the action handling code to `AppContent`
  - Delete conversation
  - Update conversation title
- Move the appearance control code to `AppContent`
  - isAdmin
- Remove dependencies
  - `useNavigate`
  - `useUser`

`Menu`
- Move the action handling code to `AppContent`
  - Select language
  - Clear conversations
- Remove dependencies
  - `useNavigate`
  - `useConversation`

`AppContent`
- Accept the action handling code from `Menu` and `ChatListDrawer`
  - Select language
  - Clear conversations
  - Delete conversation
  - Update conversation title

`ChatPage`
- Accept the code to get related documents from `ChatMessage`
- Accept the appearance control code from `InputChatContent` and `TextInputChatContent`
- Accept the error handling code from `useChat`

Add Ladle stories
- Agent
  - InputChatContent
  - InputChatContentHasRegenerate
  - ProcessingIndicator
  - Tools
- ChatListDrawer (using msw: mock service wrapper)
  - Admin
  - NonAdmin
- ChatMessage
  - Conversation
- InputChatContent
  - Ideal
  - HasRegenerate
  - HasContinue

* Fix eslint warnings
ChatMessage.tsx
- react-hooks/exhaustive-deps

ListItemBot.stories.tsx
- tailwindcss/enforces-shorthand

* Fixed eslint errors
ChatListDrawer
- Unused eslint-disable directive

ChatMessage
- Unused eslint-disable directive

* Bump aiohttp from 3.9.5 to 3.10.2 in /backend/embedding (aws-samples#487)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.5 to 3.10.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.5...v3.10.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Rename some properties of `InputChatContent`, `TextInputChatContent`
- hasRegenerate -> canRegenerate
- hasContinue -> canContinue

* Return error detail when streaming (aws-samples#489)

* add

* merge

* lint

* Exclude some folders when docker build (aws-samples#473)

* Exclude specific folders with exclude when creating a Docker image

* backendのreadmeにpoetryのinstallを追記

* excludeを共通化

* 不要な修正を削除

* constantsに移動

* Memorize related documents of messages in `ChatPage`.
- Add memorized `ChatMessage` as `ChatMessageWithRelatedDocuments`.

* Refactor `ChatListDrawer` and related components.
`ChatListDrawer`
- Move the code to get bots and conversations to `AppContent`
  - conversations
  - starredBots
  - recentlyUsedUnsterredBots
- Remove dependencies
  - `useConversation`
  - `useBot`

`AppContent`
- Accept the code to get bots and conversations from `ChatListDrawer`
  - conversations
  - starredBots
  - recentlyUsedUnsterredBots

* Bump nltk from 3.8.1 to 3.9 in /backend/embedding (aws-samples#495)

* Bump nltk from 3.8.1 to 3.9 in /backend/embedding

Bumps [nltk](https://github.com/nltk/nltk) from 3.8.1 to 3.9.
- [Changelog](https://github.com/nltk/nltk/blob/develop/ChangeLog)
- [Commits](nltk/nltk@3.8.1...3.9)

---
updated-dependencies:
- dependency-name: nltk
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump nltk from 3.9 to 3.9.1 in /backend/embedding

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Yukinobu Mine <yukimine@amazon.co.jp>

* Bump axios from 1.7.3 to 1.7.4 in /frontend (aws-samples#496)

Bumps [axios](https://github.com/axios/axios) from 1.7.3 to 1.7.4.
- [Release notes](https://github.com/axios/axios/releases)
- [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md)
- [Commits](axios/axios@v1.7.3...v1.7.4)

---
updated-dependencies:
- dependency-name: axios
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Revert "Bump nltk from 3.8.1 to 3.9 in /backend/embedding (aws-samples#495)"

This reverts commit 9fddfc4.

* Fix: Pass the parent's message ID correctly to `trace_to_root()` function. (aws-samples#500)

- app.usecases.chat.chat()
- app.websocket.process_chat_input()

* upgrade unstructured version

* fix: fix error - 2 validation errors for HumanMessage content str type expected (aws-samples#498)

llm returns like this
```
content='SELECT "screenname", "screentype", "playertype", "clienttype", "screenversion", "deviceid", "pairingcode", "state", "osname", "fwver", "appver", "createdtime", "updatedtime", "description", "ipaddress", "subnet", "modelname", "organizationid", "placeid", "location", "playercapabilityversion", "rmcapabilityversion", "agenttype", "playingthumbnailid", "playingcontentid", "playingcontentname", "playingprogramid", "playingprogramname", "resolution", "standbymode", "hwduid", "securekey", "rm", "player"\nFROM public."dms_screen"\nWHERE "screenid" = \'5F-C5-A2-1E-C9-11\'\nLIMIT 10;' additional_kwargs={'usage': {'prompt_tokens': 410, 'completion_tokens': 209, 'total_tokens': 619}, 'stop_reason': 'end_turn', 'model_id': 'anthropic.claude-3-sonnet-20240229-v1:0'} response_metadata={'usage': {'prompt_tokens': 410, 'completion_tokens': 209, 'total_tokens': 619}, 'stop_reason': 'end_turn', 'model_id': 'anthropic.claude-3-sonnet-20240229-v1:0'} id='run-55883457-174d-4d18-a24c-86fc7848b94a-0' usage_metadata={'input_tokens': 410, 'output_tokens': 209, 'total_tokens': 619}
```

That's why following error occured.

```
ValidationError: 2 validation errors for HumanMessage content str type expected (type=type_error.str) content value is not a valid list (type=type_error.list)
```

So I added StrOutputParser() on the llm_chain, and it works

* embeddingコンテナにAmazonECSTaskExecutionRolePolicyのポリシーを追加 (aws-samples#501)

* Bump aws-cdk from 2.147.3 to 2.148.1 in /cdk (aws-samples#506)

Bumps [aws-cdk](https://github.com/aws/aws-cdk/tree/HEAD/packages/aws-cdk) from 2.147.3 to 2.148.1.
- [Release notes](https://github.com/aws/aws-cdk/releases)
- [Changelog](https://github.com/aws/aws-cdk/blob/main/CHANGELOG.v2.md)
- [Commits](https://github.com/aws/aws-cdk/commits/v2.148.1/packages/aws-cdk)

---
updated-dependencies:
- dependency-name: aws-cdk
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump micromatch from 4.0.5 to 4.0.8 in /cdk

Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/micromatch@4.0.5...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* implement BotEditPageV2 with KB supported

* addressed review comments

* revert start and copy link actions to be enabled

* fix eslint warning

* fix build fail

* add kb id

* addressed review comments
- file name change from 'BotEditPageV2' to 'BotKbEditPage'
- add none option for opensearch analyzer
- fix cursor style for Slider disabled state
- send knowledgeBaseId when creation and editing a bot
- change s3 url placeholder value

* commit forgotten changes

* enhance Select component to display description

* add: migration guide

* addressed review comments
- modify resource for opensearch
- send null knowlegeBaseId
- fix hasBedrockKnowledgeBase type

* addressed review comments
- add VITE_APP_ENABLE_KB in .env.template

* fix doc

* fix doc link

* Fix "desciription" typo and automatically load agent tool name and description from language file. (aws-samples#514)

* Fix "desciription" typo
Modify formatDescription.ts so that when new tools are created and the name and description are defined in the language file it will automatically use the specified name and description

* Remove line in AGENT.md saying to update formatDescription.ts
Remove switch statement from formatDescription.ts

* Bump cryptography from 43.0.0 to 43.0.1 in /backend/embedding

Bumps [cryptography](https://github.com/pyca/cryptography) from 43.0.0 to 43.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@43.0.0...43.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump micromatch from 4.0.7 to 4.0.8 in /frontend

Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.7 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/micromatch@4.0.7...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Refactoring: Agent (aws-samples#513)

* refactor: tool

* wip: agent runner

* wip

* completed: agent class

* websocket

* fix

* change: status label

* wip: agent card

* inplemented: frontend

* fix frontend

* remove unused codes and modules

* update poetry lock

* crud thinking log (be)

* wip

* implemented

* reflect fb

* fix style and icon

* enclose card as agent message

* change: prop name as isAgentTHinking

* fix

* avoid re-rendering agent card when scroll

* use pydantic to convert to JSON Schema

* add knowledge tool

* update docs

* chore: lint

* chore: lint

* chore: lint

* fix style

---------

Co-authored-by: Yusuke Wada <wadaysk@amazon.co.jp>

* Bump path-to-regexp from 6.2.2 to 6.3.0 in /frontend (aws-samples#529)

Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) from 6.2.2 to 6.3.0.
- [Release notes](https://github.com/pillarjs/path-to-regexp/releases)
- [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md)
- [Commits](pillarjs/path-to-regexp@v6.2.2...v6.3.0)

---
updated-dependencies:
- dependency-name: path-to-regexp
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update to trigger build

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: github-actions <github-actions@github.com>
Co-authored-by: Takehiro Suzuki <tmgf.15.su@gmail.com>
Co-authored-by: edamame8888 <edamame_8888@yahoo.co.jp>
Co-authored-by: Yusuke Wada <52243855+wadabee@users.noreply.github.com>
Co-authored-by: 2814109 <2814109k@gmail.com>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
Co-authored-by: Kelvin Chan <50619735+khchan123@users.noreply.github.com>
Co-authored-by: Steve Keppeler <keppeler@amazon.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gabriel Koo <hi@gabrielkoo.com>
Co-authored-by: Gabriel Koo <gabriel.koo@macbook>
Co-authored-by: Satoshi Watanabe <watsatos@amazon.co.jp>
Co-authored-by: Taikono-Himazin <kazu@po.harenet.ne.jp>
Co-authored-by: Satoshi Watanabe <94025610+satoxiw@users.noreply.github.com>
Co-authored-by: Kγ0suKε <49641703+k70suK3-k06a7ash1@users.noreply.github.com>
Co-authored-by: fsatsuki <98732283+fsatsuki@users.noreply.github.com>
Co-authored-by: okamoto-aws <140481730+okamoto-aws@users.noreply.github.com>
Co-authored-by: Yukinobu Mine <14157373+Yukinobu-Mine@users.noreply.github.com>
Co-authored-by: mnmn0 <minamino@mobamasu.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions <github-actions@github.com>
Co-authored-by: Yukinobu Mine <yukimine@amazon.co.jp>
Co-authored-by: fsatsuki <fsatsuki@amazon.co.jp>
Co-authored-by: 윤창헌 <drskur@me.com>
Co-authored-by: Chikako Oyanagi <coyanagiaws@gmail.com>
Co-authored-by: Callum Tomkins <65548777+CallumCPP@users.noreply.github.com>
Co-authored-by: Yusuke Wada <wadaysk@amazon.co.jp>
Co-authored-by: Charlie Greenman <charlie.greenman1@gmail.com>
  • Loading branch information
1 parent 0a06cfa commit 9e53809
Show file tree
Hide file tree
Showing 220 changed files with 32,737 additions and 24,700 deletions.
34 changes: 16 additions & 18 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,7 @@ on:
workflow_dispatch: {}

jobs:
black-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
with:
options: "--check --diff"
src: "./backend"
version: "~=22.0"

mypy-type-check:
black-mypy-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -28,12 +18,17 @@ jobs:
python-version: "3.11"
- name: Install dependencies
run: |
pip install -r backend/requirements.txt
pip install mypy==1.9.0
pip install poetry
cd backend
poetry install
- name: Run mypy
run: |
cd backend
mypy --config-file mypy.ini .
poetry run mypy --config-file mypy.ini .
- name: Run black
run: |
cd backend
poetry run black --check .
uvicorn-launch:
runs-on: ubuntu-latest
Expand All @@ -44,13 +39,16 @@ jobs:
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -r backend/requirements.txt
run: |
pip install poetry
cd backend
poetry install
- name: Run Uvicorn
env:
AWS_DEFAULT_REGION: us-east-1
run: |
cd backend
timeout 10s uvicorn app.main:app --host 0.0.0.0 --port 8000 &
timeout 10s poetry run uvicorn app.main:app --host 0.0.0.0 --port 8000 &
sleep 5
curl http://localhost:8000/health
Expand All @@ -62,7 +60,7 @@ jobs:
run: |
cd backend
docker build -t backend .
- name: Build backend/embedding.Dockerfile
- name: Build backend/embedding/Dockerfile
run: |
cd backend
docker build -t embedding -f embedding.Dockerfile .
docker build -t embedding -f embedding/Dockerfile .
11 changes: 8 additions & 3 deletions .github/workflows/deploy-redoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ jobs:

- name: Install dependencies
run: |
pip install -r backend/requirements.txt
pip install poetry
cd backend
poetry install
- name: Set Environment Variables
run: |
Expand All @@ -29,7 +31,7 @@ jobs:
- name: Start FastAPI server
run: |
cd backend
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 &
poetry run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000 &
sleep 10
env:
AWS_REGION: ${{ env.AWS_REGION }}
Expand All @@ -49,7 +51,10 @@ jobs:
- name: Kill FastAPI server
run: |
pkill uvicorn
pids=$(pgrep -f "uvicorn app.main:app")
for pid in $pids; do
kill $pid
done
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
Expand Down
159 changes: 159 additions & 0 deletions .github/workflows/update-contributor-highlights.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
name: Update Contributor Highlights

on:
schedule:
- cron: "0 0 1 * *" # Every Month'
workflow_dispatch:

jobs:
update-highlights:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # All history

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install PyGithub
- name: Calculate highlights
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python <<EOF
import os
from github import Github
from collections import defaultdict
import logging
EXCLUDED_USERS = ["statefb", "wadabee", "Yukinobu-Mine"] # Core maintainers
EXCLUDED_USERS.append("dependabot[bot]") # Dependabot
logging.basicConfig(level=logging.INFO)
def calculate_score(stats):
# Calculate score based on lines changed and number of PRs
WEIGHT_LINES_CHANGED = 0.7
WEIGHT_PRS = 1000
return stats["lines_changed"] * WEIGHT_LINES_CHANGED + stats["prs"] * WEIGHT_PRS
g = Github(os.environ['GITHUB_TOKEN'])
repo = g.get_repo('${{ github.repository }}')
contributors = defaultdict(lambda: {'lines_changed': 0, 'prs': 0})
logging.info("Fetching commits...")
commits = repo.get_commits()
commit_count = 0
for commit in commits:
if commit.author:
stats = commit.stats
contributors[commit.author.login]["lines_changed"] += (
stats.additions + stats.deletions
)
commit_count += 1
if commit_count % 100 == 0:
logging.info(f"Processed {commit_count} commits...")
logging.info("Fetching pull requests...")
prs = repo.get_pulls(state="closed", sort="created", direction="desc")
pr_count = 0
for pr in prs:
if pr.merged and pr.user:
contributors[pr.user.login]["prs"] += 1
pr_count += 1
if pr_count % 10 == 0:
logging.info(f"Processed {pr_count} pull requests...")
logging.info(f"Total pull requests processed: {pr_count}")
logging.info(f"Total contributors: {len(contributors)}")
logging.info("Calculating contributor scores...")
highlighted_contributors = sorted(
contributors.items(), key=lambda x: calculate_score(x[1]), reverse=True
)
logging.info("Top 20 contributors:")
for username, stats in highlighted_contributors[:20]:
score = calculate_score(stats)
logging.info(f"{username}: {stats}, Score: {score}")
PLATINUM_THRESHOLD = 40000
platinum_contributors = [
(username, calculate_score(stats))
for username, stats in highlighted_contributors
if calculate_score(stats) >= PLATINUM_THRESHOLD and username not in EXCLUDED_USERS
]
logging.info(f"Platinum contributors: {platinum_contributors}")
section_title = f"## 🏆 Significant Contributors\n\n"
platinum_md = section_title + "\n".join(
[
f"- [{username}](https://github.com/{username})"
for username, score in platinum_contributors
]
)
readme_path = "README.md"
with open(readme_path, "r") as file:
readme_content = file.read()
start = readme_content.find(section_title)
end = readme_content.find("## Contributors")
# Insert the platinum contributors section between "## Contacts" and "## Contributors"
new_readme_content = (
readme_content[:start]
+ platinum_md
+ "\n\n"
+ readme_content[end:]
)
with open(readme_path, "w") as file:
file.write(new_readme_content)
EOF
- name: Set git identity
run: |-
git config user.name "github-actions"
git config user.email "github-actions@github.com"
- name: Create Pull Request
id: create-pr
uses: peter-evans/create-pull-request@b1ddad2c994a25fbc81a28b3ec0e368bb2021c50
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: |-
update(readme): update contributor highlights
[Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
------
*Automatically created by projen via the "upgrade-contributor-highlights" workflow*
branch: github-actions/update-contributor-highlights
title: "update(readme): update contributor highlights"
body: |-
update(readme): update contributor highlights
[Workflow Run]: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
------
*Automatically created by projen via the "upgrade-contributor-highlights" workflow*
author: github-actions <github-actions@github.com>
committer: github-actions <github-actions@github.com>
signoff: true
base: v1
50 changes: 42 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

![](https://github.com/aws-samples/bedrock-claude-chat/actions/workflows/cdk.yml/badge.svg)

> [!Warning]
> A major update to v2 is planned soon. v2 will not be backward compatible with v1, and **existing RAG bots will no longer be usable.** For more details, please refer to the [migration guide](./docs/migration/V1_TO_V2.md).
> [!Warning]
> If you are using old version (e.g. `v0.4.x`) and wish to use the latest version, refer [migration guide](./docs/migration/V0_TO_V1.md). Without any care, **ALL DATA IN Aurora cluster WILL BE DESTROYED, and NO LONGER USERS CANNOT USE EXISTING BOTS WITH KNOWLEDGE AND CREATE NEW BOTS**.
This repository is a sample chatbot using the Anthropic company's LLM [Claude](https://www.anthropic.com/), one of the foundational models provided by [Amazon Bedrock](https://aws.amazon.com/bedrock/) for generative AI.

### Watch Overview and Installation on YouTube

[![Overview](https://img.youtube.com/vi/EfgyAblrEQA/0.jpg)](https://youtu.be/EfgyAblrEQA?si=cxxYxF6m0n85AoHb)

### Basic Conversation

Not only text but also images are available with [Anthropic's Claude 3](https://www.anthropic.com/news/claude-3-family). Currently we support `Haiku`, `Sonnet` and `Opus`.
Expand All @@ -26,15 +33,26 @@ Add your own instruction and give external knowledge as URL or files (a.k.a [RAG
### Administrator dashboard

<details>
<summary>Administrator dashboard</summary>

Analyze usage for each user / bot on administrator dashboard. [detail](./docs/ADMINISTRATOR.md)

![](./docs/imgs/admin_bot_analytics.png)

</details>

### LLM-powered Agent

<details>
<summary>LLM-powered Agent</summary>

By using the [Agent functionality](./docs/AGENT.md), your chatbot can automatically handle more complex tasks. For example, to answer a user's question, the Agent can retrieve necessary information from external tools or break down the task into multiple steps for processing.

![](./docs/imgs/agent.gif)
![](./docs/imgs/agent1.png)
![](./docs/imgs/agent2.png)

</details>

## 📚 Supported Languages

Expand All @@ -49,7 +67,7 @@ By using the [Agent functionality](./docs/AGENT.md), your chatbot can automatica

## 🚀 Super-easy Deployment

- In the us-east-1 region, open [Bedrock Model access](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess) > `Manage model access` > Check `Anthropic / Claude 3 Haiku`, `Anthropic / Claude 3 Sonnet` and `Cohere / Embed Multilingual` then `Save changes`.
- In the us-east-1 region, open [Bedrock Model access](https://us-east-1.console.aws.amazon.com/bedrock/home?region=us-east-1#/modelaccess) > `Manage model access` > Check `Anthropic / Claude 3 Haiku`, `Anthropic / Claude 3 Sonnet`, `Anthropic / Claude 3.5 Sonnet` and `Cohere / Embed Multilingual` then `Save changes`.

<details>
<summary>Screenshot</summary>
Expand All @@ -59,7 +77,7 @@ By using the [Agent functionality](./docs/AGENT.md), your chatbot can automatica
</details>

- Open [CloudShell](https://console.aws.amazon.com/cloudshell/home) at the region where you want to deploy
- Run deployment via following commands
- Run deployment via following commands. If you want to specify the version to deploy or need to apply security policies, please specify the appropriate parameters from [Optional Parameters](#optional-parameters).

```sh
git clone https://github.com/aws-samples/bedrock-claude-chat.git
Expand All @@ -68,23 +86,24 @@ chmod +x bin.sh
./bin.sh
```

- You will be asked if a new user or using v1. If so, enter `y`.
- After about 30 minutes, you will get the following output, which you can access from your browser
- You will be asked if a new user or using v1. If you are not a continuing user from v0, please enter `y`.

### Optional Parameters

You can now specify the following parameters during deployment to enhance security and customization:
You can specify the following parameters during deployment to enhance security and customization:

- **--disable-self-register**: Disable self-registration (default: enabled). If this flag is set, you will need to create all users on cognito and it will not allow users to self register their accounts.
- **--ipv4-ranges**: Comma-separated list of allowed IPv4 ranges. (default: allow all ipv4 addresses)
- **--ipv6-ranges**: Comma-separated list of allowed IPv6 ranges. (default: allow all ipv6 addresses)
- **--disable-ipv6**: Disable connections over IPv6. (default: enabled)
- **--allowed-signup-email-domains**: Comma-separated list of allowed email domains for sign-up. (default: no domain restriction)
- **--bedrock-region**: Define the region where bedrock is available. (default: us-east-1)
- **--version**: The version of Bedrock Claude Chat to deploy. (default: latest version in development)

#### Example command with parameters:

```sh
./bin.sh --disable-self-register --ipv4-ranges "192.0.2.0/25,192.0.2.128/25" --ipv6-ranges "2001:db8:1:2::/64,2001:db8:1:3::/64" --allowed-signup-email-domains "example.com,anotherexample.com" --bedrock-region "us-west-2"
./bin.sh --disable-self-register --ipv4-ranges "192.0.2.0/25,192.0.2.128/25" --ipv6-ranges "2001:db8:1:2::/64,2001:db8:1:3::/64" --allowed-signup-email-domains "example.com,anotherexample.com" --bedrock-region "us-west-2" --version "v1.2.6"
```

- After about 35 minutes, you will get the following output, which you can access from your browser
Expand All @@ -98,7 +117,10 @@ Frontend URL: https://xxxxxxxxx.cloudfront.net
The sign-up screen will appear as shown above, where you can register your email and log in.

> [!Important]
> This deployment method allows anyone with the URL to sign up if optional parameters are not configured. For production use, we strongly recommend adding IP address restrictions and disabling self-signup to mitigate security risks (Defining the `allowed-signup-email-domains` to allow only your emails from your comapny domain to be able to sing-up to restrict the users). For ip address restriction use both `ipv4-ranges` and `ipv6-ranges` and to disable self-signup use `disable-self-register` when executing `./bin`.
> Without setting the optional parameter, this deployment method allows anyone who knows the URL to sign up. For production use, it is strongly recommended to add IP address restrictions and disable self-signup to mitigate security risks (you can define allowed-signup-email-domains to restrict users so that only email addresses from your company’s domain can sign up). Use both ipv4-ranges and ipv6-ranges for IP address restrictions, and disable self-signup by using disable-self-register when executing ./bin.
> [!TIP]
> If the `Frontend URL` does not appear or Bedrock Claude Chat does not work properly, it may be a problem with the latest version. In this case, please add `--version "v1.2.6"` to the parameters and try deployment again.
## Architecture

Expand Down Expand Up @@ -251,6 +273,14 @@ By default, this sample does not restrict the domains for sign-up email addresse
"allowedSignUpEmailDomains": ["example.com"],
```

### Customize Number of NAT Gateway

By default, this sample deploys 2 NAT gateways, but you can change the number of NAT gateways if you don't need 2 NAT gateways to reduce costs. Open `cdk.json` and change this parameter 'number of NAT gateways'.

```ts
"natgatewayCount": 2
```

### External Identity Provider

This sample supports external identity provider. Currently we support [Google](./docs/idp/SET_UP_GOOGLE.md) and [custom OIDC provider](./docs/idp/SET_UP_CUSTOM_OIDC.md).
Expand Down Expand Up @@ -296,6 +326,10 @@ See [here](./docs/RAG.md).
- [Yusuke Wada](https://github.com/wadabee)
- [Yukinobu Mine](https://github.com/Yukinobu-Mine)

## 🏆 Significant Contributors

- [k70suK3-k06a7ash1](https://github.com/k70suK3-k06a7ash1)

## Contributors

[![bedrock claude chat contributors](https://contrib.rocks/image?repo=aws-samples/bedrock-claude-chat&max=1000)](https://github.com/aws-samples/bedrock-claude-chat/graphs/contributors)
Expand Down
Loading

0 comments on commit 9e53809

Please sign in to comment.