googleapis / googleapis/python-genai

System Instruction Error

Aperta
#425 13 commenti 2 reazioni 1 assegnatario Rivendicata da @jaycee-li Vedi su GitHub
priority: p2 type: bug
Lingua principale
Python
Stelle
4k
Fork
1k
Merge medio
2g 12h
PR unite (30g)
41

Descrizione

I kept trying this pattern:

```python
from google import genai
from google.genai import types
client = genai.Client()

response = client.models.generate_content_stream(
model='gemini-2.0-flash',
contents='Tell me a story in 100 words.',
config=types.GenerateContentConfig(
system_instruction='you are a story teller for kids under 5 years old',
max_output_tokens= 400,
temperature= 0
)
)
```

but I got this error from the API non stop (Invalid JSON payload received. Unknown name \\"systemInstruction\\"):

```text
Error in stream_chat_response: API Error 400: b'{\n "error": {\n "code": 400,\n "message": "Invalid JSON payload received. Unknown name \\"systemInstruction\\": Cannot find field.",\n "status": "INVALID_ARGUMENT",\n "details": [\n {\n "@type": "type.googleapis.com/google.rpc.BadRequest",\n "fieldViolations": [\n {\n "description": "Invalid JSON payload received. Unknown name \\"systemInstruction\\": Cannot find field."\n }\n ]\n }\n ]\n }\n}\n'
```

The old SDK works perfectly: https://github.com/google-gemini/generative-ai-python

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.