Members
BlockedReason
The reason why the reponse is blocked.
FinishReason
The reason why the model stopped generating tokens. If empty, the model has not stopped generating the tokens.
FunctionCallingMode
Function calling mode.
GENERATE_CONTENT_METHOD
- License:
-
- Copyright 2024 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
HarmBlockThreshold
Probability based thresholds levels for blocking.
HarmCategory
Harm categories that will block the content.
HarmProbability
Harm probability levels in the content.
HarmSeverity
Harm severity levels
SchemaType
The list of OpenAPI data types as defined by https://swagger.io/docs/specification/data-models/data-types/
__createBinding
- License:
-
- Copyright 2024 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
__createBinding
- License:
-
- Copyright 2024 Google LLC Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Methods
(async) countTokens(request)
Make a async request to count tokens.
Parameters:
Name | Type | Description |
---|---|---|
request |
A CountTokensRequest object with the request contents. |
Returns:
Type | Description |
---|---|
The CountTokensResponse object with the token count. |
createFakeGoogleAuth()
Creates a fake GoogleAuth for testing.
(async) generateContent(request)
Make a async call to generate content.
Parameters:
Name | Type | Description |
---|---|---|
request |
A GenerateContentRequest object with the request contents. |
Returns:
Type | Description |
---|---|
The GenerateContentResponse object with the response candidates. |
(async) generateContentStream(request) → {Promise.<StreamGenerateContentResult>}
Make an async stream request to generate content. The response will be returned in stream.
Parameters:
Name | Type | Description |
---|---|---|
request |
GenerateContentRequest |
GenerateContentRequest |
Returns:
Type | Description |
---|---|
Promise.<StreamGenerateContentResult> |
Promise of StreamGenerateContentResult |
inferModelName()
Infers the full model name based on the provided project, location, and model.