SummarizerOptions.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
Sets whether auto truncation is enabled for input text.
When enabled, it automatically shortens the input text, keeping the prefix, if the
input exceeds the maximum length allowed for the given combination of input type,
output type and language.
By default, auto truncation is disabled. In such case, if input text exceeds limit,
an GenAiException
with
GenAiException.ErrorCode.REQUEST_TOO_LARGE
error code is thrown.
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-05-14 UTC.
[null,null,["Last updated 2025-05-14 UTC."],[],[],null,["# SummarizerOptions.Builder\n\npublic static abstract class **SummarizerOptions.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder class for [SummarizerOptions](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions)\nobjects. \n\n### Public Method Summary\n\n|-------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [SummarizerOptions](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions) | [build](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder#build())() Creates a [SummarizerOptions](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions) with the configured parameters. |\n| abstract [SummarizerOptions.Builder](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder) | [setInputType](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder#setInputType(int))(int inputType) Sets the [SummarizerOptions.InputType](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.InputType). |\n| abstract [SummarizerOptions.Builder](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder) | [setLanguage](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder#setLanguage(int))(int language) Sets the [SummarizerOptions.Language](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Language). |\n| abstract [SummarizerOptions.Builder](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder) | [setLongInputAutoTruncationEnabled](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder#setLongInputAutoTruncationEnabled(boolean))(boolean autoTruncationEnabled) Sets whether auto truncation is enabled for input text. |\n| abstract [SummarizerOptions.Builder](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder) | [setOutputType](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder#setOutputType(int))(int outputType) Sets the [SummarizerOptions.OutputType](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.OutputType). |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Methods\n--------------\n\n#### public abstract [SummarizerOptions](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions)\n**build** ()\n\nCreates a [SummarizerOptions](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions)\nwith the configured parameters. \n\n#### public abstract [SummarizerOptions.Builder](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder)\n**setInputType** (int inputType)\n\nSets the [SummarizerOptions.InputType](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.InputType).\n\nThe default value is [SummarizerOptions.InputType.ARTICLE](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.InputType#ARTICLE). \n\n#### public abstract [SummarizerOptions.Builder](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder)\n**setLanguage** (int language)\n\nSets the [SummarizerOptions.Language](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Language).\n\nThe default value is [SummarizerOptions.Language.ENGLISH](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Language#ENGLISH). \n\n#### public abstract [SummarizerOptions.Builder](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder)\n**setLongInputAutoTruncationEnabled** (boolean autoTruncationEnabled)\n\nSets whether auto truncation is enabled for input text.\n\nWhen enabled, it automatically shortens the input text, keeping the prefix, if the\ninput exceeds the maximum length allowed for the given combination of input type,\noutput type and language.\n\nBy default, auto truncation is disabled. In such case, if input text exceeds limit,\nan [GenAiException](/android/reference/com/google/mlkit/genai/common/GenAiException)\nwith [GenAiException.ErrorCode.REQUEST_TOO_LARGE](/android/reference/com/google/mlkit/genai/common/GenAiException.ErrorCode#REQUEST_TOO_LARGE) error code is thrown. \n\n#### public abstract [SummarizerOptions.Builder](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.Builder)\n**setOutputType** (int outputType)\n\nSets the [SummarizerOptions.OutputType](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.OutputType).\n\nThe default value is [SummarizerOptions.OutputType.ONE_BULLET](/android/reference/com/google/mlkit/genai/summarization/SummarizerOptions.OutputType#ONE_BULLET)."]]