guidellm.data.preprocessors.tool_calling
Preprocessor for extracting prompts from tool calling datasets.
Handles HuggingFace datasets where prompts are stored as OpenAI-format messages arrays rather than plain text columns.
ToolCallingMessageExtractor
Bases: DatasetPreprocessor
Extract user prompts, system prompts, and tool responses from messages.
Many tool calling datasets (e.g. madroid/glaive-function-calling-openai) store conversations as a messages column containing an array of message dicts. This preprocessor supports both OpenAI format (role/content) and ShareGPT format (from/value).
It replaces the text_column value with the extracted user content, populates prefix_column with the system prompt when present, and populates tool_response_column with tool response content.
Usage::
guidellm benchmark run \
--data '{"kind": "hf", "source": "..."}' \
--data-column-mapper '{"kind": "generative_column_mapper",
"column_mappings": {"text_column": "messages"}}' \
--data-preprocessor kind=tool_calling_message_extractor
Source code in src/guidellm/data/preprocessors/tool_calling.py
ToolCallingMessageExtractorArgs
Bases: DataPreprocessorArgs
Model for tool calling message extractor preprocessor arguments.