Skip to content

fix: remaning issues with interactions API across quickstarts#1276

Open
Giom-V wants to merge 15 commits into
google-gemini:mainfrom
Giom-V:fix-interactions-config
Open

fix: remaning issues with interactions API across quickstarts#1276
Giom-V wants to merge 15 commits into
google-gemini:mainfrom
Giom-V:fix-interactions-config

Conversation

@Giom-V

@Giom-V Giom-V commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

This PR corrects the parameter name from config to generation_config in client.interactions.create() across Get_Started_Nano_Banana.ipynb, Get_started_TTS.ipynb, and Get_started_thinking.ipynb, resolving unexpected keyword argument TypeErrors.

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a breaking change in the API by renaming a configuration parameter across several documentation notebooks. By updating these calls to use the correct 'generation_config' keyword, the notebooks will now execute correctly without encountering keyword argument errors.

Highlights

  • Parameter Renaming: Updated the parameter name from 'config' to 'generation_config' in multiple 'client.interactions.create()' calls.
  • Bug Fix: Resolved TypeErrors caused by passing an unexpected keyword argument in various quickstart notebooks.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added status:awaiting review PR awaiting review from a maintainer component:quickstarts Issues/PR referencing quickstarts folder labels Jun 22, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request modifies the quickstarts/Get_started_thinking.ipynb notebook by renaming the config parameter to generation_config across multiple client.interactions.create() calls. The reviewer correctly notes that this change violates the repository's style guide and will cause a runtime TypeError because the google-genai SDK expects the config parameter. It is recommended to revert these parameter changes back to config as suggested.

" model=MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method in the google-genai SDK expects the parameter name config to pass configuration options (such as GenerateContentConfig), not generation_config. Changing this parameter to generation_config will result in a TypeError: create() got an unexpected keyword argument 'generation_config' at runtime.

Please revert this change to use config as specified in the SDK and the repository's style guide.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",
References
  1. The repository style guide specifies that client.interactions.create() should be called with the config parameter. (link)

" model=MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

" model=MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

" model=MODEL_ID,\n",
" input=[geometry_image, prompt],\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

" \"How do I use those three pool balls to sum up to 30?\"\n",
" ],\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

" model=MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

" model=MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

" model=MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

" model=MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

" model=GEMINI_3_MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" generation_config=types.GenerateContentConfig(\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The client.interactions.create() method expects the config parameter, not generation_config. Please revert this to config to avoid a runtime TypeError.

Suggested change
" generation_config=types.GenerateContentConfig(\n",
" config=types.GenerateContentConfig(\n",

@Giom-V

Giom-V commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates several quickstart notebooks to align with the new google-genai SDK patterns, including migrating to the interactions API and updating configuration structures. However, the changes introduce numerous critical syntax errors across the notebooks, primarily due to missing closing parentheses in client.interactions.create and types.GenerateContentConfig calls, as well as malformed dictionary syntax in agent_config. Additionally, using locals() to check for variable existence in Get_started_Veo.ipynb is highlighted as an anti-pattern that should be refactored.

Comment on lines +520 to 522
" generation_config=types.GenerateContentConfig(\n",
" thinking_level=types.ThinkingLevel.HIGH,\n",
"\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parentheses for both types.GenerateContentConfig(...) and client.interactions.create(...) are missing, which will cause a SyntaxError.

    generation_config=types.GenerateContentConfig(
            thinking_level=types.ThinkingLevel.HIGH,
    ),
)


Comment thread quickstarts/Get_started_thinking.ipynb Outdated
Comment on lines +946 to +948
" generation_config=types.GenerateContentConfig(\n",
" thinking_level=thinking_level,\n",
" include_thoughts=True\n",
" )\n",
" )\n",
")"
" thinking_summaries=\"auto\"\n"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parentheses for both types.GenerateContentConfig(...) and client.interactions.create(...) are missing, which will cause a SyntaxError.

    generation_config=types.GenerateContentConfig(
            thinking_level=thinking_level,
            thinking_summaries="auto"
    )
)

Comment thread quickstarts/Get_started_thinking.ipynb Outdated
Comment on lines 230 to 231
" input=prompt\n",
")\n",
"\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parenthesis ) for client.interactions.create(...) was accidentally removed, which will cause a SyntaxError.

    input=prompt
)

Comment on lines +295 to 297
" generation_config=types.GenerateContentConfig(\n",
" thinking_level=\"minimal\",\n",
"\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parentheses for both types.GenerateContentConfig(...) and client.interactions.create(...) are missing, which will cause a SyntaxError.

    generation_config=types.GenerateContentConfig(
        thinking_level="minimal",
    )
  )

Comment on lines +365 to 367
" generation_config=types.GenerateContentConfig(\n",
" thinking_level=\"minimal\",\n",
"\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parentheses for both types.GenerateContentConfig(...) and client.interactions.create(...) are missing, which will cause a SyntaxError.

            generation_config=types.GenerateContentConfig(
                            thinking_level="minimal",
            )
    )


Comment on lines +646 to 648
" generation_config=types.GenerateContentConfig(\n",
" thinking_level=types.ThinkingLevel.HIGH,\n",
"\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parentheses for both types.GenerateContentConfig(...) and client.interactions.create(...) are missing, which will cause a SyntaxError.

    generation_config=types.GenerateContentConfig(
            thinking_level=types.ThinkingLevel.HIGH,
    ),
)


Comment thread quickstarts/Get_started_thinking.ipynb Outdated
Comment on lines +682 to +683
" generation_config=types.GenerateContentConfig(\n",
" thinking_summaries=\"auto\"\n"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parentheses for both types.GenerateContentConfig(...) and client.interactions.create(...) are missing, which will cause a SyntaxError.

  generation_config=types.GenerateContentConfig(
      thinking_summaries="auto"
  )
)

Comment thread quickstarts/Get_started_thinking.ipynb Outdated
Comment on lines +861 to +869
"code_execution_tool = types.Tool(\n",
" code_execution=types.ToolCodeExecution()\n",
")\n",
"\n",
"interaction = client.interactions.create(\n",
" model=MODEL_ID,\n",
" input=prompt,\n",
" config=types.GenerateContentConfig(\n",
" tools=[code_execution_tool],\n",
" thinking_config=types.ThinkingConfig(\n",
" generation_config=types.GenerateContentConfig(\n",
" thinking_level=thinking_level,\n",
" )\n",
" ),\n",
")"
" ),\n"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parentheses for both types.Tool(...) and client.interactions.create(...) are missing, which will cause a SyntaxError.

code_execution_tool = types.Tool(
    code_execution=types.ToolCodeExecution()
)

interaction = client.interactions.create(
    model=MODEL_ID,
    input=prompt,
    generation_config=types.GenerateContentConfig(
            thinking_level=thinking_level,
    ),
)

Comment on lines +571 to 573
" generation_config=types.GenerateContentConfig(\n",
" thinking_level=types.ThinkingLevel.MINIMAL,\n",
"\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The closing parentheses for both types.GenerateContentConfig(...) and client.interactions.create(...) are missing, which will cause a SyntaxError.

    generation_config=types.GenerateContentConfig(
            thinking_level=types.ThinkingLevel.MINIMAL,
    ),
)


Comment thread quickstarts/Get_started_Veo.ipynb Outdated
" resolution=resolution,\n",
" negative_prompt=negative_prompt,\n",
" last_frame=ending_image\n",
" last_frame=ending_image if 'ending_image' in locals() else None\n",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using 'ending_image' in locals() to check if a variable is defined is generally considered an anti-pattern in Python. It is much cleaner and more maintainable to define ending_image = None at the beginning of the notebook or in the setup section of the cell, and then simply pass last_frame=ending_image.

        last_frame=ending_image

@Giom-V Giom-V changed the title fix: update client.interactions.create config parameter to generation_config across quickstarts fix: remaning issues with interactions API across quickstarts Jun 23, 2026
@ksealmalaysia41-lang

Copy link
Copy Markdown

@mcpqhttps://github.com/google-gemini/cookbook/commit/3342024598c01f61c1ea316499b22be54d17f5f5WHAT IS IT?
Kafel is a language and library for specifying syscall filtering policies. The policies are compiled into BPF code that can be used with seccomp-filter.

This is NOT an official Google product.

Usage
With verbose error reporting
struct sock_fprog prog;
kafel_ctxt_t ctxt = kafel_ctxt_create();
kafel_set_input_string(ctxt, seccomp_policy);
if (kafel_compile(ctxt, &prog)) {
fprintf(stderr, "policy compilation failed: %s", kafel_error_msg(ctxt));
kafel_ctxt_destroy(&ctxt);
exit(-1);
}
kafel_ctxt_destroy(&ctxt);
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog, 0, 0);
free(prog.filter);
Without verbose error reporting
struct sock_fprog prog;
if (kafel_compile_string(seccomp_policy, &prog)) {
fputs("policy compilation failed", stderr);
exit(-1);
}
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, &prog, 0, 0);
free(prog.filter);
Policy language
A simple language is used to define policies.

Policy file consists of statements.

A statement can be:

a constant definition
a policy definition
a policy definition statement
a default action statement
Policy definition statements placed at file scope will be added to the implicit top level policy. This top level policy is going to be compiled.

Default action statement
DEFAULT the_action
Specifies that action the_action should be taken when no rule matches.

The default action must be specified just once.

If the policy file specifies no default actions, the default action will be KILL

Numbers
Kafel supports following number notations:

Decimal 42
Hexadecimal 0xfa1
Octal 0777
Binary 0b10101
Constant definitions
You may define numeric constants to make your policies more readable. Constant definitions may be placed almost anywhere in the policy file. A constant definition cannot be placed inside of a policy definition. The defined constants can then be used anywhere where a number is expected.

#define MYCONST 123
Policy definitions
Policy definition is a list of action blocks and use statements separated by commas.

samples/ contains some example policies that demonstrate supported features.

Use statements
A USE someOtherPolicy behaves as if someOtherPolicy body was pasted in its place. You may only use policies defined before the use statement.

With use statements you can create meaningful groups of filtering rules that are building blocks of bigger policies.

Action blocks
Action block consist of a target and list of syscall matching rules separated with commas.

Target of first rule matched is the policy decision.

Following table list Kafel targets and their corresponding seccomp-filter return values.

Kafel seccomp-filter
ALLOW SECCOMP_RET_ALLOW
LOG SECCOMP_RET_LOG
KILL, KILL_THREAD, DENY SECCOMP_RET_KILL
KILL_PROCESS SECCOMP_RET_KILL_PROCESS
USER_NOTIF SECCOMP_RET_USER_NOTIF
ERRNO(number) SECCOMP_RET_ERRNO+number
TRAP(number) SECCOMP_RET_TRAP+number
TRACE(number) SECCOMP_RET_TRACE+number
Syscall matching rules
A rules consist of syscall name and optional list of boolean expressions.

List of boolean expressions separated by commas. A comma is semantically equivalent to || but has the lowest precedence, therefore it may be easier to read.

Syscall naming
Normally syscalls are specified by their names as defined in Linux kernel. However, you may also filter custom syscalls that are not in the standard syscall list. You can either define a constant and use it in place of syscall name or utilize SYSCALL keyword.

#define mysyscall -1

POLICY my_const {
ALLOW {
mysyscall
}
}

POLICY my_literal {
ALLOW {
SYSCALL[-1]
}
}
Architecture-specific filters
You can restrict a syscall rule to a subset of architectures using the ON guard. The guard accepts either a single architecture name or a comma separated list wrapped in braces. The names correspond to the targets recognised by kafel_set_target_archs (for example x86_64, x86, arm, aarch64, mips64, riscv64, m68k).

ALLOW {
io_uring_setup ON x86_64,
arm_fadvise64_64 ON arm
}
When compiling for an architecture outside of the guard, the syscall rule is ignored, so cross-architecture policies no longer need to duplicate whole policies just to account for syscall availability differences.

Argument filtering
Boolean expressions are used to filter syscalls based on their arguments. A expression resembles C language syntax, except that there are no arithmetic operators.

some_syscall(first_arg, my_arg_name) { first_arg == 42 && my_arg_name != 42 }
Bitwise and (&) and or ('|') operators can be used to test for flags.

mmap { (prot & PROT_EXEC) == 0 },
open { flags == O_RDONLY|O_CLOEXEC }
You don't have to declare arguments for well-known syscalls but can just use their regular names as specified in Linux kernel and man pages.

write { fd == 1 }
Include directive
In order to simplify reuse and composition of policies, kafel provides include support.

#include "some_other_file.policy"
Kafel looks for included files only under directories explicitly added to the search paths.

kafel_include_add_search_path(ctxt, "includes/path");
Adds includes/path to search paths - the example include directive will refer then to includes/path/some_other_file.policy.

Include directive is terminated by a newline or a semicolon. Multiple files, separated by whitespace, can be specified in one directive.

#include "first.policy" "second.policy"; #include "third.policy"
Example
When used with nsjail, the following command allows to create a fairly constrained environment for your shell

$ ./nsjail --chroot / --seccomp_string 'POLICY a { ALLOW { write, execve, brk, access, mmap, open, newfstat, close, read, mprotect, arch_prctl, munmap, getuid, getgid, getpid, rt_sigaction, geteuid, getppid, getcwd, getegid, ioctl, fcntl, newstat, clone, wait4, rt_sigreturn, exit_group } } USE a DEFAULT KILL' -- /bin/sh -i
[2017-01-15T21:53:08+0100] Mode: STANDALONE_ONCE
[2017-01-15T21:53:08+0100] Jail parameters: hostname:'NSJAIL', chroot:'/', process:'/bin/sh', bind:[::]:0, max_conns_per_ip:0, uid:(ns:1000, global:1000), gid:(ns:1000, global:1000), time_limit:0, personality:0, daemonize:false, clone_newnet:true, clone_newuser:true, clone_newns:true, clone_newpid:true, clone_newipc:true, clonew_newuts:true, clone_newcgroup:false, keep_caps:false, tmpfs_size:4194304, disable_no_new_privs:false, pivot_root_only:false
[2017-01-15T21:53:08+0100] Mount point: src:'/' dst:'/' type:'' flags:0x5001 options:''
[2017-01-15T21:53:08+0100] Mount point: src:'(null)' dst:'/proc' type:'proc' flags:0x0 options:''
[2017-01-15T21:53:08+0100] PID: 18873 about to execute '/bin/sh' for [STANDALONE_MODE]
/bin/sh: 0: can't access tty; job control turned off
$ set
IFS='
'
OPTIND='1'
PATH='/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
PPID='0'
PS1='$ '
PS2='> '
PS4='+ '
PWD='/'
$ id
Bad system call
$ exit
[2017-01-15T21:53:17+0100] PID: 18873 exited with status: 159, (PIDs left: 0)mips64, riscv64, m68k

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

Labels

component:quickstarts Issues/PR referencing quickstarts folder status:awaiting review PR awaiting review from a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants