Skip to content

BUG: OpenAIResponseTarget passes non-object tool arguments to custom functions #3516

Closed

Description

Describe the bug

In OpenAIResponseTarget._execute_call_section_async, a registered Tool gets a malformed_arguments result (or a ValueError with fail_on_missing_function=True) when the model sends arguments that parse as JSON but are not an object, such as null, [1, 2] or "text". Functions passed through custom_functions skip that check and are called with the raw None, list or string, so a function that reads args["x"] or args.get("x") raises and the whole send fails instead of the model getting an error it can recover from.

Steps to Reproduce

Register custom_functions={"lookup": fn} where fn does args.get("q"), and have the model return a function_call for lookup with "arguments": "null".

Expected Results

Same as a registered Tool: the model receives a malformed_arguments function output and the loop continues.

Actual Results

AttributeError: 'NoneType' object has no attribute 'get' is raised out of send_prompt_async.

Versions

Linux, Python 3.13.16, PyRIT 1.2.0.dev0 from main (96de757)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions