Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def chat(

if is_given(self._opts.cached_content):
extra["cached_content"] = self._opts.cached_content

if is_given(self._opts.media_resolution):
extra["media_resolution"] = self._opts.media_resolution

Expand Down Expand Up @@ -462,6 +462,18 @@ async def _run(self) -> None:
if tools_config and not using_cache:
self._extra_kwargs["tools"] = tools_config
elif using_cache:
dropped = [k for k in ("tools", "tool_config") if k in self._extra_kwargs]
if tools_config and "tools" not in dropped:
dropped.append("tools")
if extra_data.system_messages:
dropped.append("system_instruction")
if dropped:
logger.warning(
"dropping %s from Gemini request because cached_content=%r is set; "
"these fields must be baked into the CachedContent resource",
dropped,
self._extra_kwargs.get("cached_content"),
)
self._extra_kwargs.pop("tools", None)
self._extra_kwargs.pop("tool_config", None)
http_options = self._llm._opts.http_options or types.HttpOptions(
Expand Down
1 change: 0 additions & 1 deletion tests/test_plugin_google_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ async def example_tool(query: str) -> str:


class TestMediaResolution:

def test_llm_media_resolution_is_passed_to_stream_kwargs(self):
model = LLM(
api_key="test-api-key",
Expand Down
Loading