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:
  1. Go to the “Datasets & Experiments” Section
    • Navigate to the Datasets page from the main dashboard.
    • Click on the “Add Dataset” button.
  2. 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

  1. Enter a Dataset Name
    • A prompt appears asking for the dataset name.
    • Enter a clear, descriptive name
    • Click “Next” to proceed.
  2. 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

  1. View Pre-Generated Code
    • The system generates ready-to-use SDK code in multiple languages:
      • Python
      • TypeScript
      • cURL
    • The code includes:
      • API key authentication.
      • Dataset creation command.
      • Methods for adding data.
      • Methods for adding evaluations to your dataset after data is added.

Adding Data using SDK

# pip install futureagi

import os
from fi.datasets import Dataset
from fi.datasets.types import (
    Cell,
    Column,
    DatasetConfig,
    DataTypeChoices,
    ModelTypes,
    Row,
    SourceChoices,
)

# -------------------------------------------------------------------
# 1. Configure credentials
# -------------------------------------------------------------------
os.environ["FI_API_KEY"] = "YOUR_API_KEY"          # Replace with your API key
os.environ["FI_SECRET_KEY"] = "YOUR_SECRET_KEY"  # Replace with your secret key
os.environ["FI_BASE_URL"] = "https://api.futureagi.com"

# -------------------------------------------------------------------
# 2. Create / open the dataset
# -------------------------------------------------------------------
config = DatasetConfig(name="test-dataset", model_type=ModelTypes.GENERATIVE_LLM)
dataset = Dataset(dataset_config=config)
dataset = dataset.create()  # Creates remotely if it doesn’t already exist

# -------------------------------------------------------------------
# 3. Define columns & rows
# -------------------------------------------------------------------
columns = [
    Column(name="user_query", data_type=DataTypeChoices.TEXT, source=SourceChoices.OTHERS),
    Column(name="response_quality", data_type=DataTypeChoices.INTEGER, source=SourceChoices.OTHERS),
    Column(name="is_helpful", data_type=DataTypeChoices.BOOLEAN, source=SourceChoices.OTHERS),
]

rows = [
    Row(order=1, cells=[
        Cell(column_name="user_query", value="What is machine learning?"),
        Cell(column_name="response_quality", value=8),
        Cell(column_name="is_helpful", value=True),
    ]),
    Row(order=2, cells=[
        Cell(column_name="user_query", value="Explain quantum computing"),
        Cell(column_name="response_quality", value=9),
        Cell(column_name="is_helpful", value=True),
    ]),
]

# -------------------------------------------------------------------
# 4. Push data & run evaluation
# -------------------------------------------------------------------
dataset = dataset.add_columns(columns=columns)
dataset = dataset.add_rows(rows=rows)

dataset.add_evaluation(
    name="factual_accuracy",
    eval_template="is_factually_consistent",
    required_keys_to_column_names={
        "input": "user_query",
        "output": "response_quality",
        "context": "user_query",
    },
    run=True,
)

print("✓ Data added successfully")

4. Adding Data to the Dataset

  1. 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.

5. Viewing the Dataset

  1. 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
  2. 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.