Repository: prism-php/prism (PHP)

Issue:
Gemini Caching not working
I tried using caching in Gemini as such:

```php
 $response = Prism::structured()
                ->using(Provider::Gemini, 'gemini-2.5-flash')
                ->usingTemperature(0.0)
                ->withSystemPrompt($systemPrompt)
                ->withPrompt($inputText)
                ->withSchema($schema)
                ->withProviderOptions(['cachedContentName' => $cachedObjectName])
                ->asStructured();
```

It throws an `Prism\Prism\Exceptions\PrismException` with error message 
```
Gemini Error: [400] CachedContent can not be used with GenerateContent request setting system_instruction, tools or tool_config.

Proposed fix: move those values to CachedContent from GenerateContent request.
```

 `cachedObjectName` is working as expected(`cachedContents/stringofcharacters`), so the cache upload part is working. 

(side note: Gemini provider docs are missing caching docs, so I mostly referenced #219 on how to utilise it)




Discussion: Ok nvm, so I figured it out.  I was including `->withSystemPrompt($systemPrompt)`, which wasn't needed anymore.

However, the metadata still seems to indicate no caching, but my prompt and response are as expected, which means it is getting system prompt from the cache.
`{"promptTokens":2845,"completionTokens":16,"cacheWriteInputTokens":null,"cacheReadInputTokens":null,"thoughtTokens":610}}} `

I'll leave this open so this can act as the issue for the missing caching docs in gemini

Edit: I manually checked response->json() at https://github.com/prism-php/prism/blob/fd1ac9a4dd77c3b3caea783881fd2e752a548103/src/Providers/Gemini/Handlers/Structured.php#L76
It gives
```php
{
    "usageMetadata": {
        "promptTokenCount": 2844,
        "candidatesTokenCount": 16,
        "totalTokenCount": 3280,
        "cachedContentTokenCount": 2821,
        "promptTokensDetails": [
            {
                "modality": "TEXT",
                "tokenCount": 2844
            }
        ],
        "cacheTokensDetails": [
            {
                "modality": "TEXT",
                "tokenCount": 2821
            }
        ],
        "thoughtsTokenCount": 420
    }
}
``` 
whereas  `$response->usage` when doing  `$response = Prism::structured() `gives 
```php
{"promptTokens":2844,"completionTokens":16,"cacheWriteInputTokens":null,"cacheReadInputTokens":null,"thoughtTokens":420}}} 
```
@sixlive  taking a look at it will check if metadata is properly  added into  Structured Response.



Fix (patch):
diff --git a/src/Providers/Gemini/Handlers/Structured.php b/src/Providers/Gemini/Handlers/Structured.php
index 482dffa0a..73bf67846 100644
--- a/src/Providers/Gemini/Handlers/Structured.php
+++ b/src/Providers/Gemini/Handlers/Structured.php
@@ -110,6 +110,7 @@ protected function addStep(array $data, Request $request): void
                     promptTokens: data_get($data, 'usageMetadata.promptTokenCount', 0),
                     completionTokens: data_get($data, 'usageMetadata.candidatesTokenCount', 0),
                     thoughtTokens: data_get($data, 'usageMetadata.thoughtsTokenCount', null),
+                    cacheReadInputTokens: data_get($data, 'usageMetadata.cachedContentTokenCount', null),
                 ),
                 meta: new Meta(
                     id: data_get($data, 'id', ''),