Skip to content

Stream merging fails with gemini #358

Description

@mrembert

I encountered an error when attempting to create a tool definition for the get_pums function from the tidycensus package using the create_tool_def function from ellmer.

Reproduction steps:

  1. Load the tidycensus and ellmer libraries:

    library(tidycensus)
    library(ellmer)
  2. Create a chat_gemini object:

    chat <- chat_gemini("gemini-2.0-flash")
  3. Attempt to create a tool definition for get_pums:

    create_tool_def(get_pums, chat)

Expected behavior:

I expected create_tool_def to successfully generate a tool definition for the get_pums function, allowing it to be used within the ellmer framework.

Actual behavior:

Instead of creating the tool definition, the code produced the following response/error:

tool(
  tidycensus::get_pums,
  "Load data from the American Community Survey Public Use Microdata Series API",
  variables = type_array(
    "A vector of variables from the PUMS API. Use `View(pums_variables)` to browse variable options.",
    items = type_string()
  ),
  state = type_string(
    "A state, or vector of states, for which you would like to request data. The entire US can be requested with `state = \"all\"` - though be 
patient with the data download!",
    required = FALSE # TODO: could also be a vector, unclear how to Error in merge_func(left, right, path) : is.list(left) is not TRUE
Error during wrapup: 'S4SXP': should not happen - please report
Error: no more error handlers available (recursive errors?); invoking 'abort' restart

Additional Information:

  • I've tried create_tool_def with other functions (e.g. sum) and it seems to work, so it seems to be related to something specific about the tidycensus::get_pums function.

Activity

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

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions