diff options
author | terminaldweller <devi@terminaldweller.com> | 2024-02-12 22:55:13 +0000 |
---|---|---|
committer | terminaldweller <devi@terminaldweller.com> | 2024-02-12 22:55:13 +0000 |
commit | 6c2c8651d1016da18739f18e444c7670d8ff202d (patch) | |
tree | 7797b9fb3dad10828dfd7baa7a5e617b6a778ad6 | |
parent | gemini support, [wip] (diff) | |
download | milla-6c2c8651d1016da18739f18e444c7670d8ff202d.tar.gz milla-6c2c8651d1016da18739f18e444c7670d8ff202d.zip |
Added topp,topk config, renamed ollamatemp to just temp
-rw-r--r-- | main.go | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -28,7 +28,7 @@ type TomlConfig struct { IrcSaslPass string IrcChannel string OllamaEndpoint string - OllamaTemp float64 + Temp float64 OllamaSystem string RequestTimeout int MillaReconnectDelay int @@ -38,6 +38,8 @@ type TomlConfig struct { ChromaFormatter string Provider string Apikey string + TopP float32 + TopK int32 } type OllamaResponse struct { @@ -64,6 +66,7 @@ func printResponse(resp *genai.GenerateContentResponse) string { if cand.Content != nil { for _, part := range cand.Content.Parts { result += fmt.Sprintln(part) + log.Println(part) } } } @@ -112,7 +115,7 @@ func runIRC(appConfig TomlConfig, ircChan chan *girc.Client) { Stream: false, Format: "json", Options: OllamaRequestOptions{ - Temperature: appConfig.OllamaTemp, + Temperature: appConfig.Temp, }, } @@ -183,6 +186,7 @@ func runIRC(appConfig TomlConfig, ircChan chan *girc.Client) { } httpClient := http.Client{ Transport: &transport, + Timeout: time.Duration(appConfig.RequestTimeout) * time.Second, } clientGemini, err := genai.NewClient(ctx, option.WithAPIKey(appConfig.Apikey), option.WithHTTPClient(&httpClient)) @@ -194,6 +198,9 @@ func runIRC(appConfig TomlConfig, ircChan chan *girc.Client) { defer clientGemini.Close() model := clientGemini.GenerativeModel(appConfig.Model) + model.SetTemperature(float32(appConfig.Temp)) + model.SetTopK(appConfig.TopK) + model.SetTopP(appConfig.TopP) resp, err := model.GenerateContent(ctx, genai.Text(prompt)) if err != nil { client.Cmd.ReplyTo(event, girc.Fmt(fmt.Sprintf("error: %s", err.Error()))) |