startChat method

TemplateChatSession startChat(
  1. String templateId, {
  2. required Map<String, Object?> inputs,
  3. List<Content>? history,
  4. List<TemplateTool>? tools,
  5. TemplateToolConfig? toolConfig,
  6. int? maxTurns,
})

Starts a TemplateChatSession that will use this model to respond to messages.

final chat = model.startChat('my_template', inputs: {'language': 'en'});
final response = await chat.sendMessage(Content.text('Hello there.'));
print(response.text);

Implementation

TemplateChatSession startChat(String templateId,
        {required Map<String, Object?> inputs,
        List<Content>? history,
        List<TemplateTool>? tools,
        TemplateToolConfig? toolConfig,
        int? maxTurns}) =>
    TemplateChatSession._(
        templateGenerateContentWithHistory,
        templateGenerateContentWithHistoryStream,
        templateId,
        inputs,
        history ?? [],
        tools ?? [],
        toolConfig,
        maxTurns ?? 5);