diff --git a/changelog/4314.changed.md b/changelog/4314.changed.md new file mode 100644 index 000000000..733958b55 --- /dev/null +++ b/changelog/4314.changed.md @@ -0,0 +1 @@ +- Reduced debug log noise for LLM services. The system instruction is now logged once when composed (e.g. when turn completion is enabled) instead of on every LLM call. Per-call logs now show only the conversation messages, consistent across Google, Anthropic, AWS, and OpenAI services. diff --git a/src/pipecat/services/anthropic/llm.py b/src/pipecat/services/anthropic/llm.py index 03286bee3..26e857122 100644 --- a/src/pipecat/services/anthropic/llm.py +++ b/src/pipecat/services/anthropic/llm.py @@ -345,9 +345,7 @@ class AnthropicLLMService(LLMService): adapter = self.get_llm_adapter() messages_for_logging = adapter.get_messages_for_logging(context) - logger.debug( - f"{self}: Generating chat from context [{params_from_context['system']}] | {messages_for_logging}" - ) + logger.debug(f"{self}: Generating chat from context {messages_for_logging}") await self.start_ttfb_metrics() diff --git a/src/pipecat/services/aws/llm.py b/src/pipecat/services/aws/llm.py index b146bd11a..e99ac6b3d 100644 --- a/src/pipecat/services/aws/llm.py +++ b/src/pipecat/services/aws/llm.py @@ -475,9 +475,7 @@ class AWSBedrockLLMService(LLMService): # Log request params with messages redacted for logging adapter = self.get_llm_adapter() messages_for_logging = adapter.get_messages_for_logging(context) - logger.debug( - f"{self}: Generating chat from context [{system}] | {messages_for_logging}" - ) + logger.debug(f"{self}: Generating chat from context {messages_for_logging}") async with self._aws_session.client( service_name="bedrock-runtime", **self._aws_params diff --git a/src/pipecat/services/google/llm.py b/src/pipecat/services/google/llm.py index 6268009ed..556a4037a 100644 --- a/src/pipecat/services/google/llm.py +++ b/src/pipecat/services/google/llm.py @@ -392,7 +392,7 @@ class GoogleLLMService(LLMService): ) logger.debug( - f"{self}: Generating chat from context [{params['system_instruction']}] | {adapter.get_messages_for_logging(context)}" + f"{self}: Generating chat from context {adapter.get_messages_for_logging(context)}" ) messages = params["messages"] diff --git a/src/pipecat/services/llm_service.py b/src/pipecat/services/llm_service.py index 979d5c430..2a6e0668e 100644 --- a/src/pipecat/services/llm_service.py +++ b/src/pipecat/services/llm_service.py @@ -347,6 +347,7 @@ class LLMService(UserTurnCompletionLLMServiceMixin, AIService): parts.append(ASYNC_TOOL_CANCELLATION_INSTRUCTIONS) composed = "\n\n".join(p for p in parts if p) self._settings.system_instruction = composed or None + logger.debug(f"{self}: System instruction composed: {self._settings.system_instruction}") async def _update_settings(self, delta: LLMSettings) -> dict[str, Any]: """Apply a settings delta, handling turn-completion fields.