Skip to content
Showcase/API-Bank Tool Call Review
advancedevaluation

API-Bank Tool Call Review

Per-call review of API (tool) calls in tool-augmented assistant dialogues, based on API-Bank (Li et al., EMNLP 2023). Every API call in a dialogue becomes a reviewable card showing the tool name and arguments; annotators judge whether the right API was chosen, whether the arguments are correct, and whether the calls occur in the right order, then rate whether the assistant's final response is grounded in the API execution results.

About this dataset

API-Bank is a comprehensive benchmark for tool-augmented LLMs built around a pool of executable APIs spanning search engines, calendars, smart-home control, banking, health, and more. Its evaluation set contains 314 manually annotated dialogues with 753 API calls over 73 APIs, testing three graded abilities: Call (invoke a given API correctly), Retrieval+Call (find the right API first via an API Search), and Plan+Retrieval+Call (plan a chain of calls for a complex requirement).

The benchmark's human annotation was intensive: computer-science students designed queries against real API documents, annotated the calls and responses, and executed them against the system. Each dialogue required discussion between two annotators, and two additional annotators reviewed quality — the format, logical consistency, and reasonability of API calls — at a cost of about $8 per dialogue, with 21.5 percent of annotated dialogues discarded. Evaluation then scores predicted calls by consistency with the annotated calls (same database queries or modifications, same returned results) and scores responses against annotated references.

This Potato config turns that review process into a reusable annotation task using the tool_call_review scheme: tool calls are extracted from the dialogue steps at render time, and each gets a verdict (correct, wrong_tool, wrong_args, wrong_order) with notes — exactly the failure axes API-Bank's abilities isolate. A dialogue-level radio adds API-Bank's second evaluation perspective, judging whether the final response is grounded in the returned API results.

The sample dialogues are self-authored in API-Bank's style across its domains and three ability levels, and include deliberate faults to review: swapped transfer arguments, an unrequested thermostat call, an out-of-order email before the attendee list was retrieved, and a non-recurring reminder for a daily request.

Released
2023 (arXiv:2304.08244); EMNLP 2023
Evaluation dialogues
314 (753 API calls, 73 APIs, 8 domains)
Training dialogues
1,888 (2,138 simulated APIs, 1,000 domains)
Abilities tested
Call, Retrieval+Call, Plan+Retrieval+Call
Annotation cost
$8 per dialogue; 21.5% of dialogues discarded in QA
Annotators per dialogue
2 annotators + 2 quality reviewers
Submit

Configuration Fileconfig.yaml

This Potato config reproduces the annotation task. Save it as config.yaml and run potato start config.yaml to try it.

yaml
# API-Bank Tool Call Review
# Based on: Minghao Li, Yingxiu Zhao, Bowen Yu, Feifan Song, Hangyu Li,
#   Haiyang Yu, Zhoujun Li, Fei Huang, and Yongbin Li (2023). "API-Bank: A
#   Comprehensive Benchmark for Tool-Augmented LLMs." Proceedings of the 2023
#   Conference on Empirical Methods in Natural Language Processing (EMNLP),
#   pp. 3102-3116. DOI 10.18653/v1/2023.emnlp-main.187. arXiv:2304.08244.
#   Paper: https://aclanthology.org/2023.emnlp-main.187/
#   Dataset: https://github.com/AlibabaResearch/DAMO-ConvAI/tree/main/api-bank
#
# Task: review each API (tool) call in a tool-augmented dialogue: was the
# right API chosen for the user's query, were the input parameters correct,
# and were the calls made in the right order (API-Bank's Call,
# Retrieval+Call, and Plan+Retrieval+Call abilities)? A dialogue-level radio
# judges whether the assistant's final response is grounded in the API
# execution results (API-Bank's response-quality perspective). This adapts
# API-Bank's annotation and quality-review process — where each dialogue was
# annotated by two discussing annotators and reviewed by two more for format,
# logical consistency, and reasonability of API calls — into a per-call
# review task.
#
# Annotation instructions adapted from Sections 3.2 and 3.3; the paper
# describes its annotation and evaluation criteria in prose but does not
# publish the verbatim annotator guidelines.

annotation_task_name: "API-Bank Tool Call Review"
task_dir: "."

data_files:
  - sample-data.json

item_properties:
  id_key: "id"
  text_key: "query"

output_annotation_dir: "annotation_output/"
output_annotation_format: "json"

port: 8000
server_name: localhost

annotation_instructions: |
  You are shown a dialogue between a user and a tool-augmented assistant. The
  assistant can call APIs from an API pool; every call it made is extracted
  below as a card showing the API name and its arguments, together with the
  execution result in the transcript.

  Following API-Bank's quality criteria — the format, logical consistency,
  and reasonability of API calls, and consistency with the user's requirement
  — review each API call individually:

  - correct: this is the right API for what the user asked, the input
    parameters are correct and well-formed (matching the API document and the
    details given in the dialogue), and the call occurs at a sensible point
    in the call sequence.
  - wrong_tool: a different API from the pool should have been called (e.g.,
    the query requires a search or a different domain API).
  - wrong_args: the right API, but the input parameters are wrong, malformed,
    or inconsistent with what the user actually specified.
  - wrong_order: the call is out of sequence — e.g., an API that depends on
    the result of another call was invoked before it, or a required API
    Search / planning step was skipped ahead of this call.

  Use the notes field to explain any verdict other than correct.

  Then judge the assistant's final response at the dialogue level: is it
  consistent with (grounded in) the returned API execution results, and does
  it fulfill the user's requirement? An API call can be correct while the
  response misreports its result, and vice versa.

annotation_schemes:
  - annotation_type: tool_call_review
    name: tool_review
    description: "Judge each API call: right API? correct arguments? right order?"
    steps_key: steps
    verdict_options: [correct, wrong_tool, wrong_args, wrong_order]

  - annotation_type: radio
    name: response_grounding
    description: "Is the assistant's final response grounded in the API execution results and responsive to the user's query?"
    labels:
      - "Grounded and responsive — response matches the API results and answers the query"
      - "Partially grounded — response answers the query but misreports or omits API results"
      - "Not grounded — response contradicts or ignores the API results"
    keyboard_shortcuts:
      "Grounded and responsive — response matches the API results and answers the query": "1"
      "Partially grounded — response answers the query but misreports or omits API results": "2"
      "Not grounded — response contradicts or ignores the API results": "3"

html_layout: |
  <div style="padding: 15px; max-width: 860px; margin: auto;">
    <div style="background: #f1f5f9; border: 1px solid #cbd5e1; border-radius: 8px; padding: 6px 12px; margin-bottom: 8px; font-size: 13px; color: #475569;">
      <strong>Ability level:</strong> {{ability}} &nbsp;·&nbsp; <strong>Domain:</strong> {{domain}}
    </div>
    <div style="background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 8px; padding: 14px 18px; margin-bottom: 10px;">
      <h3 style="margin: 0 0 6px 0; color: #3730a3; font-size: 15px;">User's requirement</h3>
      <p style="font-size: 15px; line-height: 1.6; margin: 0; color: #1e1b4b;">{{query}}</p>
    </div>
    <div style="background: #fafafa; border: 1px solid #e5e7eb; border-radius: 8px; padding: 14px 18px; margin-bottom: 10px;">
      <h3 style="margin: 0 0 8px 0; color: #374151; font-size: 14px;">Dialogue transcript (with API execution results)</h3>
      <div style="white-space: pre-wrap; font-size: 14px; line-height: 1.7; color: #1f2937;">{{transcript}}</div>
    </div>
    <p style="color: #6b7280; font-size: 13px; margin: 0;">Each API call extracted from the dialogue appears below as a card. Give a verdict per call, then rate the final response's grounding.</p>
  </div>

allow_all_users: true
instances_per_annotator: 30
annotation_per_instance: 2
allow_skip: true

Sample Datasample-data.json

json
[
  {
    "id": "apibank_001",
    "query": "Book me a table for two at an Italian restaurant in the city center this Friday at 7 pm.",
    "ability": "Call",
    "domain": "Dining",
    "transcript": "User: Book me a table for two at an Italian restaurant in the city center this Friday at 7 pm.\nAssistant: [calls RestaurantSearch(cuisine='Italian', location='city center')]\nAPI result: [{'name': 'Trattoria Roma', 'id': 'R118'}, {'name': 'Osteria Blu', 'id': 'R204'}]\nAssistant: [calls BookTable(restaurant_id='R118', date='2023-06-16', time='19:00', party_size=2)]\nAPI result: {'status': 'confirmed', 'confirmation_no': 'BK5521'}\nAssistant: I booked a table for two at Trattoria Roma this Friday at 7 pm. Your confirmation number is BK5521.",
    "steps": [
      {
        "speaker": "user",
        "content": "Book me a table for two at an Italian restaurant in the city center this Friday at 7 pm."
      },
      {
        "speaker": "assistant",
        "content": "Searching for Italian restaurants in the city center.",
        "tool_call": {
          "tool": "RestaurantSearch",
          "args": {
            "cuisine": "Italian",
            "location": "city center"
          }
        }
      },
      {
        "speaker": "api",
        "content": "Result: [{'name': 'Trattoria Roma', 'id': 'R118'}, {'name': 'Osteria Blu', 'id': 'R204'}]"
      },
      {
        "speaker": "assistant",
        "content": "Booking a table at Trattoria Roma.",
        "tool_call": {
          "tool": "BookTable",
          "args": {
            "restaurant_id": "R118",
            "date": "2023-06-16",
            "time": "19:00",
            "party_size": 2
          }
        }
      },
      {
        "speaker": "api",
        "content": "Result: {'status': 'confirmed', 'confirmation_no': 'BK5521'}"
      },
      {
        "speaker": "assistant",
        "content": "I booked a table for two at Trattoria Roma this Friday at 7 pm. Your confirmation number is BK5521."
      }
    ]
  },
  {
    "id": "apibank_002",
    "query": "What's the weather in Berlin tomorrow, and should I bring an umbrella?",
    "ability": "Call",
    "domain": "Weather",
    "transcript": "User: What's the weather in Berlin tomorrow, and should I bring an umbrella?\nAssistant: [calls GetWeather(city='Berlin', date='2023-06-13')]\nAPI result: {'condition': 'light rain', 'high_c': 19, 'low_c': 12, 'precip_prob': 0.7}\nAssistant: Tomorrow in Berlin expect light rain with a high of 19°C and a 70% chance of precipitation, so yes, bring an umbrella.",
    "steps": [
      {
        "speaker": "user",
        "content": "What's the weather in Berlin tomorrow, and should I bring an umbrella?"
      },
      {
        "speaker": "assistant",
        "content": "Checking tomorrow's forecast for Berlin.",
        "tool_call": {
          "tool": "GetWeather",
          "args": {
            "city": "Berlin",
            "date": "2023-06-13"
          }
        }
      },
      {
        "speaker": "api",
        "content": "Result: {'condition': 'light rain', 'high_c': 19, 'low_c': 12, 'precip_prob': 0.7}"
      },
      {
        "speaker": "assistant",
        "content": "Tomorrow in Berlin expect light rain with a high of 19°C and a 70% chance of precipitation, so yes, bring an umbrella."
      }
    ]
  }
]

// ... and 8 more items

Get This Design

View on GitHub

Clone or download from the repository

Quick start:

git clone https://github.com/davidjurgens/potato-showcase.git
cd potato-showcase/agentic/apibank-tool-call-review
potato start config.yaml

Dataset & paper

Li et al., EMNLP 2023

Citation (BibTeX)

bibtex
@inproceedings{li-etal-2023-api,
    title = "{API}-Bank: A Comprehensive Benchmark for Tool-Augmented {LLM}s",
    author = "Li, Minghao and Zhao, Yingxiu and Yu, Bowen and Song, Feifan and Li, Hangyu and Yu, Haiyang and Li, Zhoujun and Huang, Fei and Li, Yongbin",
    booktitle = "Proceedings of the 2023 Conference on Empirical Methods in Natural Language Processing",
    month = dec,
    year = "2023",
    address = "Singapore",
    publisher = "Association for Computational Linguistics",
    url = "https://aclanthology.org/2023.emnlp-main.187/",
    doi = "10.18653/v1/2023.emnlp-main.187",
    pages = "3102--3116"
}

Details

Annotation Types

tool_call_reviewradio

Domain

Tool UseDialogue

Use Cases

Tool-Augmented LLMsFunction Calling EvaluationAgent Trace Review

Tags

tool-callingapifunction-callingagent-evaluationdialogue

Found an issue or want to improve this design?

Open an Issue