Skip to content

Commit

Permalink
Merge pull request #169 from athina-ai/vivek/ath-3268-add-support-for…
Browse files Browse the repository at this point in the history
…-new-library-in-custom-code-block

Added support for urllib
  • Loading branch information
vivek-athina authored Feb 12, 2025
2 parents aed793a + 921d632 commit 03d7df1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions athina/steps/code_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def execute(self, input_data: Any) -> Union[Dict[str, Any], None]:
import textdistance
from datetime import datetime
import textstat
import urllib

custom_builtins = safe_builtins.copy()
custom_builtins.update(
Expand Down Expand Up @@ -171,6 +172,7 @@ def execute(self, input_data: Any) -> Union[Dict[str, Any], None]:
"_getitem_": default_guarded_getitem,
"_getiter_": default_guarded_getiter,
"_write_": lambda x: x,
"urllib": urllib,
}
)
# Whitelist of allowed modules
Expand All @@ -182,6 +184,7 @@ def execute(self, input_data: Any) -> Union[Dict[str, Any], None]:
"datetime",
"time",
"textstat",
"urllib",
}

def guarded_import(name, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "athina"
version = "1.7.12"
version = "1.7.13"
description = "Python SDK to configure and run evaluations for your LLM-based application"
authors = ["Shiv Sakhuja <[email protected]>", "Akshat Gupta <[email protected]>", "Vivek Aditya <[email protected]>", "Akhil Bisht <[email protected]>"]
readme = "README.md"
Expand Down

0 comments on commit 03d7df1

Please sign in to comment.