Skip to content

Commit

Permalink
fix: give component code to feature&ens eval
Browse files Browse the repository at this point in the history
  • Loading branch information
XianBW committed Dec 24, 2024
1 parent d2d88d9 commit e8c2d6c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
4 changes: 3 additions & 1 deletion rdagent/components/coder/data_science/ensemble/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ def evaluate(
implementation.inject_files(**{fname: test_code})
stdout = implementation.execute(env=de, entry=f"python {fname}")

system_prompt = T(".prompts:ensemble_eval.system").r(test_code=test_code)
system_prompt = T(".prompts:ensemble_eval.system").r(
test_code=test_code, code=implementation.file_dict["ensemble.py"]
)
user_prompt = T(".prompts:ensemble_eval.user").r(stdout=stdout)

resp = APIBackend().build_messages_and_create_chat_completion(user_prompt, system_prompt, json_mode=True)
Expand Down
13 changes: 11 additions & 2 deletions rdagent/components/coder/data_science/ensemble/prompts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,17 @@ ensemble_coder:
ensemble_eval:
system: |-
You are a data scientist evaluating an ensemble implementation.
You are testing the ensemble with the following code: ```python
{{test_code}} ```
The ensemble code is:
```python
{{code}}
```
You are testing the ensemble with the following code:
```python
{{test_code}}
```
You'll be given the stdout of your testing scripts.
Please respond with your feedback in the following JSON format:
{
Expand Down
4 changes: 3 additions & 1 deletion rdagent/components/coder/data_science/feature/eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ def evaluate(
implementation.inject_files(**{fname: test_code})
stdout = implementation.execute(env=de, entry=f"python {fname}")

system_prompt = T(".prompts:feature_eval.system").r(test_code=test_code)
system_prompt = T(".prompts:feature_eval.system").r(
test_code=test_code, code=implementation.file_dict["feat01.py"]
)
user_prompt = T(".prompts:feature_eval.user").r(stdout=stdout)

resp = APIBackend().build_messages_and_create_chat_completion(user_prompt, system_prompt, json_mode=True)
Expand Down
9 changes: 8 additions & 1 deletion rdagent/components/coder/data_science/feature/prompts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ feature:
feature_eval:
system: |-
You are data scientist.
You are testing the feature processing with the following code
The feature code is:
```python
{{code}}
```
You are testing the feature processing code with the following code
```python
{{test_code}}
```
You'll be given the stdout of your testing scripts.
Please respond with your feedback in the following JSON format and order
```json
Expand Down

0 comments on commit e8c2d6c

Please sign in to comment.