Prompt Chain

Classify and Summarize Images

Image Classification is a prompt chain example that demonstrates multi-step workflows for classifying images using AI vision models with promptfoo's testing


54
Spark score
out of 100
Updated 2 days ago
Version code-scan-action-0.1

Add to Favorites

Why it matters

Automate the process of classifying images and extracting key information for content analysis and organization.

Outcomes

What it gets done

01

Classify images based on their content.

02

Extract relevant details from image classifications.

03

Summarize findings from image analysis.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/pfoo-image-classification | bash

Capabilities

What this chain does

Classify

Labels or categorizes text, files, or data points.

Extract

Pulls structured data fields from unstructured text.

Summarize

Condenses long documents or threads into key takeaways.

Overview

Image Classification

What it does

Image Classification is a prompt chain example from the promptfoo framework that demonstrates how to build multi-step workflows for classifying images with AI vision models. It shows how to structure prompt chains that process image inputs, orchestrate model calls, and format classification results. The example is executable via the promptfoo CLI.

How it connects

Use this when you need a reference implementation for building image classification workflows with prompt chains, or when you want to learn how promptfoo handles multi-step vision model testing. It's ideal for developers prototyping computer vision features or establishing testing patterns for AI-powered image recognition systems.

Source README

yaml-language-server: $schema=https://promptfoo.dev/config-schema.json

description: Image Classification Example of Fashion MNIST dataset
providers:

  • openai:chat:gpt-4o
  • openai:chat:gpt-4.1-mini
    prompts:
  • label: Image Classification
    raw: file://prompt.js
    config:
    response_format:
    type: json_schema
    json_schema:
    name: image_classification
    schema:
    type: object
    properties:
    classification:
    type: string
    enum:
    [
    'T-shirt/top',
    'Trouser',
    'Pullover',
    'Dress',
    'Coat',
    'Sandal',
    'Shirt',
    'Sneaker',
    'Bag',
    'Ankle boot',
    ]
    color:
    type: string
    features:
    type: string
    style:
    type: string
    confidence:
    type: integer
    reasoning:
    type: string
    required:
    - classification
    - color
    - features
    - style
    - confidence
    - reasoning
    additionalProperties: false

defaultTest:
assert:
- type: is-json
value:
type: object
properties:
classification:
type: string
color:
type: string
features:
type: string
style:
type: string
confidence:
type: integer
reasoning:
type: string
- type: javascript
value: 'output.classification === context.vars.label'
metric: accuracy

tests: file://fashion_mnist_sample_base64.csv

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.