-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
50 lines (46 loc) · 2.07 KB
/
app.py
File metadata and controls
50 lines (46 loc) · 2.07 KB
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
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python3
import aws_cdk as cdk
import yaml
from cdk.main import RagChatbotStack
CONFIG_PATH = "./config.yaml"
config = yaml.safe_load(open(CONFIG_PATH))
app = cdk.App()
RagChatbotStack(
app,
"RagChatbotStack",
embeddings_model_id=config["model"]["embedding"],
opensearch_collection_name=config["opensearch_collection_name"],
opensearch_index_name=config["opensearch_index_name"],
chat_model=config["model"]["chat"],
embedding_model=config["model"]["embedding"],
video_text_model_id=config["model"]["video_ingest"],
chat_prompt=config["chat_prompt"],
classifier_model=config["model"]["classifier"],
document_filter_model=config["model"]["document_filter"],
platform_classifier_prompt=config["platform_classifier_prompt"],
document_filter_prompt=config["document_filter_prompt"],
config_path=CONFIG_PATH,
max_concurrency=int(config["max_concurrency"]),
step_function_timeout_hours=int(config["step_function_timeout_hours"]),
chunk_size=config["chunk_size"],
overlap=config["overlap"],
docs_retrieved=int(config["docs_retrieved"]),
docs_after_falloff=int(config["docs_after_falloff"]),
conversation_history_turns=int(config["conversation_history_turns"]),
max_history_characters=int(config["max_history_characters"]),
temperature=float(config["temperature"]),
top_p=float(config["top_p"]),
max_tokens=int(config["max_tokens"]),
api_key_value=config.get("api_key"),
# Custom CloudFront domain (optional — only applied if both fields are set)
frontend_domain_name=config.get("frontend_domain_name"),
frontend_certificate_arn=config.get("frontend_certificate_arn"),
# Cognito SAML auth — only active when enable_saml_auth: true in config.yaml
**({
"cognito_domain_prefix": config.get("cognito_domain_prefix"),
"saml_idp_name": config.get("saml_idp_name"),
"saml_idp_metadata_url": config.get("saml_idp_metadata_url"),
"saml_attribute_mapping": config.get("saml_attribute_mapping"),
} if config.get("enable_saml_auth") else {}),
)
app.synth()