forked from stanfordnlp/dspy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5a2c714
commit c26d5ba
Showing
8 changed files
with
113 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,22 @@ | ||
from typing import Optional, Union | ||
|
||
from pydantic import BaseModel, field_validator | ||
|
||
import dspy | ||
|
||
from typing import Optional, Any | ||
from pydantic import BaseModel, model_validator | ||
|
||
class SynthesizerArguments(BaseModel): | ||
# [TODO] | ||
feedback_mode: Optional[str] = None | ||
num_example_for_feedback: Optional[int] = None | ||
|
||
input_lm_model: Optional[dspy.LM] = None | ||
output_lm_model: Optional[dspy.LM] = None | ||
output_teacher_module: Optional[Union[dspy.Module, dspy.Predict]] = None | ||
input_lm_model: Optional[Any] = None | ||
output_lm_model: Optional[Any] = None | ||
output_teacher_module: Optional[Any] = None | ||
|
||
num_example_for_optim: Optional[int] = None | ||
|
||
@field_validator(fields=["feedback_mode", "num_example_for_feedback"]) | ||
def validate_feedback_mode(cls, value): | ||
if value and value not in ["human", "llm"]: | ||
@model_validator(mode='after') | ||
def validate_feedback_mode(self): | ||
if self.feedback_mode and self.feedback_mode not in ["human", "llm"]: | ||
raise ValueError("Feedback mode should be either 'human' or 'llm'.") | ||
|
||
if value and not cls.num_example_for_feedback: | ||
if self.feedback_mode and not self.num_example_for_feedback: | ||
raise ValueError("Number of examples for feedback is required when feedback mode is provided.") | ||
|
||
return value | ||
return self |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
INPUT_GENERATION_TASK_WITH_EXAMPLES_SUFFIX = """\n\nI'll also be providing you some data I generated before hand, make sure the data you generate if consistent with task I provided but different from the data I provided in every way possible.""" | ||
|
||
INPUT_GENERATION_TASK_WITH_FEEDBACK_SUFFIX = "\n\nAdditionally, I'll be providing you with feedback on the data you generate, while generating the data make sure to take into account the feedback I provide and try to improve the data you generate based on the feedback I provide." |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters