File tree Expand file tree Collapse file tree
lib/idp_common_pkg/idp_common/bedrock Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -296,10 +296,7 @@ def invoke_model(
296296 inference_config ["maxTokens" ] = max_tokens
297297
298298 # Add additional model fields if needed
299- additional_model_fields = {}
300-
301- # Initialize use_model_id early to avoid UnboundLocalError
302- use_model_id = model_id
299+ additional_model_fields = {}
303300
304301 # Handle top_k parameter
305302 if top_k is not None :
@@ -331,6 +328,7 @@ def invoke_model(
331328 additional_model_fields ["inferenceConfig" ]["topK" ] = int (top_k )
332329
333330 # Add 1M context headers if needed
331+ use_model_id = model_id
334332 if model_id and model_id .endswith (':1m' ):
335333 use_model_id = model_id [:- 3 ] # Remove ':1m'
336334 if additional_model_fields is None :
@@ -458,7 +456,7 @@ def _invoke_with_retry(
458456 response_with_metering = {
459457 "response" : response ,
460458 "metering" : {
461- f"{ context } /bedrock/{ 'modelId' } " : {
459+ f"{ context } /bedrock/{ model_id } " : {
462460 ** usage
463461 }
464462 }
You can’t perform that action at this time.
0 commit comments