You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: adalflow/adalflow/core/generator.py
+14-1Lines changed: 14 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -70,11 +70,22 @@ class Generator(GradComponent, CachedEngine, CallbackManager):
70
70
template (Optional[str], optional): The template for the prompt. Defaults to :ref:`DEFAULT_ADALFLOW_SYSTEM_PROMPT<core-default_prompt_template>`.
71
71
prompt_kwargs (Optional[Dict], optional): The preset prompt kwargs to fill in the variables in the prompt. Defaults to None.
72
72
output_processors (Optional[Component], optional): The output processors after model call. It can be a single component or a chained component via ``Sequential``. Defaults to None.
73
+
trainable_params (Optional[List[str]], optional): The list of trainable parameters. Defaults to [].
74
+
Note:
75
+
The output_processors will be applied to the string output of the model completion. And the result will be stored in the data field of the output.
76
+
And we encourage you to only use it to parse the response to data format you will use later.
73
77
name (Optional[str], optional): The name of the generator. Defaults to None.
74
78
cache_path (Optional[str], optional): The path to save the cache. Defaults to None.
75
79
use_cache (bool, optional): Whether to use cache. Defaults to False.
76
80
"""
77
81
82
+
model_type: ModelType=ModelType.LLM
83
+
model_client: ModelClient# for better type checking
84
+
_use_cache: bool=False
85
+
_kwargs: Dict[str, Any] = (
86
+
{}
87
+
) # to create teacher generator from student TODO: might reaccess this
88
+
78
89
def__init__(
79
90
self,
80
91
*,
@@ -90,6 +101,7 @@ def __init__(
90
101
# args for the cache
91
102
cache_path: Optional[str] =None,
92
103
use_cache: bool=False,
104
+
trainable_params: Optional[List[str]] = [],
93
105
) ->None:
94
106
r"""The default prompt is set to the DEFAULT_ADALFLOW_SYSTEM_PROMPT. It has the following variables:
95
107
- task_desc_str
@@ -122,7 +134,6 @@ def __init__(
122
134
CallbackManager.__init__(self)
123
135
124
136
self.name=nameorself.__class__.__name__
125
-
self.model_type=model_client.model_type# Get model type from client
0 commit comments