get config default for sandbox (#3508)

Co-authored-by: miendinh <miendinh@users.noreply.github.com>
This commit is contained in:
miendinhandmiendinh authored and GitHub committed 2024-04-16 13:36:28 +08:00
1 parent fbd3ef8752
commit b9fbc39754
2 files changed
+6 -5

No files matched your search

@@ -1,17 +1,17 @@
from os import environ
from typing import Literal, Optional
from httpx import post
from pydantic import BaseModel
from yarl import URL
from config import get_env
from core.helper.code_executor.javascript_transformer import NodeJsTemplateTransformer
from core.helper.code_executor.jina2_transformer import Jinja2TemplateTransformer
from core.helper.code_executor.python_transformer import PythonTemplateTransformer
# Code Executor
CODE_EXECUTION_ENDPOINT = environ.get('CODE_EXECUTION_ENDPOINT', '')
CODE_EXECUTION_API_KEY = environ.get('CODE_EXECUTION_API_KEY', '')
CODE_EXECUTION_ENDPOINT = get_env('CODE_EXECUTION_ENDPOINT')
CODE_EXECUTION_API_KEY = get_env('CODE_EXECUTION_API_KEY')
CODE_EXECUTION_TIMEOUT= (10, 60)
@@ -27,6 +27,7 @@ class CodeExecutionResponse(BaseModel):
message: str
data: Data
class CodeExecutor:
@classmethod
def execute_code(cls, language: Literal['python3', 'javascript', 'jinja2'], code: str, inputs: dict) -> dict: