Skip to content

Commit

Permalink
Update codebase to support bedrock
Browse files Browse the repository at this point in the history
  • Loading branch information
John Cordeiro committed Aug 29, 2024
1 parent 574223e commit a908464
Show file tree
Hide file tree
Showing 4 changed files with 1,863 additions and 2,008 deletions.
4 changes: 2 additions & 2 deletions bothub/api/v2/zeroshot/usecases/invoke_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ def _invoke_bedrock(self, prompt):
"prompt": prompt
})

response = bedrock.invoke_model(
bedrock_response = bedrock_runtime.invoke_model(
body=payload,
contentType='application/json',
accept='application/json',
modelId=settings.ZEROSHOT_BEDROCK_MODEL_ID,
trace='ENABLED'
)

classification = json.loads(response['body'].read().decode('utf-8'))
classification = json.loads(bedrock_response['body'].read().decode('utf-8'))

classification_formatter = FormatClassification(classification)
formatted_classification = classification_formatter.get_classification(self.zeroshot_data)
Expand Down
2 changes: 1 addition & 1 deletion bothub/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
ZEROSHOT_TOP_K = (int, 10),
ZEROSHOT_TEMPERATURE = (float, 0.1),
ZEROSHOT_DO_SAMPLE = (bool, False),
ZEROSHOT_STOP = (str, "\n"),
ZEROSHOT_STOP = (list, ["<|end_of_text|>", "<|eot_id|>"]),
ZEROSHOT_MODEL_BACKEND = (str, "runpod"),
)

Expand Down
Loading

0 comments on commit a908464

Please sign in to comment.