Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 8 additions & 10 deletions mostlyai/mock/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ async def _sample_table(
llm_config: LLMConfig,
config: MockConfig,
progress_callback: Callable[..., Awaitable[None]] | None = None,
batch_size = None,
batch_size=None,
) -> pd.DataFrame:
# provide a default progress callback if none is provided
if progress_callback is None:
Expand Down Expand Up @@ -446,7 +446,6 @@ def _create_table_prompt(
if n_rows is not None:
prompt += f"Number of data rows to {verb}: `{n_rows}`.\n\n"


if target_primary_key is not None:
prompt += f"Add prefix to all values of Target Table Primary Key. The prefix is 'B{batch_idx}-'."
prompt += " There is one exception: if primary keys are in existing data, don't add prefix to them."
Expand Down Expand Up @@ -828,9 +827,8 @@ async def _create_table_rows_generator(
n_workers: int,
llm_config: LLMConfig,
progress_callback: Callable[..., Awaitable[None]] | None = None,
batch_size: int | None = 20, # generate 20 root table rows at a time
batch_size: int | None = 20, # generate 20 root table rows at a time
) -> AsyncGenerator[dict]:

def supports_structured_outputs(model: str) -> bool:
model = model.removeprefix("litellm_proxy/")
supported_params = litellm.get_supported_openai_params(model=model) or []
Expand Down Expand Up @@ -1266,7 +1264,7 @@ async def _sample_common(
n_workers: int = 10,
return_type: Literal["auto", "dict"] = "auto",
progress_callback: Callable[..., Awaitable[None]] | None = None,
batch_size: int | None = None
batch_size: int | None = None,
):
tables: dict[str, TableConfig] = _harmonize_tables(tables, existing_data)
config = MockConfig(tables)
Expand Down Expand Up @@ -1302,7 +1300,7 @@ async def _sample_common(
llm_config=llm_config,
config=config,
progress_callback=progress_callback,
batch_size=batch_size
batch_size=batch_size,
)
data[table_name] = df

Expand All @@ -1327,7 +1325,7 @@ def sample(
n_workers: int = 10,
return_type: Literal["auto", "dict"] = "auto",
progress_callback: Callable[..., Awaitable[None]] | None = None,
batch_size: int | None = None
batch_size: int | None = None,
) -> pd.DataFrame | dict[str, pd.DataFrame]:
"""
Generate synthetic data from scratch or enrich existing data with new columns.
Expand Down Expand Up @@ -1617,7 +1615,7 @@ def sample_common_sync(*args, **kwargs) -> pd.DataFrame | dict[str, pd.DataFrame
n_workers=n_workers,
return_type=return_type,
progress_callback=progress_callback,
batch_size=batch_size
batch_size=batch_size,
)
return future.result()

Expand All @@ -1635,7 +1633,7 @@ async def _asample(
n_workers: int = 10,
return_type: Literal["auto", "dict"] = "auto",
progress_callback: Callable[..., Awaitable[None]] | None = None,
batch_size: int | None = None
batch_size: int | None = None,
) -> pd.DataFrame | dict[str, pd.DataFrame]:
return await _sample_common(
tables=tables,
Expand All @@ -1649,7 +1647,7 @@ async def _asample(
n_workers=n_workers,
return_type=return_type,
progress_callback=progress_callback,
batch_size=batch_size
batch_size=batch_size,
)


Expand Down
Loading