def _complete(
        self, prompt: str, image_documents: Sequence[ImageNode], **kwargs: Any
    ) -> CompletionResponse:
        """Complete the prompt with image support."""
        message = generate_bedrock_multi_modal_message(
            prompt=prompt,
            image_documents=image_documents,
        )

        # Get model kwargs and prepare the request body
        model_kwargs = self._get_model_kwargs(**kwargs)
        if "body" in model_kwargs:
            model_kwargs["body"]["messages"] = [message]
        else:
            model_kwargs["body"] = {"messages": [message]}

        # Convert body to JSON string
        if isinstance(model_kwargs.get("body"), dict):
            import json

            body_str = json.dumps(model_kwargs["body"])
            del model_kwargs["body"]
        else:
            body_str = model_kwargs["body"]
            del model_kwargs["body"]

        response = invoke_model_with_retry(
            client=self._client,
            model=self.model,
            messages=body_str,
            max_retries=self.max_retries,
            **model_kwargs,
        )

        # Parse the streaming response body
        response_body = json.loads(response["body"].read())

        # Parse response based on model
        if self.model.startswith("anthropic.claude"):
            completion = response_body["content"][0]["text"]
        else:
            # Add support for other models as needed
            completion = response_body.get("completion", "")

        return CompletionResponse(
            text=completion,
            raw=response_body,
            additional_kwargs={
                "input_tokens": response["ResponseMetadata"]["HTTPHeaders"].get(
                    "x-amzn-bedrock-input-token-count"
                ),
                "output_tokens": response["ResponseMetadata"]["HTTPHeaders"].get(
                    "x-amzn-bedrock-output-token-count"
                ),
            },
        )
Complete the prompt with image support.
llama-index-integrations/multi_modal_llms/llama-index-multi-modal-llms-bedrock/llama_index/multi_modal_llms/bedrock/base.py