Skip to content

Commit 909958f

Browse files
authored
Merge pull request #800 from aws-solutions/feature/v7.0.0
Update to version v7.0.0
2 parents a334225 + f2271b1 commit 909958f

File tree

295 files changed

+114146
-41434
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

295 files changed

+114146
-41434
lines changed

.nightswatch/functional/files/import-fail-expected.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
"q": [
3030
"Can I have a question but no answer?"
3131
]
32+
},
33+
{
34+
"a": "Questions/Utterances with over 140 Characters cannot be imported",
35+
"type": "qna",
36+
"qid": "QuestionCharLimit.001",
37+
"q": [
38+
"What will happen if I try to import a .json and/or excel (.xlsx) file containing a question/utterance with over 140 characters like this one?"
39+
]
3240
}
3341
]
3442
}
152 Bytes
Binary file not shown.

.nightswatch/functional/helpers/website_model/edit_page.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ def rebuild_lex(self) -> str:
766766
self.select_sub_menu()
767767
self.operator.select_id(REBUILD_LEX_ID, click=True)
768768

769-
success_status = self.operator.wait_for_element_by_id(REBUILD_LEX_SUCCESS_ID, delay=360).text
769+
success_status = self.operator.wait_for_element_by_id(REBUILD_LEX_SUCCESS_ID, delay=600).text
770770
self.operator.select_id(REBUILD_LEX_CLOSE_ID, click=True)
771771
time.sleep(1)
772772
return success_status

.nightswatch/functional/helpers/website_model/settings_page.py

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@
6565
BEDROCK_GUARDRAIL_VERSION_ID = 'BEDROCK_GUARDRAIL_VERSION'
6666
BEDROCK_GUARDRAIL_SUBGROUP_ID = 'text_generation_guardrail_subgroup'
6767

68+
PREPROCESS_GUARDRAIL_IDENTIFIER_ID = 'PREPROCESS_GUARDRAIL_IDENTIFIER'
69+
PREPROCESS_GUARDRAIL_VERSION_ID = 'PREPROCESS_GUARDRAIL_VERSION'
70+
71+
POSTPROCESS_GUARDRAIL_IDENTIFIER_ID = 'POSTPROCESS_GUARDRAIL_IDENTIFIER'
72+
POSTPROCESS_GUARDRAIL_VERSION_ID = 'POSTPROCESS_GUARDRAIL_VERSION'
73+
6874
class SettingsPage:
6975
"""
7076
Class representing a Settings Page.
@@ -332,7 +338,7 @@ def disable_llm_disambiguation(self):
332338

333339
return self.save_settings()
334340

335-
def enable_bedrock_guardrail(self, region, guardrail_identifier, guardrail_version):
341+
def enable_bedrock_guardrail(self, region, guardrail_identifier, guardrail_version, selector='bedrock'):
336342
"""
337343
Enables the Bedrock guardrail for functional tests based on the nightswatch or local environment.
338344
@@ -347,7 +353,11 @@ def enable_bedrock_guardrail(self, region, guardrail_identifier, guardrail_versi
347353
'us-east-1': ('6wptcgn6mi7x', 2),
348354
'us-west-2': ('nnbn5202wy5g', 2),
349355
'eu-west-2': ('jsj81qgv3ky5', 2),
350-
'ap-northeast-1': ('672yn8u1u3v5', 1)
356+
'ap-northeast-1': ('672yn8u1u3v5', 1),
357+
'ap-southeast-1': ('9svj21mhvizz', 1),
358+
'ap-southeast-2': ('8t3dz616x886', 1),
359+
'ca-central-1': ('vci2abppnly8', 1),
360+
'eu-central-1': ('kxzczv00h33w', 1),
351361
}
352362

353363
if os.getenv('NIGHTSWATCH_TEST_DIR'):
@@ -357,10 +367,25 @@ def enable_bedrock_guardrail(self, region, guardrail_identifier, guardrail_versi
357367
if not guardrail_identifier or not guardrail_version:
358368
return self.save_settings()
359369

360-
get_guardrail_identifier = self.operator.select_id(BEDROCK_GUARDRAIL_IDENTIFIER_ID)
370+
valid_selectors = ['bedrock', 'preprocess', 'postprocess']
371+
372+
if selector not in valid_selectors:
373+
raise ValueError(f"Invalid selector. Must be one of {valid_selectors}")
374+
375+
selector_id = BEDROCK_GUARDRAIL_IDENTIFIER_ID
376+
selector_version_id = BEDROCK_GUARDRAIL_VERSION_ID
377+
378+
if selector == 'preprocess':
379+
selector_id = PREPROCESS_GUARDRAIL_IDENTIFIER_ID
380+
selector_version_id = PREPROCESS_GUARDRAIL_VERSION_ID
381+
if selector == 'postprocess':
382+
selector_id = POSTPROCESS_GUARDRAIL_IDENTIFIER_ID
383+
selector_version_id = POSTPROCESS_GUARDRAIL_VERSION_ID
384+
385+
get_guardrail_identifier = self.operator.select_id(selector_id)
361386
self.__set_element_value(get_guardrail_identifier, guardrail_identifier)
362387

363-
get_guardrail_version = self.operator.select_id(BEDROCK_GUARDRAIL_VERSION_ID)
388+
get_guardrail_version = self.operator.select_id(selector_version_id)
364389
self.__set_element_value(get_guardrail_version, guardrail_version)
365390

366391
return self.save_settings()
@@ -482,12 +507,12 @@ def enable_kb_advanced(self, knowledge_base_model) -> str:
482507

483508
if knowledge_base_model.startswith('anthropic'):
484509
self.__set_element_value(kb_search_type, 'HYBRID')
485-
self.__set_element_value(kb_max_results, 3)
486-
self.__set_element_value(kb_model_params, '{"temperature": 0.3, "maxTokens": 245, "topP": 0.9, "top_k": 240 }')
510+
self.__set_element_value(kb_max_results, 4)
511+
self.__set_element_value(kb_model_params, '{"temperature": 0.1, "maxTokens": 300, "topP": 0.9, "top_k": 240 }')
487512
else:
488513
self.__set_element_value(kb_search_type, 'HYBRID')
489514
self.__set_element_value(kb_max_results, 5)
490-
self.__set_element_value(kb_model_params, '{"temperature": 0.1, "maxTokens": 264, "topP": 0.9 }')
515+
self.__set_element_value(kb_model_params, '{"temperature": 0.1, "maxTokens": 300, "topP": 0.9 }')
491516

492517

493518
return self.save_settings()
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"qna": [
3+
{
4+
"a": "The credit card is 1111-1111-1111-1111",
5+
"type": "qna",
6+
"qid": "Guardrail.001",
7+
"q": [
8+
"Is their a credit card number stored in your database?"
9+
]
10+
}
11+
]
12+
}

0 commit comments

Comments
 (0)