By adding data using the SDK, you can:
- Create new datasets programmatically.
- Add structured data efficiently.
- Automate dataset updates.
- Seamlessly integrate with Future AGI’s data processing pipeline.
1. Accessing the SDK Integration Panel
To add data using the SDK:
- Go to the “Datasets & Experiments” Section
- Navigate to the Datasets page from the main dashboard.
- Click on the “Add Dataset” button.
- Select “Add Data Using SDK”
- A pop-up will appear with various dataset creation methods.
- Choose “Add Data Using SDK” to proceed.
2. Creating a Dataset
- Enter a Dataset Name
- A prompt appears asking for the dataset name.
- Enter a clear, descriptive name
- Click “Next” to proceed.
- Review Dataset Creation Settings
- The interface confirms the dataset setup before proceeding.
- Click “Next” to generate the SDK integration code.
3. Generating SDK Integration Code
- View Pre-Generated Code
- The system generates ready-to-use SDK code in multiple languages:
- The code includes:
- API key authentication.
- Dataset creation command.
- Methods for adding data.
Adding Data using SDK
# pip install futureagi
import os
os.environ["FI_API_KEY"] = "YOUR_FI_API_KEY" # Replace with your actual API key
os.environ["FI_SECRET_KEY"] = "YOUR_FI_SECRET_KEY" # Replace with your actual secret key
from fi.datasets import Dataset
columns = [
{
"name": "text",
"data_type": "text"
},
{
"name": "label",
"data_type": "integer"
}
]
rows = [
{
"cells": [
{
"column_name": "text",
"value": "Hello, world!"
},
{
"column_name": "label",
"value": 0
}
]
}
]
try:
Dataset.add_dataset_columns(dataset_name="dataset-1", columns=columns)
Dataset.add_dataset_rows(dataset_name="dataset-1", rows=rows)
except Exception as e:
print(f"Failed to add data: {e}")
# pip install futureagi
import os
os.environ["FI_API_KEY"] = "YOUR_FI_API_KEY" # Replace with your actual API key
os.environ["FI_SECRET_KEY"] = "YOUR_FI_SECRET_KEY" # Replace with your actual secret key
from fi.datasets import Dataset
columns = [
{
"name": "text",
"data_type": "text"
},
{
"name": "label",
"data_type": "integer"
}
]
rows = [
{
"cells": [
{
"column_name": "text",
"value": "Hello, world!"
},
{
"column_name": "label",
"value": 0
}
]
}
]
try:
Dataset.add_dataset_columns(dataset_name="dataset-1", columns=columns)
Dataset.add_dataset_rows(dataset_name="dataset-1", rows=rows)
except Exception as e:
print(f"Failed to add data: {e}")
const addColumnsRequest = async () => {
const url = `https://api.futureagi.com/model-hub/develops/None/add_columns/`;
const requestBody = {
new_columns_data: [
{
name: "column1",
data_type: "integer",
},
{
name: "column2",
data_type: "text",
},
],
};
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer {accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify(requestBody),
});
const data = await response.json();
return data;
};
addColumnsRequest()
.then((data) => console.log("Columns Added:", data))
.catch((error) => console.error("Error Adding Columns:", error));
const addRowsRequest = async () => {
const url = `https://api.futureagi.com/model-hub/develops/None/add_rows/`;
const requestBody = {
rows: [
{
cells: [
{
column_name: "column1",
value: 0,
},
{
column_name: "column2",
value: 45,
},
],
},
],
};
const response = await fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer {accessToken}`,
"Content-Type": "application/json",
},
body: JSON.stringify(requestBody),
});
const data = await response.json();
return data;
};
curl --request POST \
--url https://api.futureagi.com/model-hub/develops/None/add_columns/ \
--header 'Authorization: Bearer {access_token}' \
--header 'content-type: application/json' \
--data '{
"new_columns_data": [
{
"name": "column1",
"data_type": "integer"
},
{
"name": "column2",
"data_type": "text"
}
]
}'
curl --request POST \
--url https://api.futureagi.com/model-hub/develops/None/add_rows/ \
--header 'Authorization: Bearer {access_token}' \
--header 'content-type: application/json' \
--data '{
"rows":[
{
"cells":[
{
"column_name": "column1",
"value": 0
},
{
"column_name": "column2",
"value": 45
}
]
}
]
}'
4. Adding Data to the Dataset
- Use the SDK Code to Add Data
- Paste the copied SDK code into your development environment.
- Replace any placeholder values if necessary.
- Execute the script to send data to the dataset.
- Confirm Data Upload
- After execution, the dataset will be populated with the provided data.
- The dataset will appear in the Datasets & Experiments list.
5. Viewing the Dataset
- Navigate to the Dataset List
- The newly created dataset is now visible in the Datasets panel.
- Displays dataset details such as:
- Name
- Type (e.g., Generative)
- Number of data points
- Associated experiments and evaluations
- Verify Data Entries
- Click on the dataset name to inspect the added rows.
- Check for correct formatting and structure.
Using the SDK, you can efficiently create and manage datasets in Future AGI. This method provides a scalable way to ingest, update, and automate data handling, making it suitable for AI-driven workflows and large-scale applications.