googleapis / googleapis/python-genai

System Instruction Error

オープン
#425 コメント 13 件 リアクション 2 件 担当者 1 名 @jaycee-li が担当を希望しています GitHub で見る
priority: p2 type: bug
主要言語
Python
スター
4k
フォーク
1k
平均マージ
2日 12時間
マージ済み PR(30日)
41

説明

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

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。