marimo icon indicating copy to clipboard operation
marimo copied to clipboard

Chat Does not work for gemini models in sidebar

Open reachtarunhere opened this issue 2 weeks ago • 3 comments

Describe the bug

I can successfully use the same models while generating code in individual cells in the notebook.

Image

Full Error Message:

10 validation errors for GenerateContentConfig tools.13.Tool.function_declarations.0.parameters.properties.edit.anyOf.0.properties.type.const Extra inputs are not permitted [type=extra_forbidden, input_value='update_cell', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden tools.13.Tool.function_declarations.0.parameters.properties.edit.anyOf.1.properties.type.const Extra inputs are not permitted [type=extra_forbidden, input_value='add_cell', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden tools.13.Tool.function_declarations.0.parameters.properties.edit.anyOf.1.properties.position.anyOf.0.properties.type.const Extra inputs are not permitted [type=extra_forbidden, input_value='relative', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden tools.13.Tool.function_declarations.0.parameters.properties.edit.anyOf.1.properties.position.anyOf.1.properties.type.const Extra inputs are not permitted [type=extra_forbidden, input_value='column_end', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden tools.13.Tool.function_declarations.0.parameters.properties.edit.anyOf.1.properties.position.anyOf.2.properties.type.const Extra inputs are not permitted [type=extra_forbidden, input_value='notebook_end', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden tools.13.Tool.function_declarations.0.parameters.properties.edit.anyOf.2.properties.type.const Extra inputs are not permitted [type=extra_forbidden, input_value='delete_cell', input_type=str] For further information visit https://errors.pydantic.dev/2.12/v/extra_forbidden tools.13.callable Input should be callable [type=callable_type, input_value={'function_declarations':...'required': ['edit']}}]}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/callable_type tools.13.Tool.name Field required [type=missing, input_value={'function_declarations':...'required': ['edit']}}]}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing tools.13.Tool.inputSchema Field required [type=missing, input_value={'function_declarations':...'required': ['edit']}}]}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/missing tools.13.is-instance[ClientSession] Input should be an instance of ClientSession [type=is_instance_of, input_value={'function_declarations':...'required': ['edit']}}]}, input_type=dict] For further information visit https://errors.pydantic.dev/2.12/v/is_instance_of

Will you submit a PR?

  • [ ] Yes

Environment

{
  "marimo": "0.17.8",
  "editable": false,
  "location": "/home/tarun/Projects/marimo-blog/.venv/lib/python3.12/site-packages/marimo",
  "OS": "Linux",
  "OS Version": "5.15.0-139-generic",
  "Processor": "x86_64",
  "Python Version": "3.12.9",
  "Locale": "en_US",
  "Binaries": {
    "Browser": "113.0.5672.126",
    "Node": "v22.17.1"
  },
  "Dependencies": {
    "click": "8.3.0",
    "docutils": "0.22.3",
    "itsdangerous": "2.2.0",
    "jedi": "0.19.2",
    "markdown": "3.10",
    "narwhals": "2.11.0",
    "packaging": "25.0",
    "psutil": "7.1.3",
    "pygments": "2.19.2",
    "pymdown-extensions": "10.17.1",
    "pyyaml": "6.0.3",
    "starlette": "0.50.0",
    "tomlkit": "0.13.3",
    "typing-extensions": "4.15.0",
    "uvicorn": "0.38.0",
    "websockets": "15.0.1"
  },
  "Optional Dependencies": {
    "altair": "6.0.0",
    "duckdb": "1.4.2",
    "loro": "1.8.2",
    "mcp": "1.21.1",
    "nbformat": "5.10.4",
    "openai": "2.8.0",
    "polars": "1.35.2",
    "pyarrow": "22.0.0",
    "pytest": "9.0.1",
    "python-lsp-server": "1.13.1",
    "ruff": "0.14.5",
    "sqlglot": "27.29.0",
    "vegafusion": "2.0.3"
  },
  "Experimental Flags": {
    "performant_table_charts": true,
    "external_agents": false,
    "chat_modes": false
  }
}

Code to reproduce

No response

reachtarunhere avatar Nov 16 '25 09:11 reachtarunhere

@reachtarunhere can i work on this issue? can you assign me for this issue?

Sahilbhatane avatar Nov 16 '25 15:11 Sahilbhatane

Hi @Sahilbhatane I am not a maintainer but just a user :)

reachtarunhere avatar Nov 16 '25 16:11 reachtarunhere

Hi @Sahilbhatane I am not a maintainer but just a user :)

Agg.. then I guess I can start fixing for you 😉

Sahilbhatane avatar Nov 16 '25 16:11 Sahilbhatane

@Sahilbhatane i assigned the issue to you. Let us know if you need help or prefer the core team to take a look.

mscolnick avatar Nov 17 '25 00:11 mscolnick

hey @mscolnick this is what i implemented -

  • added _simplify_schema_for_google() function in marimo/_ai/_convert.py that:
  • merges oneOf/anyOf branches into single {type, enum} schemas when all branches share the same primitive type
  • replaces const with enum: [value] for compatibility
  • recursively processes nested properties and array items
  • falls back to permissive types for heterogeneous unions

and for test - (AI generated script saved in tests directory) - created tests/test_gemini_issue.py to validate schema transformation

But after fixing and running the servers file not found error occurs for marimo/marimo/_static/index.html, i tried with pnpm, npm and make.

i tried using Agentic AI to solve it but still cannot start it. I will find the a way and open a PR soon (in less than a hour).

Sahilbhatane avatar Nov 19 '25 15:11 Sahilbhatane

never mind solved it with AI, just copied everything from frontend/dist to marimo_static with xcopy... opening PR.

Sahilbhatane avatar Nov 19 '25 15:11 Sahilbhatane