Skip to content

feat(opensearch serverless): analyzer #537

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 10 commits into from
Jul 3, 2024

Conversation

statefb
Copy link
Contributor

@statefb statefb commented Jun 27, 2024

close #536

Add analyzers support for the construct: https://opensearch.org/docs/latest/analyzers/


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of the project license.

@statefb
Copy link
Contributor Author

statefb commented Jun 27, 2024

example usage:

import { bedrock } from "@cdklabs/generative-ai-cdk-constructs";
import {
  CharacterFilterType,
  TokenFilterType,
  TokenizerType,
} from "@cdklabs/generative-ai-cdk-constructs/lib/cdk-lib/opensearchserverless";

const kb = new bedrock.KnowledgeBase(this, "KB", {
    embeddingsModel: bedrock.BedrockFoundationModel.TITAN_EMBED_TEXT_V1,
    instruction:
      "Use this knowledge base to answer questions. Please quote the reference to explain your answers.",
    analyzer: {
      characterFilters: [CharacterFilterType.ICU_NORMALIZER],
      tokenizer: TokenizerType.KUROMOJI_TOKENIZER,
      tokenFilters: [
        TokenFilterType.KUROMOJI_BASEFORM,
        TokenFilterType.JA_STOP,
      ],
    }
)

@statefb statefb marked this pull request as ready for review July 1, 2024 11:53
@krokoko
Copy link
Collaborator

krokoko commented Jul 2, 2024

Also, could you please update the code snippet here: https://github.com/awslabs/generative-ai-cdk-constructs/blob/main/src/cdk-lib/opensearch-vectorindex/README.md#vector-index with the new analyzer props

@krokoko
Copy link
Collaborator

krokoko commented Jul 2, 2024

@krokoko krokoko self-requested a review July 2, 2024 16:06
@krokoko
Copy link
Collaborator

krokoko commented Jul 2, 2024

@krokoko
Copy link
Collaborator

krokoko commented Jul 2, 2024

Great thank you for your contribution @statefb ! I approved, once a second reviewer will approve we will merge

Copy link
Contributor

@dineshSajwan dineshSajwan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@krokoko krokoko merged commit b1205b8 into awslabs:main Jul 3, 2024
11 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(opensearch serverless): (adding analyzer)
4 participants