From 89b06ca4f639a817f6b24621ce3a7598250361df Mon Sep 17 00:00:00 2001 From: sarthak Date: Tue, 31 Mar 2026 16:24:50 +0530 Subject: [PATCH 1/4] adding create dataset api --- src/lib/api-navigation.ts | 6 + src/lib/navigation.ts | 6 + .../docs/api/datasets/create-dataset.mdx | 155 ++++++++++++++++++ 3 files changed, 167 insertions(+) create mode 100644 src/pages/docs/api/datasets/create-dataset.mdx diff --git a/src/lib/api-navigation.ts b/src/lib/api-navigation.ts index 8c240fc9..a005cf95 100644 --- a/src/lib/api-navigation.ts +++ b/src/lib/api-navigation.ts @@ -144,6 +144,12 @@ export const apiNavigation: ApiNavGroup[] = [ } ] }, + { + "title": "Datasets", + "items": [ + { "title": "Create Dataset", "href": "/docs/api/datasets/create-dataset", "method": "POST" } + ] + }, { "title": "Annotation Scores", "items": [ diff --git a/src/lib/navigation.ts b/src/lib/navigation.ts index 6ee592df..e1e9f973 100644 --- a/src/lib/navigation.ts +++ b/src/lib/navigation.ts @@ -817,6 +817,12 @@ export const tabNavigation: NavTab[] = [ { title: 'Execute Run Test', href: '/docs/api/run-tests/executeruntest' }, ] }, + { + title: 'Datasets', + items: [ + { title: 'Create Dataset', href: '/docs/api/datasets/create-dataset' }, + ] + }, { title: 'Annotation Scores', items: [ diff --git a/src/pages/docs/api/datasets/create-dataset.mdx b/src/pages/docs/api/datasets/create-dataset.mdx new file mode 100644 index 00000000..8dc553b5 --- /dev/null +++ b/src/pages/docs/api/datasets/create-dataset.mdx @@ -0,0 +1,155 @@ +--- +title: "Create Dataset" +description: "Create a new dataset with rows and columns in your organization." +--- + +# Create Dataset + +Create a new dataset with a specified number of rows and columns for evaluation, testing, or data management. + + + +## Authentication + +All requests require authentication via API keys: + +| Header | Description | +|--------|-------------| +| `Authorization` | Bearer token with your API key | + +```bash +Authorization: Bearer YOUR_API_KEY +``` + +## Request Body + + + Name for the dataset. Must be unique within your organization. Maximum 2000 characters. + + + + Number of rows to create. Must be between 1 and 100. + + + + Number of columns to create. Must be between 1 and 100. Columns are created with default names (`Column 1`, `Column 2`, etc.) and `text` data type. + + +### Example + +```json +{ + "dataset_name": "My Evaluation Dataset", + "number_of_rows": 10, + "number_of_columns": 3 +} +``` + +## Response + +Returns the created dataset details. + +Confirmation message. Example: `Dataset created successfully`. +UUID of the newly created dataset. +Number of rows created in the dataset. +Number of columns created in the dataset. + +### Example Response + +```json +{ + "message": "Dataset created successfully", + "dataset_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "rows_created": 10, + "columns_created": 3 +} +``` + +## Responses + +### 200 + +Dataset created successfully. Returns the dataset ID, rows created, and columns created. + +### 400 + +Bad request. Possible reasons: + +- **Missing dataset name** - `dataset_name` is required. +- **Duplicate name** - A dataset with this name already exists in your organization. +- **Invalid row or column count** - `number_of_rows` and `number_of_columns` must be positive integers between 1 and 100. +- **Invalid number format** - The provided values are not valid integers. + +### 401 + +Authentication credentials were not provided or are invalid. + +### 429 + +Resource limit reached. Your organization has exceeded the dataset creation or row addition quota. + +### 500 + +Internal server error. Failed to create the dataset. + +## Code Examples + + +```python Python +import requests + +url = "https://api.futureagi.com/model-hub/develops/create-dataset-manually/" +headers = { + "Authorization": "Bearer YOUR_API_KEY", + "Content-Type": "application/json" +} +data = { + "dataset_name": "My Evaluation Dataset", + "number_of_rows": 10, + "number_of_columns": 3 +} + +response = requests.post(url, headers=headers, json=data) +print(response.json()) +``` +```typescript TypeScript +const response = await fetch( + "https://api.futureagi.com/model-hub/develops/create-dataset-manually/", + { + method: "POST", + headers: { + "Authorization": "Bearer YOUR_API_KEY", + "Content-Type": "application/json" + }, + body: JSON.stringify({ + dataset_name: "My Evaluation Dataset", + number_of_rows: 10, + number_of_columns: 3 + }) + } +); + +const data = await response.json(); +console.log(data); +``` +```bash cURL +curl -X POST "https://api.futureagi.com/model-hub/develops/create-dataset-manually/" \ + -H "Authorization: Bearer YOUR_API_KEY" \ + -H "Content-Type: application/json" \ + -d '{ + "dataset_name": "My Evaluation Dataset", + "number_of_rows": 10, + "number_of_columns": 3 + }' +``` + From 6929681788715b5d6cad81e4be1d757a68684e5c Mon Sep 17 00:00:00 2001 From: sarthak Date: Tue, 31 Mar 2026 17:52:14 +0530 Subject: [PATCH 2/4] added new api- uploading datasset from csv --- src/lib/api-navigation.ts | 3 +- src/lib/navigation.ts | 1 + .../docs/api/datasets/upload-dataset.mdx | 157 ++++++++++++++++++ 3 files changed, 160 insertions(+), 1 deletion(-) create mode 100644 src/pages/docs/api/datasets/upload-dataset.mdx diff --git a/src/lib/api-navigation.ts b/src/lib/api-navigation.ts index a005cf95..d5788c40 100644 --- a/src/lib/api-navigation.ts +++ b/src/lib/api-navigation.ts @@ -147,7 +147,8 @@ export const apiNavigation: ApiNavGroup[] = [ { "title": "Datasets", "items": [ - { "title": "Create Dataset", "href": "/docs/api/datasets/create-dataset", "method": "POST" } + { "title": "Create Dataset", "href": "/docs/api/datasets/create-dataset", "method": "POST" }, + { "title": "Upload Dataset from File", "href": "/docs/api/datasets/upload-dataset", "method": "POST" } ] }, { diff --git a/src/lib/navigation.ts b/src/lib/navigation.ts index e1e9f973..2158a9de 100644 --- a/src/lib/navigation.ts +++ b/src/lib/navigation.ts @@ -821,6 +821,7 @@ export const tabNavigation: NavTab[] = [ title: 'Datasets', items: [ { title: 'Create Dataset', href: '/docs/api/datasets/create-dataset' }, + { title: 'Upload Dataset from File', href: '/docs/api/datasets/upload-dataset' }, ] }, { diff --git a/src/pages/docs/api/datasets/upload-dataset.mdx b/src/pages/docs/api/datasets/upload-dataset.mdx new file mode 100644 index 00000000..04ec9735 --- /dev/null +++ b/src/pages/docs/api/datasets/upload-dataset.mdx @@ -0,0 +1,157 @@ +--- +title: "Upload Dataset from File" +description: "Create a new dataset by uploading a local file." +--- + +# Upload Dataset from File + +Create a new dataset by uploading a file from your local machine. The file is uploaded and processed in the background, automatically detecting columns and data types. + + + +## Authentication + +All requests require authentication via API keys: + +| Header | Description | +|--------|-------------| +| `Authorization` | Bearer token with your API key | + +```bash +Authorization: Bearer YOUR_API_KEY +``` + +## Request Body + +This endpoint accepts `multipart/form-data`. + + + The file to upload. Supported formats: `.csv`, `.xls`, `.xlsx`, `.json`, `.jsonl`. Maximum file size is **10 MB**. + + + + Name for the dataset. Must be unique within your organization. If not provided, the original filename is used as the dataset name. + + + + The model type for the dataset. Defaults to `GenerativeLLM`. One of: `Numeric`, `ScoreCategorical`, `Ranking`, `BinaryClassification`, `Regression`, `ObjectDetection`, `Segmentation`, `GenerativeLLM`, `GenerativeImage`, `GenerativeVideo`, `TTS`, `STT`, `MultiModal`. + + + + Source of the dataset. Defaults to `build`. One of: `build`, `sdk`, `demo`, `observe`. + + +## Response + +Returns the created dataset details. The file is processed asynchronously in the background. + +Confirmation message. Example: `Dataset creation started successfully. Processing in background.` +UUID of the newly created dataset. +Name of the created dataset. +Model type assigned to the dataset. +Current processing status. Initially `queued`. +Estimated number of rows detected in the file. +Estimated number of columns detected in the file. + +### Example Response + +```json +{ + "message": "Dataset creation started successfully. Processing in background.", + "dataset_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890", + "dataset_name": "My Uploaded Dataset", + "dataset_model_type": "GenerativeLLM", + "processing_status": "queued", + "estimated_rows": 150, + "estimated_columns": 5 +} +``` + +## Responses + +### 200 + +Dataset creation started successfully. The file has been uploaded and is being processed in the background. + +### 400 + +Bad request. Possible reasons: + +- **No file uploaded** - The `file` field is required. +- **File too large** - File size exceeds the 10 MB limit. +- **Unsupported file format** - Only `.csv`, `.xls`, `.xlsx`, `.json`, and `.jsonl` files are supported. +- **Duplicate name** - A dataset with this name already exists in your organization. +- **File processing error** - The file could not be parsed. + +### 401 + +Authentication credentials were not provided or are invalid. + +### 429 + +Resource limit reached. Your organization has exceeded the dataset creation or row addition quota. + +### 500 + +Internal server error. Failed to create the dataset from the uploaded file. + +## Code Examples + + +```python Python +import requests + +url = "https://api.futureagi.com/model-hub/develops/create-dataset-from-local-file/" +headers = { + "Authorization": "Bearer YOUR_API_KEY" +} +files = { + "file": ("data.csv", open("data.csv", "rb"), "text/csv") +} +data = { + "new_dataset_name": "My Uploaded Dataset", + "model_type": "GenerativeLLM" +} + +response = requests.post(url, headers=headers, files=files, data=data) +print(response.json()) +``` +```typescript TypeScript +const formData = new FormData(); +formData.append("file", fileInput.files[0]); +formData.append("new_dataset_name", "My Uploaded Dataset"); +formData.append("model_type", "GenerativeLLM"); + +const response = await fetch( + "https://api.futureagi.com/model-hub/develops/create-dataset-from-local-file/", + { + method: "POST", + headers: { + "Authorization": "Bearer YOUR_API_KEY" + }, + body: formData + } +); + +const data = await response.json(); +console.log(data); +``` +```bash cURL +curl -X POST "https://api.futureagi.com/model-hub/develops/create-dataset-from-local-file/" \ + -H "Authorization: Bearer YOUR_API_KEY" \ + -F "file=@data.csv" \ + -F "new_dataset_name=My Uploaded Dataset" \ + -F "model_type=GenerativeLLM" +``` + From 64a42ca1a3b6da55b2e071d3159df373e57576ab Mon Sep 17 00:00:00 2001 From: sarthak Date: Tue, 31 Mar 2026 21:14:54 +0530 Subject: [PATCH 3/4] fixing the auth issue --- src/pages/docs/api/datasets/create-dataset.mdx | 16 ++++++++-------- src/pages/docs/api/datasets/upload-dataset.mdx | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/pages/docs/api/datasets/create-dataset.mdx b/src/pages/docs/api/datasets/create-dataset.mdx index 8dc553b5..3ca48db3 100644 --- a/src/pages/docs/api/datasets/create-dataset.mdx +++ b/src/pages/docs/api/datasets/create-dataset.mdx @@ -25,11 +25,8 @@ All requests require authentication via API keys: | Header | Description | |--------|-------------| -| `Authorization` | Bearer token with your API key | - -```bash -Authorization: Bearer YOUR_API_KEY -``` +| `X-Api-Key` | Your API key | +| `X-Secret-Key` | Your secret key | ## Request Body @@ -110,7 +107,8 @@ import requests url = "https://api.futureagi.com/model-hub/develops/create-dataset-manually/" headers = { - "Authorization": "Bearer YOUR_API_KEY", + "X-Api-Key": "YOUR_API_KEY", + "X-Secret-Key": "YOUR_SECRET_KEY", "Content-Type": "application/json" } data = { @@ -128,7 +126,8 @@ const response = await fetch( { method: "POST", headers: { - "Authorization": "Bearer YOUR_API_KEY", + "X-Api-Key": "YOUR_API_KEY", + "X-Secret-Key": "YOUR_SECRET_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ @@ -144,7 +143,8 @@ console.log(data); ``` ```bash cURL curl -X POST "https://api.futureagi.com/model-hub/develops/create-dataset-manually/" \ - -H "Authorization: Bearer YOUR_API_KEY" \ + -H "X-Api-Key: YOUR_API_KEY" \ + -H "X-Secret-Key: YOUR_SECRET_KEY" \ -H "Content-Type: application/json" \ -d '{ "dataset_name": "My Evaluation Dataset", diff --git a/src/pages/docs/api/datasets/upload-dataset.mdx b/src/pages/docs/api/datasets/upload-dataset.mdx index 04ec9735..759d9b0b 100644 --- a/src/pages/docs/api/datasets/upload-dataset.mdx +++ b/src/pages/docs/api/datasets/upload-dataset.mdx @@ -26,11 +26,8 @@ All requests require authentication via API keys: | Header | Description | |--------|-------------| -| `Authorization` | Bearer token with your API key | - -```bash -Authorization: Bearer YOUR_API_KEY -``` +| `X-Api-Key` | Your API key | +| `X-Secret-Key` | Your secret key | ## Request Body @@ -114,7 +111,8 @@ import requests url = "https://api.futureagi.com/model-hub/develops/create-dataset-from-local-file/" headers = { - "Authorization": "Bearer YOUR_API_KEY" + "X-Api-Key": "YOUR_API_KEY", + "X-Secret-Key": "YOUR_SECRET_KEY" } files = { "file": ("data.csv", open("data.csv", "rb"), "text/csv") @@ -138,7 +136,8 @@ const response = await fetch( { method: "POST", headers: { - "Authorization": "Bearer YOUR_API_KEY" + "X-Api-Key": "YOUR_API_KEY", + "X-Secret-Key": "YOUR_SECRET_KEY" }, body: formData } @@ -149,7 +148,8 @@ console.log(data); ``` ```bash cURL curl -X POST "https://api.futureagi.com/model-hub/develops/create-dataset-from-local-file/" \ - -H "Authorization: Bearer YOUR_API_KEY" \ + -H "X-Api-Key: YOUR_API_KEY" \ + -H "X-Secret-Key: YOUR_SECRET_KEY" \ -F "file=@data.csv" \ -F "new_dataset_name=My Uploaded Dataset" \ -F "model_type=GenerativeLLM" From 2e1d6d716eacb8850a95529849eecf962996320b Mon Sep 17 00:00:00 2001 From: sarthak Date: Wed, 1 Apr 2026 14:34:52 +0530 Subject: [PATCH 4/4] updating auth input format --- src/components/docs/ApiPlayground.astro | 176 ++++++++++++++---- .../createagentdefinition.mdx | 18 +- .../api/agent-versions/createagentversion.mdx | 18 +- .../docs/api/datasets/upload-dataset.mdx | 25 +-- .../docs/api/eval-groups/applyevalgroup.mdx | 18 +- .../docs/api/eval-groups/createevalgroup.mdx | 18 +- .../docs/api/eval-groups/deleteevalgroup.mdx | 18 +- .../docs/api/eval-groups/editevallist.mdx | 18 +- .../docs/api/eval-groups/listevalgroups.mdx | 18 +- .../api/eval-groups/retrieveevalgroup.mdx | 18 +- .../docs/api/eval-groups/updateevalgroup.mdx | 18 +- .../eval-logs-metrics/getevallogdetails.mdx | 18 +- .../docs/api/evals-list/getevalslist.mdx | 18 +- src/pages/docs/api/health/healthcheck.mdx | 9 +- src/pages/docs/api/index.mdx | 9 +- .../docs/api/run-tests/createruntest.mdx | 18 +- .../docs/api/run-tests/executeruntest.mdx | 18 +- .../api/scenarios/addemptyrowstodataset.mdx | 18 +- .../api/scenarios/addscenariorowswithai.mdx | 18 +- .../docs/api/scenarios/createscenario.mdx | 18 +- src/pages/docs/api/scenarios/editscenario.mdx | 18 +- 21 files changed, 345 insertions(+), 180 deletions(-) diff --git a/src/components/docs/ApiPlayground.astro b/src/components/docs/ApiPlayground.astro index 95c8f710..837f86ad 100644 --- a/src/components/docs/ApiPlayground.astro +++ b/src/components/docs/ApiPlayground.astro @@ -20,6 +20,8 @@ interface Props { parameters?: Parameter[]; requestBody?: any; headers?: { name: string; value: string; required?: boolean }[]; + contentType?: 'json' | 'multipart'; + hiddenFields?: Record; } const { @@ -28,9 +30,21 @@ const { baseUrl = 'https://api.futureagi.com', parameters = [], requestBody, - headers = [] + headers = [], + contentType = 'json', + hiddenFields = {} } = Astro.props; +// For multipart forms, separate file fields from text fields +const isMultipart = contentType === 'multipart'; +const multipartFields = isMultipart && requestBody + ? Object.entries(requestBody).map(([key, value]) => ({ + name: key, + isFile: value === '(binary)', + defaultValue: value === '(binary)' ? '' : String(value), + })) + : []; + const methodColors: Record = { GET: { bg: 'bg-emerald-500/10', text: 'text-emerald-500', border: 'border-emerald-500/30' }, POST: { bg: 'bg-blue-500/10', text: 'text-blue-500', border: 'border-blue-500/30' }, @@ -69,21 +83,34 @@ const playgroundId = `playground-${Math.random().toString(36).substr(2, 9)}`;
- +
-
- - Bearer - - +
+
+ + X-Api-Key + + +
+
+ + X-Secret-Key + + +
@@ -139,8 +166,8 @@ const playgroundId = `playground-${Math.random().toString(36).substr(2, 9)}`;
)} - - {requestBody && ( + + {requestBody && !isMultipart && (
)} + + {isMultipart && multipartFields.length > 0 && ( +
+ +
+ {multipartFields.map(field => ( +
+ + {field.name} + {field.isFile && (file)} + + {field.isFile ? ( + + ) : ( + + )} +
+ ))} +
+
+ )} +
@@ -176,7 +240,7 @@ const playgroundId = `playground-${Math.random().toString(36).substr(2, 9)}`;
-