lemon-match-18357
12/19/2025, 7:55 PMtall-airline-16756
12/19/2025, 7:56 PMtall-airline-16756
12/19/2025, 7:56 PMthinking_config when using Gemini via the Gemini Live API plugin (google.realtime.RealtimeModel) in LiveKit. The thinking_config is passed to the Gemini Live API and lets you control things like whether the model includes internal thoughts (for example, include_thoughts=False).
Would you like:
• a short Python example showing this in an AgentSession, or
• details about which Gemini model versions support thinking config and how to verify compatibility? Sources: Gemini Live API plugin | LiveKit docslemon-match-18357
12/19/2025, 7:57 PMtall-airline-16756
12/19/2025, 7:57 PMthinking_config to your existing factory function.
Here's a concise example that follows your structure and shows ThinkingConfig usage for both branches:
from google.genai import types
from livekit.plugins import google
from google.genai.types import ThinkingConfig
def create_google_llm_with_config(converse_type: str | None = None) -> google.LLM:
"""
Create a Google LLM instance with optimized settings for timeout prevention.
"""
base_kwargs = dict(
model="gemini-3-flash-preview",
temperature=0.7,
top_p=0.9,
top_k=40,
)
if converse_type in ("singlePrompt", "singlePrompt2"):
# Use LOW thinking level for faster responses in singlePrompt mode
base_kwargs.update(
thinking_config=ThinkingConfig(thinking_level="LOW")
)
# Use a different model if you need penalties unsupported by 2.5-flash
base_kwargs["model"] = "gemini-3-flash-preview"
return google.LLM(**base_kwargs)
else:
# Example: disable safety filters (as in your original code)
safety_settings = [
types.SafetySetting(
category=types.HarmCategory.HARM_CATEGORY_HATE_SPEECH,
threshold=types.HarmBlockThreshold.OFF,
),
types.SafetySetting(
category=types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold=types.HarmBlockThreshold.OFF,
),
types.SafetySetting(
category=types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
threshold=types.HarmBlockThreshold.OFF,
),
types.SafetySetting(
category=types.HarmCategory.HARM_CATEGORY_HARASSMENT,
threshold=types.HarmBlockThreshold.OFF,
),
]
base_kwargs.update(
thinking_config=ThinkingConfig(thinking_level="MEDIUM"),
safety_settings=safety_settings,
)
return google.LLM(**base_kwargs)
If you want, I can:
• show how to set include_thoughts=False, or
• provide an example using a Gemini model that specifically supports thinking (e.g., the 2.5 flash native audio preview) — which would require swapping the model name. Which would you prefer?lemon-match-18357
12/19/2025, 8:06 PMtall-airline-16756
12/19/2025, 8:06 PMthinking_level="LOW" but ThinkingConfig doesn’t accept thinking_level (Pydantic rejects it). Use include_thoughts instead.
Quick corrected patch for your factory:
from google.genai import types
from livekit.plugins import google
from google.genai.types import ThinkingConfig
def create_google_llm_with_config(converse_type: str | None = None) -> google.LLM:
base_kwargs = dict(
model="gemini-3-flash-preview",
temperature=0.7,
top_p=0.9,
top_k=40,
)
if converse_type in ("singlePrompt", "singlePrompt2"):
base_kwargs.update(
# disable model verbalizing internal thoughts
thinking_config=ThinkingConfig(include_thoughts=False)
)
return google.LLM(**base_kwargs)
else:
safety_settings = [
types.SafetySetting(
category=types.HarmCategory.HARM_CATEGORY_HATE_SPEECH,
threshold=types.HarmBlockThreshold.OFF,
),
types.SafetySetting(
category=types.HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
threshold=types.HarmBlockThreshold.OFF,
),
types.SafetySetting(
category=types.HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
threshold=types.HarmBlockThreshold.OFF,
),
types.SafetySetting(
category=types.HarmCategory.HARM_CATEGORY_HARASSMENT,
threshold=types.HarmBlockThreshold.OFF,
),
]
base_kwargs.update(
thinking_config=ThinkingConfig(include_thoughts=False),
safety_settings=safety_settings,
)
return google.LLM(**base_kwargs)
If you want the model to emit its thoughts (e.g., forwarded as transcripts), set include_thoughts=True. Want me to show an example switching to a Gemini model that explicitly supports thinking (like the 2.5 flash native audio preview)?
Sources: Gemini Live API plugin | LiveKit docs