From de5c77407dc111d1c370a9f83c53888470ccf9b6 Mon Sep 17 00:00:00 2001 From: webjoin111 <455457521@qq.com> Date: Fri, 12 Dec 2025 17:07:00 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat(search):=20=E4=B8=BA=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8A=9F=E8=83=BD=E9=BB=98=E8=AE=A4=E5=90=AF=E7=94=A8?= =?UTF-8?q?=20Gemini=20Google=20Search=20=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zhenxun/services/llm/api.py | 3 ++- zhenxun/services/llm/session.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/zhenxun/services/llm/api.py b/zhenxun/services/llm/api.py index 644c6de0..524fac08 100644 --- a/zhenxun/services/llm/api.py +++ b/zhenxun/services/llm/api.py @@ -30,6 +30,7 @@ from .types import ( ToolChoice, ) from .types.exceptions import get_user_friendly_error_message +from .types.models import GeminiGoogleSearch from .utils import create_multimodal_message T = TypeVar("T", bound=BaseModel) @@ -302,7 +303,6 @@ async def _generate_image_from_message( messages = await normalize_to_llm_messages(message) async with await get_model_instance(model) as model_instance: - response = await model_instance.generate_response(messages, config=config) if not response.images: @@ -403,4 +403,5 @@ async def search( model=model, instruction=instruction, config=final_config, + tools=[GeminiGoogleSearch()], ) diff --git a/zhenxun/services/llm/session.py b/zhenxun/services/llm/session.py index 5f2e646b..c1cdb678 100644 --- a/zhenxun/services/llm/session.py +++ b/zhenxun/services/llm/session.py @@ -445,6 +445,7 @@ class AI: instruction=instruction, template_vars=template_vars, config=search_config, + tools=[GeminiGoogleSearch()], ) async def generate_structured(