1818from lfx .schema .dataframe import DataFrame
1919
2020
21- class AgenerateComponent (BaseAgenticComponent ):
21+ class SyntheticDataGenerator (BaseAgenticComponent ):
2222 """Generate synthetic data using either example data or a defined schema.
2323
2424 This component creates realistic synthetic data by either:
@@ -69,10 +69,6 @@ class AgenerateComponent(BaseAgenticComponent):
6969 IntInput (
7070 name = "batch_size" ,
7171 display_name = "Number of Rows to Generate" ,
72- info = (
73- "Number of new synthetic rows to generate. When an Input Table is provided, "
74- "the generated rows are appended to the original data."
75- ),
7672 value = 10 ,
7773 advanced = False ,
7874 ),
@@ -106,12 +102,12 @@ async def aGenerate(self) -> DataFrame: # noqa: N802
106102 if self .source :
107103 source = AG .from_dataframe (DataFrame (self .source ))
108104 atype = source .atype
109- instructions = str (self .instructions ) if self . instructions else "Generate similar data based on the examples provided."
110- instructions += "\n Here are examples to take inspiration from: \n " + str (source .states [:50 ])
105+ instructions = str (self .instructions )
106+ instructions += "\n Here are examples to take inspiration from" + str (source .states [:50 ])
111107 elif self .schema != []:
112108 schema_fields = build_schema_fields (self .schema )
113109 atype = create_pydantic_model (schema_fields , name = "GeneratedData" )
114- instructions = str (self .instructions ) if self . instructions else "Generate realistic synthetic data following the provided schema."
110+ instructions = str (self .instructions )
115111 else :
116112 msg = "Synthetic data generation requires either a sample DataFrame or schema definition (but not both)."
117113 raise ValueError (msg )
@@ -122,14 +118,9 @@ async def aGenerate(self) -> DataFrame: # noqa: N802
122118 llm = llm ,
123119 instructions = instructions ,
124120 )
125- # Ensure output_states is a list, not None
126- if output_states is None :
127- output_states = []
128-
129- if self .source :
130- output_states = source .states + output_states
131-
132- output = AG (atype = atype , states = output_states )
133-
134- return DataFrame (output .to_dataframe ().to_dict (orient = "records" ))
135-
121+ if output_states :
122+ if self .source :
123+ output_states = source .states + output_states
124+ output = AG (atype = atype , states = output_states )
125+ return DataFrame (output .to_dataframe ().to_dict (orient = "records" ))
126+ return DataFrame ([])
0 commit comments