Function: extendDataset()

function extendDataset(params: object): Promise<object[]>;
Defined in: src/utils/datasets.ts:446 Extends a dataset with synthetically generated data based on the provided parameters. This function initiates a dataset extension job, waits for it to complete by polling its status, and then returns the content of the extended dataset.

Parameters

params

The parameters for the synthetic dataset extension request.

count?

number Count Default
10;

data_types?

| null | ( | "General Query" | "Prompt Injection" | "Off-Topic Query" | "Toxic Content in Query" | "Multiple Questions in Query" | "Sexist Content in Query")[] Data Types

examples?

string[] Examples

instructions?

null | string Instructions

prompt?

null | string Prompt

prompt_settings?

{ deployment_name?: null | string; echo?: boolean; frequency_penalty?: number; known_models?: object[]; logprobs?: boolean; max_tokens?: number; model_alias?: string; n?: number; presence_penalty?: number; response_format?: | null | { [key: string]: string; }; stop_sequences?: null | string[]; temperature?: number; tool_choice?: | null | string | { function: { name: string; }; type?: string; }; tools?: null | object[]; top_k?: number; top_logprobs?: number; top_p?: number; } Description Only the model is used.

prompt_settings.deployment_name?

null | string Deployment Name

prompt_settings.echo?

boolean Echo Default
false;

prompt_settings.frequency_penalty?

number Frequency Penalty Default
0;

prompt_settings.known_models?

object[] Known Models

prompt_settings.logprobs?

boolean Logprobs Default
true;

prompt_settings.max_tokens?

number Max Tokens Default
1024;

prompt_settings.model_alias?

string Model Alias Default
gpt - 4.1 - mini;

prompt_settings.n?

number N Default
1;

prompt_settings.presence_penalty?

number Presence Penalty Default
0;

prompt_settings.response_format?

| null | { [key: string]: string; } Response Format

prompt_settings.stop_sequences?

null | string[] Stop Sequences

prompt_settings.temperature?

number Temperature Default
1;

prompt_settings.tool_choice?

| null | string | { function: { name: string; }; type?: string; } Tool Choice

prompt_settings.tools?

null | object[] Tools

prompt_settings.top_k?

number Top K Default
40;

prompt_settings.top_logprobs?

number Top Logprobs Default
5;

prompt_settings.top_p?

number Top P Default
1;

source_dataset?

| null | { dataset_id: string; dataset_version_index?: null | number; row_ids?: null | string[]; }

Returns

Promise<object[]> A promise that resolves with the rows of the extended dataset.

Example

const extended_dataset = await extendDataset({
  prompt_settings: {
    model_alias: "GPT-4o mini",
  },
  prompt:
    "Financial planning assistant that helps clients design an investment strategy.",
  instructions:
    "You are a financial planning assistant that helps clients design an investment strategy.",
  examples: ["I want to invest $1000 per month."],
  data_types: ["Prompt Injection"],
  count: 3,
});
console.log("Extended dataset:", extended_dataset);