tests(google): mock the new pipecat.version()

This commit is contained in:
Aleix Conchillo Flaqué
2025-12-08 11:44:45 -08:00
parent b0f63c3785
commit d289b38ba7
5 changed files with 23 additions and 27 deletions

View File

@@ -24,7 +24,6 @@ from loguru import logger
from PIL import Image
from pydantic import BaseModel, Field
from pipecat.services.google.utils import update_google_client_http_options
from pipecat.adapters.schemas.tools_schema import ToolsSchema
from pipecat.adapters.services.gemini_adapter import GeminiLLMAdapter
from pipecat.frames.frames import (
@@ -69,6 +68,7 @@ from pipecat.processors.aggregators.openai_llm_context import (
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.google.frames import LLMSearchOrigin, LLMSearchResponseFrame, LLMSearchResult
from pipecat.services.google.utils import update_google_client_http_options
from pipecat.services.llm_service import FunctionCallFromLLM, LLMService
from pipecat.services.openai.llm import (
OpenAIAssistantContextAggregator,

View File

@@ -22,9 +22,8 @@ from loguru import logger
from PIL import Image
from pydantic import BaseModel, Field
from pipecat.services.google.utils import update_google_client_http_options
from pipecat.frames.frames import ErrorFrame, Frame, URLImageRawFrame
from pipecat.services.google.utils import update_google_client_http_options
from pipecat.services.image_service import ImageGenService
try:
@@ -78,7 +77,7 @@ class GoogleImageGenService(ImageGenService):
# Add client header
http_options = update_google_client_http_options(http_options)
self._client = genai.Client(api_key=api_key, http_options=http_options)
self.set_model_name(self._params.model)

View File

@@ -22,7 +22,6 @@ from loguru import logger
from PIL import Image
from pydantic import BaseModel, Field
from pipecat.services.google.utils import update_google_client_http_options
from pipecat.adapters.services.gemini_adapter import GeminiLLMAdapter, GeminiLLMInvocationParams
from pipecat.frames.frames import (
AudioRawFrame,
@@ -51,6 +50,7 @@ from pipecat.processors.aggregators.openai_llm_context import (
)
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.google.frames import LLMSearchResponseFrame
from pipecat.services.google.utils import update_google_client_http_options
from pipecat.services.llm_service import FunctionCallFromLLM, LLMService
from pipecat.services.openai.llm import (
OpenAIAssistantContextAggregator,

View File

@@ -4,9 +4,11 @@
# SPDX-License-Identifier: BSD 2-Clause License
#
"""Utility functions for Google services."""
from typing import Any, Dict, Optional, Union
from pipecat import __version__ as pipecat_version
from pipecat import version as pipecat_version
def update_google_client_http_options(http_options: Optional[Union[Dict[str, Any], Any]]) -> Any:
@@ -19,7 +21,7 @@ def update_google_client_http_options(http_options: Optional[Union[Dict[str, Any
Returns:
The updated http_options.
"""
client_header = {"x-goog-api-client": f"pipecat/{pipecat_version}"}
client_header = {"x-goog-api-client": f"pipecat/{pipecat_version()}"}
if http_options is None:
http_options = {"headers": client_header}