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:
@@ -25,7 +25,7 @@ from pipecat.processors.aggregators.llm_response_universal import (
|
||||
from pipecat.runner.types import RunnerArguments
|
||||
from pipecat.runner.utils import create_transport
|
||||
from pipecat.services.cartesia.tts import CartesiaTTSService, CartesiaTTSSettings
|
||||
from pipecat.services.cerebras.llm import CerebrasLLMService
|
||||
from pipecat.services.cerebras.llm import CerebrasLLMService, CerebrasLLMSettings
|
||||
from pipecat.services.deepgram.stt import DeepgramSTTService
|
||||
from pipecat.services.llm_service import FunctionCallParams
|
||||
from pipecat.transports.base_transport import BaseTransport, TransportParams
|
||||
@@ -71,7 +71,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments):
|
||||
|
||||
llm = CerebrasLLMService(
|
||||
api_key=os.getenv("CEREBRAS_API_KEY"),
|
||||
system_instruction="""You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way.
|
||||
settings=CerebrasLLMSettings(
|
||||
system_instruction="""You are a helpful LLM in a WebRTC call. Your goal is to demonstrate your capabilities in a succinct way.
|
||||
|
||||
You have one functions available:
|
||||
|
||||
@@ -82,6 +83,7 @@ Infer whether to use Fahrenheit or Celsius automatically based on the location,
|
||||
Start by asking me for my location. Then, use 'get_weather_current' to give me a forecast.
|
||||
|
||||
Respond to what the user said in a creative and helpful way.""",
|
||||
),
|
||||
)
|
||||
# You can also register a function_name of None to get all functions
|
||||
# sent to the same callback with an additional function_name parameter.
|
||||
|
||||
Reference in New Issue
Block a user