Skip to main content

content

Creates, updates, deletes, gets or lists a content resource.

Overview

Namecontent
TypeResource
Idgemini.dynamic.content

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
candidatesarrayCandidate responses from the model.
modelStatusobjectOutput only. The current model status of this model.
modelVersionstringOutput only. The model version used to generate the response.
promptFeedbackobjectReturns the prompt's feedback related to the content filters.
responseIdstringOutput only. response_id is used to identify each response.
usageMetadataobjectOutput only. Metadata on the generation requests' token usage.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
generate_contentselectdynamicIdmodel, contents, toolConfig, store, tools, systemInstruction, cachedContent, serviceTier, safetySettings, generationConfigGenerates a model response given an input GenerateContentRequest. Refer to the text generation guide for detailed usage information. Input capabilities differ between models, including tuned models. Refer to the model guide and tuning guide for details.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
dynamicIdstring
cachedContentstringOptional. The name of the content cached to use as context to serve the prediction. Format: cachedContents/{cachedContent}
contentsarrayRequired. The content of the current conversation with the model. For single-turn queries, this is a single instance. For multi-turn queries like chat, this is a repeated field that contains the conversation history and the latest request.
generationConfigobjectConfiguration options for model generation and outputs. Not all parameters are configurable for every model.
modelstringRequired. The name of the Model to use for generating the completion. Format: models/{model}.
safetySettingsarrayOptional. A list of unique SafetySetting instances for blocking unsafe content. This will be enforced on the GenerateContentRequest.contents and GenerateContentResponse.candidates. There should not be more than one setting for each SafetyCategory type. The API will block any contents and responses that fail to meet the thresholds set by these settings. This list overrides the default settings for each SafetyCategory specified in the safety_settings. If there is no SafetySetting for a given SafetyCategory provided in the list, the API will use the default safety setting for that category. Harm categories HARM_CATEGORY_HATE_SPEECH, HARM_CATEGORY_SEXUALLY_EXPLICIT, HARM_CATEGORY_DANGEROUS_CONTENT, HARM_CATEGORY_HARASSMENT, HARM_CATEGORY_CIVIC_INTEGRITY, HARM_CATEGORY_JAILBREAK are supported. Refer to the guide for detailed information on available safety settings. Also refer to the Safety guidance to learn how to incorporate safety considerations in your AI applications.
serviceTierstringOptional. The service tier of the request.
storebooleanOptional. Configures the logging behavior for a given request. If set, it takes precedence over the project-level logging config.
systemInstructionobjectThe base structured datatype containing multi-part content of a message. A Content includes a role field designating the producer of the Content and a parts field containing multi-part data that contains the content of the message turn.
toolConfigobjectThe Tool configuration containing parameters for specifying Tool use in the request.
toolsarrayOptional. A list of Tools the Model may use to generate the next response. A Tool is a piece of code that enables the system to interact with external systems to perform an action, or set of actions, outside of knowledge and scope of the Model. Supported Tools are Function and code_execution. Refer to the Function calling and the Code execution guides to learn more.

SELECT examples

Generates a model response given an input GenerateContentRequest. Refer to the text generation guide for detailed usage information. Input capabilities differ between models, including tuned models. Refer to the model guide and tuning guide for details.

SELECT
candidates,
modelStatus,
modelVersion,
promptFeedback,
responseId,
usageMetadata
FROM gemini.dynamic.content
WHERE dynamicId = '{{ dynamicId }}' -- required
AND model = '{{ model }}'
AND contents = '{{ contents }}'
AND toolConfig = '{{ toolConfig }}'
AND store = '{{ store }}'
AND tools = '{{ tools }}'
AND systemInstruction = '{{ systemInstruction }}'
AND cachedContent = '{{ cachedContent }}'
AND serviceTier = '{{ serviceTier }}'
AND safetySettings = '{{ safetySettings }}'
AND generationConfig = '{{ generationConfig }}'
;