Move system_instruction into LLMSettings

Add `system_instruction` field to `LLMSettings` so it is runtime-updatable via settings.
For Google (GoogleLLMService, GoogleVertexLLMService), deprecate the init-time arg since it was already shipped. For Anthropic, AWS Bedrock, and OpenAI, remove the init-time arg entirely since it was never shipped.

Add system instruction prepend logic to `build_chat_completion_params` overrides in Cerebras, SambaNova, Fireworks, Mistral, and Perplexity, which build params from scratch rather than calling `super()`.

Still need to handle realtime services (OpenAI Realtime, Grok Realtime, Gemini Live).
This commit is contained in:
Paul Kompfner
2026-03-05 14:03:32 -05:00
parent 1fcae91e5d
commit 560d2306e8
223 changed files with 860 additions and 424 deletions

View File

@@ -24,7 +24,7 @@ from pipecat.processors.aggregators.llm_response_universal import (
)
from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings
from pipecat.services.deepgram.stt import DeepgramSTTService
from pipecat.services.google.llm import GoogleLLMService
from pipecat.services.google.llm import GoogleLLMService, GoogleLLMSettings
from pipecat.services.heygen.api_liveavatar import LiveAvatarNewSessionRequest
from pipecat.transports.heygen.transport import HeyGenParams, HeyGenTransport, ServiceType
@@ -63,7 +63,9 @@ async def main():
llm = GoogleLLMService(
api_key=os.getenv("GOOGLE_API_KEY"),
system_instruction="You are a helpful assistant. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Be succinct and respond to what the user said in a creative and helpful way.",
settings=GoogleLLMSettings(
system_instruction="You are a helpful assistant. Your output will be spoken aloud, so avoid special characters that can't easily be spoken, such as emojis or bullet points. Be succinct and respond to what the user said in a creative and helpful way.",
),
)
context = LLMContext()