{
  "id": "llm/function-call-argument-type-mismatch",
  "signature": "openai.BadRequestError: Invalid parameter: value for parameter 'temperature' is not a valid number: 'hot'",
  "signature_zh": "openai.BadRequestError: 参数无效：参数'temperature'的值不是有效数字：'hot'",
  "regex": "openai\\.BadRequestError: Invalid parameter: value for parameter '.+' is not a valid number: '.+'",
  "domain": "llm",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "LLM generated a function call argument with the wrong data type (e.g., string instead of number) due to ambiguous schema definitions or insufficient prompting for parameter types.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于模式定义不明确或对参数类型的提示不足，LLM生成了错误数据类型的函数调用参数（例如字符串而非数字）。",
  "versions": [
    {
      "version": "openai==1.30.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "python==3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "LLMs are not reliably type-safe; they may ignore instructions if the schema is ambiguous or if the model's token distribution favors string outputs.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This is brittle and doesn't scale; the LLM may generate other invalid types (e.g., arrays instead of objects) that the regex cannot handle.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This defeats the purpose of structured tool use and introduces more parsing errors from free-form text.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Add explicit type descriptions in the function schema's parameter descriptions: `'temperature': {'type': 'number', 'description': 'A float between 0 and 2, e.g., 0.7. Do NOT use words like hot or cold.'}` and use `enum` constraints if applicable: `'temperature': {'type': 'number', 'enum': [0.0, 0.5, 1.0, 1.5, 2.0]}`",
      "success_rate": 0.85,
      "how": "Add explicit type descriptions in the function schema's parameter descriptions: `'temperature': {'type': 'number', 'description': 'A float between 0 and 2, e.g., 0.7. Do NOT use words like hot or cold.'}` and use `enum` constraints if applicable: `'temperature': {'type': 'number', 'enum': [0.0, 0.5, 1.0, 1.5, 2.0]}`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement a validation layer that catches type errors and retries the function call with a corrected prompt: `try: response = client.chat.completions.create(...); except BadRequestError as e: if 'not a valid number' in str(e): corrected_messages = messages + [{'role': 'assistant', 'content': None, 'function_call': ...}, {'role': 'function', 'name': 'validation_error', 'content': f'Type error: {e}'}]; response = retry(corrected_messages)`",
      "success_rate": 0.9,
      "how": "Implement a validation layer that catches type errors and retries the function call with a corrected prompt: `try: response = client.chat.completions.create(...); except BadRequestError as e: if 'not a valid number' in str(e): corrected_messages = messages + [{'role': 'assistant', 'content': None, 'function_call': ...}, {'role': 'function', 'name': 'validation_error', 'content': f'Type error: {e}'}]; response = retry(corrected_messages)`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Add explicit type descriptions in the function schema's parameter descriptions: `'temperature': {'type': 'number', 'description': 'A float between 0 and 2, e.g., 0.7. Do NOT use words like hot or cold.'}` and use `enum` constraints if applicable: `'temperature': {'type': 'number', 'enum': [0.0, 0.5, 1.0, 1.5, 2.0]}`",
    "Implement a validation layer that catches type errors and retries the function call with a corrected prompt: `try: response = client.chat.completions.create(...); except BadRequestError as e: if 'not a valid number' in str(e): corrected_messages = messages + [{'role': 'assistant', 'content': None, 'function_call': ...}, {'role': 'function', 'name': 'validation_error', 'content': f'Type error: {e}'}]; response = retry(corrected_messages)`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://platform.openai.com/docs/guides/function-calling",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-01",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}