in adventure.go [71:101]
func main() {
ctx := context.Background()
client := newClient(ctx)
defer client.Close()
// Configure desired model.
model := client.GenerativeModel("gemini-1.5-pro-latest")
// Initialize new chat session.
session := model.StartChat()
// Set system instructions.
model.SystemInstruction = &genai.Content{
Parts: []genai.Part{genai.Text(getBytes(systemInstructionsFile))},
Role: "system",
}
dreamQuestion := "What do you want to dream about?"
// Establish chat history.
session.History = []*genai.Content{{
Role: "model",
Parts: []genai.Part{genai.Text(dreamQuestion)},
}}
printRuneFormatted('\n')
topic := askUser(dreamQuestion)
sendAndPrintResponse(ctx, session, topic)
chat(ctx, session)
}