{"record":{"id":"d78dd43f57cfc48b","repo":"microsoft/semantic-kernel","slug":"the-inner-get-chat-message-contents-method-is-not","errorCode":null,"errorMessage":"The _inner_get_chat_message_contents method is not implemented.","messagePattern":"The _inner_get_chat_message_contents method is not implemented\\.","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"python/semantic_kernel/connectors/ai/chat_completion_client_base.py","lineNumber":58,"sourceCode":"    instruction_role: str = Field(default_factory=lambda: \"system\", description=\"The role for instructions.\")\n\n    # region Internal methods to be implemented by the derived classes\n\n    async def _inner_get_chat_message_contents(\n        self,\n        chat_history: \"ChatHistory\",\n        settings: \"PromptExecutionSettings\",\n    ) -> list[\"ChatMessageContent\"]:\n        \"\"\"Send a chat request to the AI service.\n\n        Args:\n            chat_history (ChatHistory): The chat history to send.\n            settings (PromptExecutionSettings): The settings for the request.\n\n        Returns:\n            chat_message_contents (list[ChatMessageContent]): The chat message contents representing the response(s).\n        \"\"\"\n        raise NotImplementedError(\"The _inner_get_chat_message_contents method is not implemented.\")\n\n    async def _inner_get_streaming_chat_message_contents(\n        self,\n        chat_history: \"ChatHistory\",\n        settings: \"PromptExecutionSettings\",\n        function_invoke_attempt: int = 0,\n    ) -> AsyncGenerator[list[\"StreamingChatMessageContent\"], Any]:\n        \"\"\"Send a streaming chat request to the AI service.\n\n        Args:\n            chat_history: The chat history to send.\n            settings: The settings for the request.\n            function_invoke_attempt: The current attempt count for automatically invoking functions.\n\n        Yields:\n            streaming_chat_message_contents: The streaming chat message contents.\n        \"\"\"\n        raise NotImplementedError(\"The _inner_get_streaming_chat_message_contents method is not implemented.\")","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/python/semantic_kernel/connectors/ai/chat_completion_client_base.py#L40-L76","documentation":"Raised by the base ChatCompletionClientBase._inner_get_chat_message_contents stub. It is the default implementation meant to be overridden by each concrete chat completion connector; calling it directly means the subclass never provided a non-streaming chat handler.","triggerScenarios":"Instantiating a chat completion service that subclasses ChatCompletionClientBase but does not override _inner_get_chat_message_contents, then calling get_chat_message_contents/get_chat_message_content. Also fires in tests using a raw base instance.","commonSituations":"A custom connector class that forgot to implement the non-streaming method; a service that only implements streaming but the caller used the non-streaming API; a mock/stub subclass missing the override.","solutions":["Implement 'async def _inner_get_chat_message_contents(self, chat_history, settings) -> list[ChatMessageContent]' in your service subclass.","If you are calling a real provider, use the shipped connector class (e.g. AzureChatCompletion, OpenAIChatCompletion) rather than the abstract base.","If your service is streaming-only, call get_streaming_chat_message_contents instead."],"exampleFix":"# before\nclass MyService(ChatCompletionClientBase): ...\nawait my_service.get_chat_message_contents(history, settings)\n# after\nclass MyService(ChatCompletionClientBase):\n    async def _inner_get_chat_message_contents(self, chat_history, settings):\n        return [ChatMessageContent(role=AuthorRole.ASSISTANT, items=[TextContent(text=\"hi\")])]","handlingStrategy":"type-guard","validationCode":"def service_implements_non_streaming(service) -> bool:\n    import inspect\n    from semantic_kernel.connectors.ai.chat_completion_client_base import ChatCompletionClientBase\n    method = getattr(service, \"_inner_get_chat_message_contents\", None)\n    base_method = ChatCompletionClientBase._inner_get_chat_message_contents\n    return method is not None and method.__func__ is not base_method","typeGuard":"import inspect\nfrom semantic_kernel.connectors.ai.chat_completion_client_base import ChatCompletionClientBase\n\ndef overrides_non_streaming_chat(cls: type) -> bool:\n    m = cls.__dict__.get(\"_inner_get_chat_message_contents\")\n    return callable(m)","tryCatchPattern":"try:\n    completions = await service.get_chat_message_contents(history, settings)\nexcept NotImplementedError as e:\n    if \"_inner_get_chat_message_contents\" in str(e):\n        raise NotImplementedError(\"Service subclass must implement _inner_get_chat_message_contents\") from e\n    raise","preventionTips":["Always override _inner_get_chat_message_contents in custom chat completion services.","Use shipped connector classes (AzureChatCompletion, OpenAIChatCompletion) for real providers.","If the service is streaming-only, call the streaming API instead."],"tags":["chat-completion","abstract-method","not-implemented","extensibility"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}