Refactor and update structure #20
@@ -90,7 +90,7 @@ class AppModels(Enum):
|
|||||||
|
|
||||||
|
|
|||||||
raise ValueError(f"Modello non supportato: {self}")
|
raise ValueError(f"Modello non supportato: {self}")
|
||||||
|
|
||||||
def get_agent(self, instructions: str, name: str = "", output: BaseModel | None = None, tools: list[Toolkit] = []) -> Agent:
|
def get_agent(self, instructions: str, name: str = "", output_schema: type[BaseModel] | None = None, tools: list[Toolkit] = []) -> Agent:
|
||||||
"""
|
"""
|
||||||
Costruisce un agente con il modello e le istruzioni specificate.
|
Costruisce un agente con il modello e le istruzioni specificate.
|
||||||
Args:
|
Args:
|
||||||
@@ -106,5 +106,5 @@ class AppModels(Enum):
|
|||||||
retries=2,
|
retries=2,
|
||||||
tools=tools,
|
tools=tools,
|
||||||
delay_between_retries=5, # seconds
|
delay_between_retries=5, # seconds
|
||||||
output_schema=output.__class__ if output else None # se si usa uno schema di output, lo si passa qui
|
output_schema=output_schema
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class Pipeline:
|
|||||||
model = self.available_models[index]
|
model = self.available_models[index]
|
||||||
self.predictor = model.get_agent(
|
self.predictor = model.get_agent(
|
||||||
PREDICTOR_INSTRUCTIONS,
|
PREDICTOR_INSTRUCTIONS,
|
||||||
output=PredictorOutput, # type: ignore
|
output_schema=PredictorOutput,
|
||||||
)
|
)
|
||||||
|
|
||||||
def choose_style(self, index: int):
|
def choose_style(self, index: int):
|
||||||
|
|||||||
Reference in New Issue
Block a user
Using mutable default argument 'tools: list[Toolkit] = []' can lead to unexpected behavior. Use 'tools: list[Toolkit] | None = None' and handle None inside the method.