bedrock-claude-chat icon indicating copy to clipboard operation
bedrock-claude-chat copied to clipboard

[Feature Request] Frontend for Bedrock Knowledge Base

Open statefb opened this issue 1 year ago • 3 comments

#428, #139

Frontend Implementation Policy

Implementation Location

  • Frontend code should be implemented under src/features/bot-kb.

Configuration Options

  • In the cdk.json settings, the useBedrockKnowledgeBaseForRag: bool option will be used to allow the use of either Knowledge Base (KB) or pgvector, but not both.
  • By default, useBedrockKnowledgeBaseForRag is set to false.

UI Switching

  • When useBedrockKnowledgeBaseForRag is true, all knowledge-related UI elements in the bot creation screen will be replaced with those from features/bot-kb.
  • When useBedrockKnowledgeBaseForRag is false, KB features will not be accessible from the frontend.

Future Direction for v2 Release

Changes in v2

  • The default value for useBedrockKnowledgeBaseForRag will be changed to true, and the use of pgvector will be deprecated.
  • After the v2 release, deploying Postgres will be optional, and KB will be the default.
  • If users wish to maintain Postgres, they will need to explicitly specify the option in cdk.json.

Handling of Existing Bots

  • After the v2 release, existing bots will be treated as read-only and cannot be updated or edited.
  • The UI for creating new bots will only utilize KB.

statefb avatar Jul 12 '24 00:07 statefb

Request example:

{
    "id": "kb-test-bot",
    "title": "kb-test-bot",
    "instruction": "",
    "description": "",
    "embeddingParams": null,  // Ignored on KB
    "generationParams": null,
    "searchParams": null,  // Ignored on KB
    "agent": {
        "tools": [
        ]
    },
    "knowledge": {
                    "sourceUrls": [],  // Ignored on KB
                    "sitemapUrls": [],  // Ignored on KB
                    "filenames": [], 
                    "s3Urls": ["s3://example-bucket/1/"] // Newly added. Need to end with slash
                },
    "displayRetrievedChunks": true,  // // Ignored on KB
    "conversationQuickStarters": [],
    "bedrockKnowledgeBase": {  // newly added
        "embeddingsModel": "titan_v1",
        "openSearch": {
            "analyzer": {
                "characterFilters": ["icu_normalizer"],
                "tokenizer": "kuromoji_tokenizer",
                "tokenFilters": [
                    "kuromoji_baseform",
                    "ja_stop"
                ]
            }
        },
        "searchParams": {
            "maxResults": 20,
            "searchType": "hybrid"
        },
        "chunkingStrategy": "fixed_size",
        "maxTokens": 500,
        "overlapPercentage": 10,
    }
}

statefb avatar Jul 12 '24 01:07 statefb

Is there any way to migrate our data from the postgres to the KB once V2 releases, or will data automatically be migrated to the KB and knowledge linked to their respective bots? Or will bots have to be recreated with their 'new' knowledge?

DTheunis avatar Jul 17 '24 10:07 DTheunis

@DTheunis

After the v2 release, existing bots will be treated as read-only and cannot be updated or edited. The UI for creating new bots will only utilize KB.

statefb avatar Jul 22 '24 10:07 statefb