Skip to content

Non struct supported openai models - r ellmer::batch_chat_structured() useful error message? #599

Description

@rkrug

Hi
I am testing some code and anted to use a "cheaper" openai model with batch_chat_structured. But I only found gpt-4o to be working (the others gave the cryptic error message

Error in `rlang::abort()`:
! `call` must be a call or environment, not a function.
Hide Traceback
     ▆
  1. ├─dplyr::bind_rows(...)
  2. │ └─rlang::list2(...)
  3. └─ellmer::batch_chat_structured(...)
  4.   └─BatchJob$new(...)
  5.     └─ellmer (local) initialize(...)
  6.       └─self$check_hash(state$hash, call = call)
  7.         └─cli::cli_abort(...)
  8.           └─rlang::abort(call = call)
  9.             └─rlang:::validate_signal_args(...)
 10.               └─rlang:::stop_input_type(...)
 11.                 └─rlang::abort(message, ..., call = call, arg = arg)
>

In parallel_chat_structured, I get the much more useful error message

Error in `req_perform_parallel()`:
! HTTP 400 Bad Request.
• Invalid parameter: 'response_format' of type 'json_schema' is not supported with this model. Learn more about supported models at the Structured Outputs guide: [https://platform.openai.com/docs/guides/structured-outputs](vscode-file://vscode-app/Applications/Positron.app/Contents/Resources/app/out/vs/code/electron-sandbox/workbench/workbench.html#)

It would be great the error message could be a bit more informative.

Also, a check in advance for the capabilities of the model would be useful.

Thanks,

Rainer

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