Merge pull request #4233 from pipecat-ai/mb/remove-unused-imports-2026-04-02

Remove unused imports across codebase
This commit is contained in:
Mark Backman
2026-04-03 07:26:13 -04:00
committed by GitHub
28 changed files with 12 additions and 75 deletions

View File

@@ -6,7 +6,6 @@
import asyncio import asyncio
import os import os
from typing import Any
from dotenv import load_dotenv from dotenv import load_dotenv
from loguru import logger from loguru import logger

View File

@@ -25,7 +25,6 @@ from pipecat.runner.utils import create_transport
from pipecat.services.cartesia.tts import CartesiaTTSService from pipecat.services.cartesia.tts import CartesiaTTSService
from pipecat.services.openai.llm import OpenAILLMService from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.whisper.stt import MLXModel, WhisperSTTServiceMLX from pipecat.services.whisper.stt import MLXModel, WhisperSTTServiceMLX
from pipecat.transcriptions.language import Language
from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.base_transport import BaseTransport, TransportParams
from pipecat.transports.daily.transport import DailyParams from pipecat.transports.daily.transport import DailyParams
from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams

View File

@@ -25,7 +25,6 @@ from pipecat.runner.utils import create_transport
from pipecat.services.cartesia.tts import CartesiaTTSService from pipecat.services.cartesia.tts import CartesiaTTSService
from pipecat.services.openai.llm import OpenAILLMService from pipecat.services.openai.llm import OpenAILLMService
from pipecat.services.whisper.stt import Model, WhisperSTTService from pipecat.services.whisper.stt import Model, WhisperSTTService
from pipecat.transcriptions.language import Language
from pipecat.transports.base_transport import BaseTransport, TransportParams from pipecat.transports.base_transport import BaseTransport, TransportParams
from pipecat.transports.daily.transport import DailyParams from pipecat.transports.daily.transport import DailyParams
from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams from pipecat.transports.websocket.fastapi import FastAPIWebsocketParams

View File

@@ -28,7 +28,6 @@ from pipecat.frames.frames import (
Frame, Frame,
OutputImageRawFrame, OutputImageRawFrame,
StartFrame, StartFrame,
SystemFrame,
) )
from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.pipeline import Pipeline
from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.runner import PipelineRunner

View File

@@ -16,7 +16,7 @@ from loguru import logger
from pipecat.adapters.base_llm_adapter import BaseLLMAdapter from pipecat.adapters.base_llm_adapter import BaseLLMAdapter
from pipecat.adapters.schemas.function_schema import FunctionSchema from pipecat.adapters.schemas.function_schema import FunctionSchema
from pipecat.adapters.schemas.tools_schema import AdapterType, ToolsSchema from pipecat.adapters.schemas.tools_schema import ToolsSchema
from pipecat.processors.aggregators.llm_context import LLMContext, LLMContextMessage from pipecat.processors.aggregators.llm_context import LLMContext, LLMContextMessage

View File

@@ -19,7 +19,7 @@ from loguru import logger
from pipecat.adapters.base_llm_adapter import BaseLLMAdapter from pipecat.adapters.base_llm_adapter import BaseLLMAdapter
from pipecat.adapters.schemas.function_schema import FunctionSchema from pipecat.adapters.schemas.function_schema import FunctionSchema
from pipecat.adapters.schemas.tools_schema import AdapterType, ToolsSchema from pipecat.adapters.schemas.tools_schema import ToolsSchema
from pipecat.processors.aggregators.llm_context import LLMContext, LLMContextMessage from pipecat.processors.aggregators.llm_context import LLMContext, LLMContextMessage
from pipecat.services.xai.realtime import events from pipecat.services.xai.realtime import events

View File

@@ -15,7 +15,7 @@ from loguru import logger
from pipecat.adapters.base_llm_adapter import BaseLLMAdapter from pipecat.adapters.base_llm_adapter import BaseLLMAdapter
from pipecat.adapters.schemas.function_schema import FunctionSchema from pipecat.adapters.schemas.function_schema import FunctionSchema
from pipecat.adapters.schemas.tools_schema import AdapterType, ToolsSchema from pipecat.adapters.schemas.tools_schema import ToolsSchema
from pipecat.processors.aggregators.llm_context import LLMContext, LLMContextMessage from pipecat.processors.aggregators.llm_context import LLMContext, LLMContextMessage
from pipecat.services.openai.realtime import events from pipecat.services.openai.realtime import events

View File

@@ -18,7 +18,6 @@ from pipecat.processors.aggregators.llm_context import (
LLMContext, LLMContext,
LLMContextMessage, LLMContextMessage,
LLMSpecificMessage, LLMSpecificMessage,
NotGiven,
) )

View File

@@ -19,7 +19,7 @@ import base64
import io import io
import wave import wave
from dataclasses import dataclass from dataclasses import dataclass
from typing import TYPE_CHECKING, Any, List, Optional, TypeAlias, Union from typing import Any, List, Optional, TypeAlias, Union
from loguru import logger from loguru import logger
from openai._types import NOT_GIVEN as OPEN_AI_NOT_GIVEN from openai._types import NOT_GIVEN as OPEN_AI_NOT_GIVEN
@@ -30,7 +30,7 @@ from openai.types.chat import (
) )
from PIL import Image from PIL import Image
from pipecat.adapters.schemas.tools_schema import AdapterType, ToolsSchema from pipecat.adapters.schemas.tools_schema import ToolsSchema
from pipecat.frames.frames import AudioRawFrame from pipecat.frames.frames import AudioRawFrame
# "Re-export" types from OpenAI that we're using as universal context types. # "Re-export" types from OpenAI that we're using as universal context types.

View File

@@ -13,8 +13,6 @@ configurations and event-driven processing.
from typing import Optional from typing import Optional
from loguru import logger
from pipecat.audio.utils import create_stream_resampler, interleave_stereo_audio, mix_audio from pipecat.audio.utils import create_stream_resampler, interleave_stereo_audio, mix_audio
from pipecat.frames.frames import ( from pipecat.frames.frames import (
BotStartedSpeakingFrame, BotStartedSpeakingFrame,

View File

@@ -9,7 +9,7 @@
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any, Optional from typing import Any, Optional
from pipecat.frames.frames import DataFrame, SystemFrame from pipecat.frames.frames import SystemFrame
@dataclass @dataclass

View File

@@ -11,17 +11,13 @@ including support for function calling, vision, and prompt caching features.
""" """
import asyncio import asyncio
import base64
import copy
import io
import json import json
import re import re
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Any, Dict, List, Literal, Optional, Union from typing import Any, Dict, Literal, Optional, Union
import httpx import httpx
from loguru import logger from loguru import logger
from PIL import Image
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from pipecat.adapters.services.anthropic_adapter import ( from pipecat.adapters.services.anthropic_adapter import (
@@ -30,9 +26,6 @@ from pipecat.adapters.services.anthropic_adapter import (
) )
from pipecat.frames.frames import ( from pipecat.frames.frames import (
Frame, Frame,
FunctionCallCancelFrame,
FunctionCallInProgressFrame,
FunctionCallResultFrame,
LLMContextFrame, LLMContextFrame,
LLMEnablePromptCachingFrame, LLMEnablePromptCachingFrame,
LLMFullResponseEndFrame, LLMFullResponseEndFrame,
@@ -40,7 +33,6 @@ from pipecat.frames.frames import (
LLMThoughtEndFrame, LLMThoughtEndFrame,
LLMThoughtStartFrame, LLMThoughtStartFrame,
LLMThoughtTextFrame, LLMThoughtTextFrame,
UserImageRawFrame,
) )
from pipecat.metrics.metrics import LLMTokenUsage from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_context import LLMContext
@@ -51,7 +43,7 @@ from pipecat.services.settings import LLMSettings, _NotGiven, is_given
from pipecat.utils.tracing.service_decorators import traced_llm from pipecat.utils.tracing.service_decorators import traced_llm
try: try:
from anthropic import NOT_GIVEN, APITimeoutError, AsyncAnthropic, NotGiven from anthropic import NOT_GIVEN, APITimeoutError, AsyncAnthropic
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
logger.error(f"Exception: {e}") logger.error(f"Exception: {e}")
logger.error("In order to use Anthropic, you need to `pip install pipecat-ai[anthropic]`.") logger.error("In order to use Anthropic, you need to `pip install pipecat-ai[anthropic]`.")

View File

@@ -12,9 +12,6 @@ function calling.
""" """
import asyncio import asyncio
import base64
import copy
import io
import json import json
import os import os
import re import re
@@ -22,7 +19,6 @@ from dataclasses import dataclass, field
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
from loguru import logger from loguru import logger
from PIL import Image
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from pipecat.adapters.services.bedrock_adapter import ( from pipecat.adapters.services.bedrock_adapter import (
@@ -31,15 +27,11 @@ from pipecat.adapters.services.bedrock_adapter import (
) )
from pipecat.frames.frames import ( from pipecat.frames.frames import (
Frame, Frame,
FunctionCallCancelFrame,
FunctionCallFromLLM, FunctionCallFromLLM,
FunctionCallInProgressFrame,
FunctionCallResultFrame,
LLMContextFrame, LLMContextFrame,
LLMEnablePromptCachingFrame, LLMEnablePromptCachingFrame,
LLMFullResponseEndFrame, LLMFullResponseEndFrame,
LLMFullResponseStartFrame, LLMFullResponseStartFrame,
UserImageRawFrame,
) )
from pipecat.metrics.metrics import LLMTokenUsage from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_context import LLMContext

View File

@@ -49,7 +49,6 @@ from pipecat.frames.frames import (
UserStoppedSpeakingFrame, UserStoppedSpeakingFrame,
) )
from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair
from pipecat.processors.frame_processor import FrameDirection from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import LLMService from pipecat.services.llm_service import LLMService
from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven

View File

@@ -16,7 +16,6 @@ from pydantic import BaseModel
from pipecat.frames.frames import ( from pipecat.frames.frames import (
ErrorFrame, ErrorFrame,
Frame, Frame,
StartFrame,
) )
from pipecat.services.deepgram.flux.base import ( from pipecat.services.deepgram.flux.base import (
DeepgramFluxSTTBase, DeepgramFluxSTTBase,

View File

@@ -16,7 +16,6 @@ import base64
import io import io
import time import time
import uuid import uuid
import warnings
from dataclasses import dataclass, field from dataclasses import dataclass, field
from enum import Enum from enum import Enum
from typing import Any, Dict, List, Optional, Union from typing import Any, Dict, List, Optional, Union
@@ -53,13 +52,11 @@ from pipecat.frames.frames import (
TTSStartedFrame, TTSStartedFrame,
TTSStoppedFrame, TTSStoppedFrame,
TTSTextFrame, TTSTextFrame,
UserImageRawFrame,
UserStartedSpeakingFrame, UserStartedSpeakingFrame,
UserStoppedSpeakingFrame, UserStoppedSpeakingFrame,
) )
from pipecat.metrics.metrics import LLMTokenUsage from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair
from pipecat.processors.frame_processor import FrameDirection from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.google.frames import LLMSearchOrigin, LLMSearchResponseFrame, LLMSearchResult from pipecat.services.google.frames import LLMSearchOrigin, LLMSearchResponseFrame, LLMSearchResult
from pipecat.services.google.utils import update_google_client_http_options from pipecat.services.google.utils import update_google_client_http_options
@@ -81,10 +78,8 @@ try:
AudioTranscriptionConfig, AudioTranscriptionConfig,
AutomaticActivityDetection, AutomaticActivityDetection,
Blob, Blob,
Content,
ContextWindowCompressionConfig, ContextWindowCompressionConfig,
EndSensitivity, EndSensitivity,
FileData,
FunctionResponse, FunctionResponse,
GenerationConfig, GenerationConfig,
GroundingMetadata, GroundingMetadata,
@@ -94,7 +89,6 @@ try:
LiveServerMessage, LiveServerMessage,
MediaResolution, MediaResolution,
Modality, Modality,
Part,
ProactivityConfig, ProactivityConfig,
RealtimeInputConfig, RealtimeInputConfig,
SessionResumptionConfig, SessionResumptionConfig,

View File

@@ -10,9 +10,7 @@ This module provides Google Gemini integration for the Pipecat framework,
including LLM services, context management, and message aggregation. including LLM services, context management, and message aggregation.
""" """
import base64
import io import io
import json
import os import os
import uuid import uuid
from dataclasses import dataclass, field from dataclasses import dataclass, field
@@ -25,11 +23,7 @@ from pydantic import BaseModel, Field
from pipecat.adapters.services.gemini_adapter import GeminiLLMAdapter, GeminiLLMInvocationParams from pipecat.adapters.services.gemini_adapter import GeminiLLMAdapter, GeminiLLMInvocationParams
from pipecat.frames.frames import ( from pipecat.frames.frames import (
AssistantImageRawFrame, AssistantImageRawFrame,
AudioRawFrame,
Frame, Frame,
FunctionCallCancelFrame,
FunctionCallInProgressFrame,
FunctionCallResultFrame,
LLMContextFrame, LLMContextFrame,
LLMFullResponseEndFrame, LLMFullResponseEndFrame,
LLMFullResponseStartFrame, LLMFullResponseStartFrame,
@@ -59,14 +53,9 @@ try:
from google import genai from google import genai
from google.api_core.exceptions import DeadlineExceeded from google.api_core.exceptions import DeadlineExceeded
from google.genai.types import ( from google.genai.types import (
Blob,
Content,
FunctionCall,
FunctionResponse,
GenerateContentConfig, GenerateContentConfig,
GenerateContentResponse, GenerateContentResponse,
HttpOptions, HttpOptions,
Part,
) )
# Temporary hack to be able to process Nano Banana returned images. # Temporary hack to be able to process Nano Banana returned images.

View File

@@ -7,7 +7,6 @@
"""Base classes for Large Language Model services with function calling support.""" """Base classes for Large Language Model services with function calling support."""
import asyncio import asyncio
import inspect
import json import json
import warnings import warnings
from dataclasses import dataclass from dataclasses import dataclass

View File

@@ -7,11 +7,10 @@
"""Base LLM service implementation for services that use the AsyncOpenAI client.""" """Base LLM service implementation for services that use the AsyncOpenAI client."""
import asyncio import asyncio
import base64
import json import json
from contextlib import asynccontextmanager from contextlib import asynccontextmanager
from dataclasses import dataclass, field from dataclasses import dataclass, field
from typing import Any, Dict, List, Mapping, Optional from typing import Any, Dict, Mapping, Optional
import httpx import httpx
from loguru import logger from loguru import logger
@@ -22,7 +21,7 @@ from openai import (
AsyncStream, AsyncStream,
DefaultAsyncHttpxClient, DefaultAsyncHttpxClient,
) )
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam from openai.types.chat import ChatCompletionChunk
from pydantic import BaseModel, Field from pydantic import BaseModel, Field
from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams

View File

@@ -6,18 +6,10 @@
"""OpenAI LLM service implementation with context aggregators.""" """OpenAI LLM service implementation with context aggregators."""
import json from typing import Optional
from dataclasses import dataclass
from typing import Any, Optional
from openai import NOT_GIVEN from openai import NOT_GIVEN
from pipecat.frames.frames import (
FunctionCallCancelFrame,
FunctionCallInProgressFrame,
FunctionCallResultFrame,
UserImageRawFrame,
)
from pipecat.services.openai.base_llm import BaseOpenAILLMService from pipecat.services.openai.base_llm import BaseOpenAILLMService

View File

@@ -48,7 +48,6 @@ from pipecat.frames.frames import (
) )
from pipecat.metrics.metrics import LLMTokenUsage from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair
from pipecat.processors.frame_processor import FrameDirection from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import FunctionCallFromLLM, LLMService from pipecat.services.llm_service import FunctionCallFromLLM, LLMService
from pipecat.services.settings import ( from pipecat.services.settings import (

View File

@@ -14,8 +14,6 @@ reporting patterns while maintaining compatibility with the Pipecat framework.
from dataclasses import dataclass from dataclasses import dataclass
from typing import Optional from typing import Optional
from loguru import logger
from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams from pipecat.adapters.services.open_ai_adapter import OpenAILLMInvocationParams
from pipecat.adapters.services.perplexity_adapter import PerplexityLLMAdapter from pipecat.adapters.services.perplexity_adapter import PerplexityLLMAdapter
from pipecat.metrics.metrics import LLMTokenUsage from pipecat.metrics.metrics import LLMTokenUsage

View File

@@ -53,12 +53,10 @@ from pipecat.frames.frames import (
EndFrame, EndFrame,
ErrorFrame, ErrorFrame,
Frame, Frame,
LLMFullResponseEndFrame,
StartFrame, StartFrame,
TTSAudioRawFrame, TTSAudioRawFrame,
TTSStoppedFrame, TTSStoppedFrame,
) )
from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.sarvam._sdk import sdk_headers from pipecat.services.sarvam._sdk import sdk_headers
from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven from pipecat.services.settings import NOT_GIVEN, TTSSettings, _NotGiven
from pipecat.services.tts_service import InterruptibleTTSService, TextAggregationMode, TTSService from pipecat.services.tts_service import InterruptibleTTSService, TextAggregationMode, TTSService

View File

@@ -46,7 +46,6 @@ from pipecat.frames.frames import (
VADUserStoppedSpeakingFrame, VADUserStoppedSpeakingFrame,
) )
from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair
from pipecat.processors.frame_processor import FrameDirection from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import FunctionCallFromLLM, LLMService from pipecat.services.llm_service import FunctionCallFromLLM, LLMService
from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven from pipecat.services.settings import NOT_GIVEN, LLMSettings, _NotGiven

View File

@@ -46,9 +46,6 @@ from pipecat.frames.frames import (
) )
from pipecat.metrics.metrics import LLMTokenUsage from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_context import LLMContext
from pipecat.processors.aggregators.llm_response_universal import (
LLMContextAggregatorPair,
)
from pipecat.processors.frame_processor import FrameDirection from pipecat.processors.frame_processor import FrameDirection
from pipecat.services.llm_service import FunctionCallFromLLM, LLMService from pipecat.services.llm_service import FunctionCallFromLLM, LLMService
from pipecat.services.settings import ( from pipecat.services.settings import (

View File

@@ -20,7 +20,6 @@ from loguru import logger
from pydantic import BaseModel from pydantic import BaseModel
from pipecat.audio.utils import create_stream_resampler from pipecat.audio.utils import create_stream_resampler
from pipecat.audio.vad.vad_analyzer import VADAnalyzer
from pipecat.frames.frames import ( from pipecat.frames.frames import (
AudioRawFrame, AudioRawFrame,
BotConnectedFrame, BotConnectedFrame,

View File

@@ -23,7 +23,7 @@ if TYPE_CHECKING:
from opentelemetry import context as context_api from opentelemetry import context as context_api
from opentelemetry import trace from opentelemetry import trace
from pipecat.processors.aggregators.llm_context import NOT_GIVEN, LLMContext from pipecat.processors.aggregators.llm_context import NOT_GIVEN
from pipecat.utils.tracing.service_attributes import ( from pipecat.utils.tracing.service_attributes import (
add_gemini_live_span_attributes, add_gemini_live_span_attributes,
add_llm_span_attributes, add_llm_span_attributes,

View File

@@ -7,7 +7,6 @@
from unittest.mock import AsyncMock, MagicMock, patch from unittest.mock import AsyncMock, MagicMock, patch
import pytest import pytest
from anthropic import NOT_GIVEN
from openai import NotGiven from openai import NotGiven
from openai._types import NOT_GIVEN as OPENAI_NOT_GIVEN from openai._types import NOT_GIVEN as OPENAI_NOT_GIVEN