Google Cloud Ai Platform V1 Client - Class NgramSpeculation (1.33.0)

Reference documentation and code samples for the Google Cloud Ai Platform V1 Client class NgramSpeculation.

N-Gram speculation works by trying to find matching tokens in the previous prompt sequence and use those as speculation for generating new tokens.

Generated from protobuf message google.cloud.aiplatform.v1.SpeculativeDecodingSpec.NgramSpeculation

Namespace

Google \ Cloud \ AIPlatform \ V1 \ SpeculativeDecodingSpec

Methods

__construct

Constructor.

Parameters
Name Description
data array

Optional. Data for populating the Message object.

↳ ngram_size int

The number of last N input tokens used as ngram to search/match against the previous prompt sequence. This is equal to the N in N-Gram. The default value is 3 if not specified.

getNgramSize

The number of last N input tokens used as ngram to search/match against the previous prompt sequence.

This is equal to the N in N-Gram. The default value is 3 if not specified.

Returns
Type Description
int

setNgramSize

The number of last N input tokens used as ngram to search/match against the previous prompt sequence.

This is equal to the N in N-Gram. The default value is 3 if not specified.

Parameter
Name Description
var int
Returns
Type Description
$this

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月08日 UTC.