Skip to main content
Version: 25.9

snorkelai.sdk.client.synthetic.augment_data

snorkelai.sdk.client.synthetic.augment_data(data, model_name, runs_per_prompt=1, prompt='Rewrite the following text whilst retaining the core meaning.', sync=True, **fm_hyperparameters)

Augment each row of the data by the number of times specified and return a dataframe with the synthetic data as an additional column.

Parameters

NameTypeDefaultInfo
dataUnion[List[str], str]The data to augment.
model_namestrThe name of the foundation model to use.
runs_per_promptint1The number of times to augment each row.
promptstr'Rewrite the following text whilst retaining the core meaning.'The prompt prefix to send to the foundation model together with each row.
syncboolTrueWhether to wait for the job to complete before returning the result.
fm_hyperparametersAnyAdditional keyword arguments to pass to the foundation model such as temperature, max_tokens, etc.

Return type

Union[DataFrame, str]

Returns

  • df – Dataframe containing the augmentations for the data points.

  • job_id – The job id of the augment data job which can be used to monitor progress with sai.poll_job_status(job_id).

Examples

>>> sai.augment_data(["hello, how can I help you?", "sorry that is not possible"], "openai/gpt-4")
| text | generated_text | perplexity
--------------------------------------------------------------------------------------------------------------
0 | hello, how can I help you? | welcome, ask me a question to get started | 0.0113636364
1 | sorry that is not possible | unfortunately you cannot do that | 0.8901232123
>>> sai.augment_data(["hello, how can I help you?", "sorry that is not possible"], "openai/gpt-4", runs_per_prompt=2)
| text | generated_text | perplexity
--------------------------------------------------------------------------------------------------------------
0 | hello, how can I help you? | welcome, ask me a question to get started | 0.0113636364
1 | sorry that is not possible | unfortunately you cannot do that | 0.8901232123
0 | hello, how can I help you? | Let me know how to get started. | 0.2313232442
1 | sorry that is not possible | bad luck, you cannot do that. | 0.8313232442