-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathknowledge_base.tf
39 lines (33 loc) · 1.08 KB
/
knowledge_base.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
resource "aws_bedrockagent_knowledge_base" "bedrock" {
name = "bedrock"
role_arn = aws_iam_role.bedrock.arn
knowledge_base_configuration {
vector_knowledge_base_configuration {
embedding_model_arn = data.aws_bedrock_foundation_model.embeddings.model_arn
}
type = "VECTOR"
}
storage_configuration {
type = "OPENSEARCH_SERVERLESS"
opensearch_serverless_configuration {
collection_arn = aws_opensearchserverless_collection.bedrock.arn
vector_index_name = var.vector_index
field_mapping {
vector_field = var.vector_field
text_field = "AMAZON_BEDROCK_TEXT_CHUNK"
metadata_field = "AMAZON_BEDROCK_METADATA"
}
}
}
depends_on = [
aws_iam_role_policy.bedrock,
opensearch_index.bedrock,
time_sleep.sleep
]
}
resource "aws_bedrockagent_agent_knowledge_base_association" "bedrock" {
agent_id = aws_bedrockagent_agent.bedrock.id
description = "Knowledge Base"
knowledge_base_id = aws_bedrockagent_knowledge_base.bedrock.id
knowledge_base_state = "ENABLED"
}