Generates a streamed response from the model given an input GenerateContentRequest
.
HTTP request
POST https://generativelanguage.googleapis.com/v1beta/{model=models/*}:streamGenerateContent
Path parameters
Parameters | |
---|---|
model |
Required. The name of the Format: |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "contents": [ { object ( |
Fields | |
---|---|
contents[] |
Required. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries, this is a repeated field that contains conversation history + latest request. |
tools[] |
Optional. A list of A |
toolConfig |
Optional. Tool configuration for any |
safetySettings[] |
Optional. A list of unique This will be enforced on the |
systemInstruction |
Optional. Developer set system instruction. Currently, text only. |
generationConfig |
Optional. Configuration options for model generation and outputs. |
cachedContent |
Optional. The name of the cached content used as context to serve the prediction. Note: only used in explicit caching, where users can have control over caching (e.g. what content to cache) and enjoy guaranteed cost savings. Format: |
Response body
If successful, the response body contains a stream of GenerateContentResponse
instances.
Authorization scopes
Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/generative-language
https://www.googleapis.com/auth/generative-language.tuning
https://www.googleapis.com/auth/generative-language.tuning.readonly
https://www.googleapis.com/auth/generative-language.retriever
https://www.googleapis.com/auth/generative-language.retriever.readonly
For more information, see the Authentication Overview.