com.google.firebase.vertexai.type
Interfaces
Part |
Interface representing data sent to and received from requests. |
Classes
BlockReason |
Describes why content was blocked. |
Candidate |
A |
Citation |
Represents a citation of content from an external source within the model's output. |
CitationMetadata |
A collection of source attributions for a piece of content. |
Content |
Represents content sent to and received from the model. |
Content.Builder |
Builder class to facilitate constructing complex |
CountTokensResponse |
The model's response to a count tokens request. |
FileDataPart |
Represents file data stored in Cloud Storage for Firebase, referenced by URI. |
FinishReason |
Represents the reason why the model stopped generating content. |
FunctionCallPart |
Represents function call name and params received from requests. |
FunctionCallingConfig |
The configuration that specifies the function calling behavior. |
FunctionDeclaration |
Defines a function that the model can use as a tool. |
FunctionResponsePart |
Represents function call output to be returned to the model when it requests a function call. |
GenerateContentResponse |
A response from the model. |
GenerationConfig |
Configuration parameters to use for content generation. |
GenerationConfig.Builder |
Builder for creating a |
HarmBlockMethod |
Specifies how the block method computes the score that will be compared against the |
HarmBlockThreshold |
Represents the threshold for a |
HarmCategory |
Category for a given harm rating. |
HarmProbability |
Represents the probability that some |
HarmSeverity |
Represents the severity of a |
ImagePart |
Represents image data sent to and received from requests. |
InlineDataPart |
Represents binary data with an associated MIME type sent to and received from requests. |
PromptFeedback |
Feedback on the prompt provided in the request. |
RequestOptions |
Configurable options unique to how requests to the backend are performed. |
SafetyRating |
An assessment of the potential harm of some generated content. |
SafetySetting |
A configuration for a |
Schema |
Represents a schema |
StringFormat |
|
StringFormat.Custom |
|
TextPart |
Represents text or string based data sent to and received from requests. |
Tool |
Contains a set of function declarations that the model has access to. |
ToolConfig |
Contains configuration for the function calling tools of the model. |
UsageMetadata |
Usage metadata about response(s). |
Exceptions
FirebaseVertexAIException |
Parent class for any errors that occur from the |
InvalidAPIKeyException |
The provided API Key is not valid. |
InvalidLocationException |
The specified Vertex AI location is invalid. |
InvalidStateException |
Some form of state occurred that shouldn't have. |
PromptBlockedException |
A request was blocked. |
RequestTimeoutException |
A request took too long to complete. |
ResponseStoppedException |
A request was stopped during generation for some reason. |
SerializationException |
Something went wrong while trying to deserialize a response from the server. |
ServerException |
The server responded with a non 200 response code. |
ServiceDisabledException |
The service is not enabled for this Firebase project. |
UnknownException |
Catch all case for exceptions not explicitly expected. |
UnsupportedUserLocationException |
The user's location (region) is not supported by the API. |
Top-level functions summary
Content |
content(role: String?, init: Content.Builder.() -> Unit) Function to build a new |
GenerationConfig |
generationConfig(init: GenerationConfig.Builder.() -> Unit) Helper method to construct a |
Extension functions summary
FileDataPart? |
Returns the part as a |
Bitmap? |
Returns the part as a |
InlineDataPart? |
Returns the part as a |
String? |
Returns the part as a |
Top-level functions
content
fun content(role: String? = "user", init: Content.Builder.() -> Unit): Content
Function to build a new Content
instances in a DSL-like manner.
Contains a collection of text, image, and binary parts.
Example usage:
content("user") {
text("Example string")
)
generationConfig
fun generationConfig(init: GenerationConfig.Builder.() -> Unit): GenerationConfig
Helper method to construct a GenerationConfig
in a DSL-like manner.
Example Usage:
generationConfig {
temperature = 0.75f
topP = 0.5f
topK = 30
candidateCount = 4
maxOutputTokens = 300
stopSequences = listOf("in conclusion", "-----", "do you need")
}
Extension functions
asFileDataOrNull
fun Part.asFileDataOrNull(): FileDataPart?
Returns the part as a FileDataPart
if it represents a file, and null otherwise
asImageOrNull
fun Part.asImageOrNull(): Bitmap?
Returns the part as a Bitmap
if it represents an image, and null otherwise
asInlineDataPartOrNull
fun Part.asInlineDataPartOrNull(): InlineDataPart?
Returns the part as a InlineDataPart
if it represents inline data, and null otherwise
asTextOrNull
fun Part.asTextOrNull(): String?
Returns the part as a String
if it represents text, and null otherwise