Skip to main content
POST
/
openai
/
detect-csv-columns
{
  "detected_columns": [
    {
      "csv_column_name": "<string>",
      "csv_column_index": 123,
      "mapped_field": "<string>",
      "confidence": 123,
      "sample_values": [
        {}
      ],
      "data_type": "<string>",
      "suggested_transformations": [
        {}
      ]
    }
  ],
  "unmapped_columns": [
    {}
  ],
  "data_quality_insights": {
    "estimated_rows": 123,
    "potential_issues": [
      {}
    ],
    "recommendations": [
      {}
    ]
  },
  "import_preview": {
    "sample_records": [
      {}
    ],
    "estimated_success_rate": 123
  },
  "tokens_used": 123
}

Overview

Uses OpenAI to analyze CSV file structure and automatically detect column mappings for bulk content import. This helps streamline the process of importing large datasets for evaluation.

Request Body

csv_sample
string
required
Sample rows from the CSV file (header + first few data rows)
expected_fields
array
required
Expected field types to map
  • content - Main content to evaluate
  • title - Content title
  • description - Content description
  • category - Content category
  • metadata - Additional metadata
  • id - External ID or reference
detection_options
object
Options for column detection

Response

detected_columns
array
required
Detected column mappings
unmapped_columns
array
Columns that couldn’t be mapped to expected fields
data_quality_insights
object
required
Insights about data quality
import_preview
object
required
Preview of how data would be imported
tokens_used
integer
required
Number of OpenAI tokens consumed

Examples

curl -X POST https://api.judge.example.com/openai/detect-csv-columns \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "csv_sample": "title,post_content,author,published_date,category\n\"Introduction to AI\",\"Artificial Intelligence is transforming...\",\"John Doe\",\"2024-01-15\",\"Technology\"\n\"Marketing Tips\",\"Here are 10 proven marketing strategies...\",\"Jane Smith\",\"2024-01-14\",\"Business\"",
    "expected_fields": ["content", "title", "category", "metadata"],
    "detection_options": {
      "confidence_threshold": 0.8,
      "suggest_transformations": true
    }
  }'