googleapis / googleapis/python-genai

System Instruction Error

Abierto
#425 13 comentarios 2 reacciones 1 asignado Reclamado por @jaycee-li Ver en GitHub
priority: p2 type: bug
Lenguaje dominante
Python
Estrellas
4k
Forks
1k
Merge medio
2 d 12 h
PR fusionados (30 d)
41

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.