Skip to content

Commit 6990ccc

Browse files
authored
Merge pull request #222 from awslabs/fix/update-aoss-resources
2 parents be63a86 + d15ed3c commit 6990ccc

File tree

4 files changed

+18
-12
lines changed
  • lambda
    • aws-qa-appsync-opensearch/question_answering/src/qa_agent
    • aws-rag-appsync-stepfn-opensearch/embeddings_job/src
  • src/patterns/gen-ai

4 files changed

+18
-12
lines changed

lambda/aws-qa-appsync-opensearch/question_answering/src/qa_agent/helper.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,10 @@ def load_vector_db_opensearch(region: str,
109109
)
110110
embedding_function = get_embeddings_llm()
111111

112+
opensearch_url = opensearch_domain_endpoint if opensearch_domain_endpoint.startswith("https://") else f"https://{opensearch_domain_endpoint}"
112113
vector_db = OpenSearchVectorSearch(index_name=opensearch_index,
113114
embedding_function=embedding_function,
114-
opensearch_url=f"https://{opensearch_domain_endpoint}",
115+
opensearch_url=opensearch_url,
115116
http_auth=http_auth,
116117
use_ssl = True,
117118
verify_certs = True,

lambda/aws-rag-appsync-stepfn-opensearch/embeddings_job/src/lambda.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,15 +150,20 @@ def process_documents_in_aoss(index_exists, shards, http_auth):
150150
},
151151
"mappings": {
152152
"properties": {
153-
"osha_vector": {
154-
"type": "knn_vector",
155-
"dimension": 1536,
156-
"method": {
157-
"engine": "faiss",
158-
"name": "hnsw",
159-
"space_type": "l2"
160-
}
161-
}
153+
"vector_field": {
154+
"type": "knn_vector",
155+
"dimension": 1536,
156+
"method": {
157+
"engine": "nmslib",
158+
"space_type": "cosinesimil",
159+
"name": "hnsw",
160+
"parameters": {},
161+
}
162+
},
163+
"id": {
164+
"type": "text",
165+
"fields": {"keyword": {"type": "keyword", "ignore_above": 256}},
166+
},
162167
}
163168
}
164169
}

src/patterns/gen-ai/aws-qa-appsync-opensearch/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ export class QaAppsyncOpensearch extends Construct {
486486
effect: iam.Effect.ALLOW,
487487
actions: ['aoss:APIAccessAll'],
488488
resources: [
489-
'arn:' + Aws.PARTITION + ':aoss:' + Aws.REGION+':' + Aws.ACCOUNT_ID + ':collection/'+props.openSearchIndexName,
489+
'arn:' + Aws.PARTITION + ':aoss:' + Aws.REGION+':' + Aws.ACCOUNT_ID + ':collection/'+props.existingOpensearchServerlessCollection.attrId,
490490
],
491491
}));
492492
}

src/patterns/gen-ai/aws-rag-appsync-stepfn-opensearch/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ export class RagAppsyncStepfnOpensearch extends Construct {
661661
effect: iam.Effect.ALLOW,
662662
actions: ['aoss:APIAccessAll'],
663663
resources: [
664-
'arn:' + Aws.PARTITION + ':aoss:' + Aws.REGION + ':' + Aws.ACCOUNT_ID + ':collection/' + props.openSearchIndexName,
664+
'arn:' + Aws.PARTITION + ':aoss:' + Aws.REGION + ':' + Aws.ACCOUNT_ID + ':collection/' + props.existingOpensearchServerlessCollection.attrId,
665665
],
666666
}));
667667
}

0 commit comments

Comments
 (0)