Repository: roboflow/supervision
File: src/supervision/detection/core.py (Python)

Code before:
                gemini_response_text,
                resolution_wh=(1000, 1000),
                classes=['cat', 'dog'],
            )

            detections.xyxy
            # array([[543., 40., 728., 200.], [653., 352., 820., 522.]])

            detections.data
            # {'class_name': array(['cat', 'dog'], dtype='<U26')}

            detections.class_id
            # array([0, 1])
            ```

        !!! example "Gemini 2.5"

            ??? tip "Prompt engineering"

                To get the best results from Google Gemini 2.5, use the following prompt.

                This prompt is designed to detect all visible objects in the image,
                including small, distant, or partially visible ones, and to return
                tight bounding boxes.

                According to the [Gemini API documentation on image prompts](https://ai.google.dev/gemini-api/docs/vision?hl=en),
                when using a single image with text, place the text prompt after the image
                part in the `contents` array. For example, with the `google-genai` client:

                ```python
                response = model.generate_content(
                    [
                        {
                            "role": "user",
                            "parts": [
                                types.Part.from_bytes(image_bytes, mime_type="image/png"),
                                types.Part.from_text(prompt),
                            ],
                        }
                    ]
                )
                ```

                This ordering has been shown to produce significantly better results in practice.

                ```
                Carefully examine this image and detect ALL visible objects, including
                small, distant, or partially visible ones.

                IMPORTANT: Focus on finding as many objects as possible, even if you are
                only moderately confident.

Review comment (suggestion):
```suggestion
                According to the [Gemini API documentation on image prompts](
                https://ai.google.dev/gemini-api/docs/vision?hl=en),
```

Code after:
                sv.VLM.GOOGLE_GEMINI_2_0,
                gemini_response_text,
                resolution_wh=(1000, 1000),
                classes=['cat', 'dog'],
            )

            detections.xyxy
            # array([[543., 40., 728., 200.], [653., 352., 820., 522.]])

            detections.data
            # {'class_name': array(['cat', 'dog'], dtype='<U26')}

            detections.class_id
            # array([0, 1])
            ```

        !!! example "Gemini 2.5"

            ??? tip "Prompt engineering"

                To get the best results from Google Gemini 2.5, use the following prompt.

                This prompt is designed to detect all visible objects in the image,
                including small, distant, or partially visible ones, and to return
                tight bounding boxes.

                According to the [Gemini API documentation on image prompts](
                https://ai.google.dev/gemini-api/docs/vision?hl=en),
                when using a single image with text, place the text prompt after the image
                part in the `contents` array. For example, with the `google-genai` client:

                ```python
                response = model.generate_content(
                    [
                        {
                            "role": "user",
                            "parts": [
                                types.Part.from_bytes(image_bytes, mime_type="image/png"),
                                types.Part.from_text(prompt),
                            ],
                        }
                    ]
                )
                ```

                This ordering has been shown to produce significantly better results in practice.

                ```
                Carefully examine this image and detect ALL visible objects, including
                small, distant, or partially visible ones.