Update app.py
Browse files
app.py
CHANGED
@@ -206,35 +206,7 @@ class BaseGenerator(ABC):
|
|
206 |
strategy: str = "default",
|
207 |
**kwargs
|
208 |
) -> str:
|
209 |
-
|
210 |
-
Generate text based on a given strategy.
|
211 |
-
|
212 |
-
Args:
|
213 |
-
prompt (str): Input prompt for text generation.
|
214 |
-
model_kwargs (Dict[str, Any]): Additional arguments for model generation.
|
215 |
-
strategy (str): The generation strategy to use (default: "default").
|
216 |
-
**kwargs: Additional arguments passed to the strategy.
|
217 |
-
|
218 |
-
Returns:
|
219 |
-
str: Generated text response.
|
220 |
-
|
221 |
-
Raises:
|
222 |
-
ValueError: If the specified strategy is not available.
|
223 |
-
"""
|
224 |
-
# Validate that the strategy exists
|
225 |
-
if strategy not in self.strategies:
|
226 |
-
raise ValueError(f"Unknown strategy: {strategy}. Available strategies are: {list(self.strategies.keys())}")
|
227 |
-
|
228 |
-
# Extract `generator` from kwargs if it exists to prevent duplication
|
229 |
-
kwargs.pop("generator", None)
|
230 |
-
|
231 |
-
# Call the selected strategy with the provided arguments
|
232 |
-
return self.strategies[strategy].generate(
|
233 |
-
generator=self, # The generator instance
|
234 |
-
prompt=prompt, # The input prompt
|
235 |
-
model_kwargs=model_kwargs, # Arguments for the model
|
236 |
-
**kwargs # Any additional strategy-specific arguments
|
237 |
-
)
|
238 |
|
239 |
|
240 |
# strategy.py
|
|
|
206 |
strategy: str = "default",
|
207 |
**kwargs
|
208 |
) -> str:
|
209 |
+
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
210 |
|
211 |
|
212 |
# strategy.py
|