TemplateChat

@PublicPreviewAPI
public final class TemplateChat


Representation of a multi-turn interaction with a server template model.

Summary

Public fields

final @NonNull List<@NonNull Content>

Public methods

final @NonNull GenerateContentResponse

Sends a message using the provided prompt; automatically providing the existing history as context.

final @NonNull GenerateContentResponse

Sends a message using the provided text prompt; automatically providing the existing history as context.

final @NonNull Flow<@NonNull GenerateContentResponse>

Sends a message using the provided prompt; automatically providing the existing history as context.

final @NonNull Flow<@NonNull GenerateContentResponse>

Sends a message using the provided text prompt; automatically providing the existing history as context.

Public fields

history

public final @NonNull List<@NonNull Contenthistory

Public methods

sendMessage

public final @NonNull GenerateContentResponse sendMessage(@NonNull Content prompt)

Sends a message using the provided prompt; automatically providing the existing history as context.

Parameters
@NonNull Content prompt

The input that, together with the history, will be given to the model as the prompt.

sendMessage

public final @NonNull GenerateContentResponse sendMessage(@NonNull String prompt)

Sends a message using the provided text prompt; automatically providing the existing history as context.

sendMessageStream

public final @NonNull Flow<@NonNull GenerateContentResponsesendMessageStream(@NonNull Content prompt)

Sends a message using the provided prompt; automatically providing the existing history as context. Returns a flow.

sendMessageStream

public final @NonNull Flow<@NonNull GenerateContentResponsesendMessageStream(@NonNull String prompt)

Sends a message using the provided text prompt; automatically providing the existing history as context. Returns a flow.