Skip to content

Commit 219f773

Browse files
chore: hard codes inference config for test purposes
1 parent b43b70e commit 219f773

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

packages/cdk/resources/BedrockPromptResources.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ User Query: {{user_query}}`
3737
variants: [queryReformulationPromptVariant]
3838
})
3939

40+
// TODO: add inference settings
4041
const ragResponsePromptVariant = PromptVariant.chat({
4142
variantName: "default",
4243
model: claudeSonnetModel,

packages/slackBotFunction/app/services/bedrock.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,17 @@ def query_bedrock(user_query: str, session_id: str = None) -> RetrieveAndGenerat
4747
"guardrailConfiguration": {
4848
"guardrailId": GUARD_RAIL_ID,
4949
"guardrailVersion": GUARD_VERSION,
50-
}
50+
},
51+
"inferenceConfig": {
52+
"textInferenceConfig": {
53+
"temperature": 0,
54+
"topP": 0.9,
55+
"maxTokens": 512,
56+
"stopSequences": [
57+
"Human:",
58+
],
59+
}
60+
},
5161
},
5262
},
5363
},

packages/slackBotFunction/app/services/prompt_loader.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ def load_prompt(prompt_name: str, prompt_version: str = None) -> str:
9797
response = client.get_prompt(promptIdentifier=prompt_id)
9898

9999
template_config = response["variants"][0]["templateConfiguration"]
100+
# TODO: derive actual inference config then pass it along with prompt text to the retrieve_and_generate call
101+
# so that all settings from the prompt management are applied directly from the cdk
102+
# inference_config = response["variants"][0]["inferenceConfiguration"]
103+
100104
prompt_text = _render_prompt(template_config)
101105
actual_version = response.get("version", "DRAFT")
102106

0 commit comments

Comments
 (0)