mirror of
https://github.com/GammaTauAI/reflexion-human-eval
synced 2024-11-11 19:10:53 +00:00
dynamic imports
This commit is contained in:
parent
a427869f1a
commit
e07aa1d253
@ -1,14 +1,14 @@
|
||||
from typing import List
|
||||
|
||||
from .executor_types import ExecuteResult, Executor
|
||||
from .leetcode_env.leetcode_env.utils import SubmissionFormatter
|
||||
|
||||
from .leetcode_env.leetcode_env.environment import LeetCodeEnv
|
||||
from .leetcode_env.leetcode_env.leetcode_types import ProgrammingLanguage, LeetCodeSubmission
|
||||
from .leetcode_env.leetcode_env.utils import id_from_slug
|
||||
|
||||
class LeetExecutor(Executor):
|
||||
from .leetcode_env.leetcode_env.utils import SubmissionFormatter
|
||||
from .leetcode_env.leetcode_env.leetcode_types import ProgrammingLanguage
|
||||
|
||||
def __init__(self, lang: ProgrammingLanguage, executor: Executor, formatter: SubmissionFormatter):
|
||||
from .leetcode_env.leetcode_env.environment import LeetCodeEnv
|
||||
self.lang = lang
|
||||
self.executor = executor
|
||||
self.formatter = formatter
|
||||
@ -18,6 +18,8 @@ class LeetExecutor(Executor):
|
||||
return self.executor.execute(func, tests, timeout)
|
||||
|
||||
def evaluate(self, name: str, func: str, test: str, timeout: int = 5) -> bool:
|
||||
from .leetcode_env.leetcode_env.utils import id_from_slug
|
||||
from .leetcode_env.leetcode_env.leetcode_types import LeetCodeSubmission
|
||||
submission = LeetCodeSubmission(
|
||||
code=self.formatter.to_leetcode(func),
|
||||
lang=self.lang,
|
||||
@ -29,4 +31,3 @@ class LeetExecutor(Executor):
|
||||
_, reward, _, _ = self.env.step(submission)
|
||||
|
||||
return reward
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user