Merge pull request #1279 from pipecat-ai/mb/remove-open-optional-dep

Remove `openai` optional dependency from services as it's now required
This commit is contained in:
Mark Backman
2025-02-24 17:42:53 -05:00
committed by GitHub
8 changed files with 22 additions and 61 deletions

View File

@@ -45,11 +45,11 @@ Website = "https://pipecat.ai"
anthropic = [ "anthropic~=0.45.2" ] anthropic = [ "anthropic~=0.45.2" ]
assemblyai = [ "assemblyai~=0.36.0" ] assemblyai = [ "assemblyai~=0.36.0" ]
aws = [ "boto3~=1.35.99" ] aws = [ "boto3~=1.35.99" ]
azure = [ "azure-cognitiveservices-speech~=1.42.0", "openai~=1.59.6" ] azure = [ "azure-cognitiveservices-speech~=1.42.0"]
canonical = [ "aiofiles~=24.1.0" ] canonical = [ "aiofiles~=24.1.0" ]
cartesia = [ "cartesia~=1.3.1", "websockets~=13.1" ] cartesia = [ "cartesia~=1.3.1", "websockets~=13.1" ]
cerebras = [ "openai~=1.59.6" ] cerebras = []
deepseek = [ "openai~=1.59.6" ] deepseek = []
daily = [ "daily-python~=0.14.2" ] daily = [ "daily-python~=0.14.2" ]
deepgram = [ "deepgram-sdk~=3.8.0" ] deepgram = [ "deepgram-sdk~=3.8.0" ]
elevenlabs = [ "websockets~=13.1" ] elevenlabs = [ "websockets~=13.1" ]
@@ -57,10 +57,10 @@ fal = [ "fal-client~=0.5.6" ]
fish = [ "ormsgpack~=1.7.0", "websockets~=13.1" ] fish = [ "ormsgpack~=1.7.0", "websockets~=13.1" ]
gladia = [ "websockets~=13.1" ] gladia = [ "websockets~=13.1" ]
google = [ "google-cloud-speech~=2.31.0", "google-cloud-texttospeech~=2.25.0", "google-genai~=1.2.0", "google-generativeai~=0.8.4" ] google = [ "google-cloud-speech~=2.31.0", "google-cloud-texttospeech~=2.25.0", "google-genai~=1.2.0", "google-generativeai~=0.8.4" ]
grok = [ "openai~=1.59.6" ] grok = []
groq = [ "openai~=1.59.6" ] groq = []
gstreamer = [ "pygobject~=3.50.0" ] gstreamer = [ "pygobject~=3.50.0" ]
fireworks = [ "openai~=1.59.6" ] fireworks = []
krisp = [ "pipecat-ai-krisp~=0.3.0" ] krisp = [ "pipecat-ai-krisp~=0.3.0" ]
koala = [ "pvkoala~=2.0.3" ] koala = [ "pvkoala~=2.0.3" ]
langchain = [ "langchain~=0.3.14", "langchain-community~=0.3.14", "langchain-openai~=0.3.0" ] langchain = [ "langchain~=0.3.14", "langchain-community~=0.3.14", "langchain-openai~=0.3.0" ]
@@ -68,11 +68,11 @@ livekit = [ "livekit~=0.19.1", "livekit-api~=0.8.1", "tenacity~=9.0.0" ]
lmnt = [ "websockets~=13.1" ] lmnt = [ "websockets~=13.1" ]
local = [ "pyaudio~=0.2.14" ] local = [ "pyaudio~=0.2.14" ]
moondream = [ "einops~=0.8.0", "timm~=1.0.13", "transformers~=4.48.0" ] moondream = [ "einops~=0.8.0", "timm~=1.0.13", "transformers~=4.48.0" ]
nim = [ "openai~=1.59.6" ] nim = []
noisereduce = [ "noisereduce~=3.0.3" ] noisereduce = [ "noisereduce~=3.0.3" ]
openai = [ "openai~=1.59.6", "websockets~=13.1" ] openai = [ "websockets~=13.1" ]
openpipe = [ "openpipe~=4.45.0" ] openpipe = [ "openpipe~=4.45.0" ]
perplexity = [ "openai~=1.59.6" ] perplexity = []
playht = [ "pyht~=0.1.6", "websockets~=13.1" ] playht = [ "pyht~=0.1.6", "websockets~=13.1" ]
rime = [ "websockets~=13.1" ] rime = [ "websockets~=13.1" ]
riva = [ "nvidia-riva-client~=2.18.0" ] riva = [ "nvidia-riva-client~=2.18.0" ]
@@ -80,10 +80,10 @@ sentry = [ "sentry-sdk~=2.20.0" ]
silero = [ "onnxruntime~=1.20.1" ] silero = [ "onnxruntime~=1.20.1" ]
simli = [ "simli-ai~=0.1.10"] simli = [ "simli-ai~=0.1.10"]
soundfile = [ "soundfile~=0.13.0" ] soundfile = [ "soundfile~=0.13.0" ]
together = [ "openai~=1.59.6" ] together = []
websocket = [ "websockets~=13.1", "fastapi~=0.115.6" ] websocket = [ "websockets~=13.1", "fastapi~=0.115.6" ]
whisper = [ "faster-whisper~=1.1.1" ] whisper = [ "faster-whisper~=1.1.1" ]
openrouter = [ "openai~=1.59.6" ] openrouter = []
[tool.setuptools.packages.find] [tool.setuptools.packages.find]
# All the following settings are optional: # All the following settings are optional:

View File

@@ -10,6 +10,7 @@ from typing import AsyncGenerator, Optional
import aiohttp import aiohttp
from loguru import logger from loguru import logger
from openai import AsyncAzureOpenAI
from PIL import Image from PIL import Image
from pydantic import BaseModel from pydantic import BaseModel
@@ -48,7 +49,6 @@ try:
PushAudioInputStream, PushAudioInputStream,
) )
from azure.cognitiveservices.speech.dialog import AudioConfig from azure.cognitiveservices.speech.dialog import AudioConfig
from openai import AsyncAzureOpenAI
except ModuleNotFoundError as e: except ModuleNotFoundError as e:
logger.error(f"Exception: {e}") logger.error(f"Exception: {e}")
logger.error( logger.error(

View File

@@ -7,22 +7,12 @@
from typing import List from typing import List
from loguru import logger from loguru import logger
from openai import AsyncStream
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai import OpenAILLMService from pipecat.services.openai import OpenAILLMService
try:
from openai import (
AsyncStream,
)
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
except ModuleNotFoundError as e:
logger.error(f"Exception: {e}")
logger.error(
"In order to use Cerebras, you need to `pip install pipecat-ai[cerebras]`. Also, set `CEREBRAS_API_KEY` environment variable."
)
raise Exception(f"Missing module: {e}")
class CerebrasLLMService(OpenAILLMService): class CerebrasLLMService(OpenAILLMService):
"""A service for interacting with Cerebras's API using the OpenAI-compatible interface. """A service for interacting with Cerebras's API using the OpenAI-compatible interface.

View File

@@ -8,22 +8,12 @@
from typing import List from typing import List
from loguru import logger from loguru import logger
from openai import AsyncStream
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai import OpenAILLMService from pipecat.services.openai import OpenAILLMService
try:
from openai import (
AsyncStream,
)
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
except ModuleNotFoundError as e:
logger.error(f"Exception: {e}")
logger.error(
"In order to use DeepSeek, you need to `pip install pipecat-ai[deepseek]`. Also, set `DEEPSEEK_API_KEY` environment variable."
)
raise Exception(f"Missing module: {e}")
class DeepSeekLLMService(OpenAILLMService): class DeepSeekLLMService(OpenAILLMService):
"""A service for interacting with DeepSeek's API using the OpenAI-compatible interface. """A service for interacting with DeepSeek's API using the OpenAI-compatible interface.

View File

@@ -8,19 +8,11 @@
from typing import List from typing import List
from loguru import logger from loguru import logger
from openai.types.chat import ChatCompletionMessageParam
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai import OpenAILLMService from pipecat.services.openai import OpenAILLMService
try:
from openai.types.chat import ChatCompletionMessageParam
except ModuleNotFoundError as e:
logger.error(f"Exception: {e}")
logger.error(
"In order to use Fireworks, you need to `pip install pipecat-ai[fireworks]`. Also, set `FIREWORKS_API_KEY` environment variable."
)
raise Exception(f"Missing module: {e}")
class FireworksLLMService(OpenAILLMService): class FireworksLLMService(OpenAILLMService):
"""A service for interacting with Fireworks AI using the OpenAI-compatible interface. """A service for interacting with Fireworks AI using the OpenAI-compatible interface.

View File

@@ -7,12 +7,12 @@
from typing import Dict, List, Optional from typing import Dict, List, Optional
from loguru import logger from loguru import logger
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai import OpenAILLMService from pipecat.services.openai import OpenAILLMService
try: try:
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
from openpipe import AsyncOpenAI as OpenPipeAI from openpipe import AsyncOpenAI as OpenPipeAI
from openpipe import AsyncStream from openpipe import AsyncStream
except ModuleNotFoundError as e: except ModuleNotFoundError as e:

View File

@@ -7,24 +7,13 @@
from typing import List from typing import List
from loguru import logger from loguru import logger
from openai import NOT_GIVEN, AsyncStream
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
from pipecat.metrics.metrics import LLMTokenUsage from pipecat.metrics.metrics import LLMTokenUsage
from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext from pipecat.processors.aggregators.openai_llm_context import OpenAILLMContext
from pipecat.services.openai import OpenAILLMService from pipecat.services.openai import OpenAILLMService
try:
from openai import (
NOT_GIVEN,
AsyncStream,
)
from openai.types.chat import ChatCompletionChunk, ChatCompletionMessageParam
except ModuleNotFoundError as e:
logger.error(f"Exception: {e}")
logger.error(
"In order to use Perplexity, you need to `pip install pipecat-ai[perplexity]`. Also, set `PERPLEXITY_API_KEY` environment variable."
)
raise Exception(f"Missing module: {e}")
class PerplexityLLMService(OpenAILLMService): class PerplexityLLMService(OpenAILLMService):
"""A service for interacting with Perplexity's API. """A service for interacting with Perplexity's API.

View File

@@ -16,6 +16,7 @@ langchain~=0.2.14
livekit~=0.13.1 livekit~=0.13.1
lmnt~=1.1.4 lmnt~=1.1.4
loguru~=0.7.2 loguru~=0.7.2
Markdown~=3.7
numpy~=1.26.4 numpy~=1.26.4
openai~=1.37.2 openai~=1.37.2
openpipe~=4.24.0 openpipe~=4.24.0
@@ -29,5 +30,4 @@ silero-vad~=5.1
soxr~=0.5.0 soxr~=0.5.0
together~=1.2.7 together~=1.2.7
transformers~=4.48.0 transformers~=4.48.0
websockets~=13.1 websockets~=13.1
Markdown~=3.7