summaryrefslogtreecommitdiff
path: root/submitChat.go
blob: 89e01607cdd82f32c4ab52e39cbf37716df07509 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package main

import (
	"fmt"

	"go.wit.com/log"
	"google.golang.org/genai"
)

func submitChat(content []*genai.Content) error {
	resp, err := me.client.Models.GenerateContent(me.ctx, "gemini-2.5-flash", content, nil)
	if err != nil {
		return log.Errorf("error sending message: %v", err)
	}

	log.Info("Response from API:")
	for _, cand := range resp.Candidates {
		if cand.Content != nil {
			for _, part := range cand.Content.Parts {
				fmt.Println(part)
			}
		}
	}
	// TODO: add the response to the protobuf
	addResponse(resp)
	return nil
}