Skip to content

Commit

Permalink
fix: Replacing unsafe eval() with json.loads() (#1890)
Browse files Browse the repository at this point in the history
  • Loading branch information
retr0reg authored Apr 30, 2024
1 parent e21bf20 commit 9d0d614
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion private_gpt/components/llm/custom/sagemaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ def complete(self, prompt: str, **kwargs: Any) -> CompletionResponse:

response_body = resp["Body"]
response_str = response_body.read().decode("utf-8")
response_dict = eval(response_str)
response_dict = json.loads(response_str)

return CompletionResponse(
text=response_dict[0]["generated_text"][len(prompt) :], raw=resp
Expand Down

0 comments on commit 9d0d614

Please sign in to comment.