diff --git a/go.mod b/go.mod index c64a628..bd15375 100644 --- a/go.mod +++ b/go.mod @@ -30,7 +30,7 @@ require ( github.com/muesli/reflow v0.3.0 github.com/olekukonko/tablewriter v0.0.5 github.com/prometheus/client_golang v1.16.0 - github.com/sashabaranov/go-openai v1.19.4 + github.com/sashabaranov/go-openai v1.23.0 github.com/sirupsen/logrus v1.9.3 github.com/slack-go/slack v0.12.2 github.com/spf13/pflag v1.0.5 diff --git a/go.sum b/go.sum index e9df3e1..88925fb 100644 --- a/go.sum +++ b/go.sum @@ -832,8 +832,8 @@ github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFo github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= github.com/sanity-io/litter v1.5.5 h1:iE+sBxPBzoK6uaEP5Lt3fHNgpKcHXc/A2HGETy0uJQo= github.com/sanity-io/litter v1.5.5/go.mod h1:9gzJgR2i4ZpjZHsKvUXIRQVk7P+yM3e+jAF7bU2UI5U= -github.com/sashabaranov/go-openai v1.19.4 h1:GbaDiqvgYCabyqzuIbcEeT6/ZX1nVfur+++oTBfOgks= -github.com/sashabaranov/go-openai v1.19.4/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= +github.com/sashabaranov/go-openai v1.23.0 h1:KYW97r5yc35PI2MxeLZ3OofecB/6H+yxvSNqiT9u8is= +github.com/sashabaranov/go-openai v1.23.0/go.mod h1:lj5b/K+zjTSFxVLijLSTDZuP7adOgerWeFyZLUhAKRg= github.com/sclevine/spec v1.2.0/go.mod h1:W4J29eT/Kzv7/b9IWLB055Z+qvVC9vt0Arko24q7p+U= github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= diff --git a/hack/openai/main.go b/hack/openai/main.go index 480c783..953e06d 100644 --- a/hack/openai/main.go +++ b/hack/openai/main.go @@ -28,15 +28,15 @@ func main() { } func updateAssistant(ctx context.Context, c *openai.Client, id string) (openai.Assistant, error) { - instructions := heredoc.Doc(` - Your role involves deeply understanding how to operate and troubleshoot Kubernetes clusters and their workloads. - You possess extensive expertise in Kubernetes and cloud-native networking. - Employ a Chain of Thought (CoT) process for diagnosing and resolving cluster issues. - Ensure your explanations are simplified for clarity to non-technical users. - Utilize available tools for diagnosing the specific cluster in question. Focus your responses to be concise and relevant.`) + instructions := heredoc.Doc(`Your role involves deeply understanding how to operate and troubleshoot Kubernetes clusters and their workloads. +You possess extensive expertise in Kubernetes and cloud-native networking. Take kubernetes cluster and namespace configuration, such as security policies, events, during troubleshooting. +Employ a Chain of Thought (CoT) process for diagnosing and resolving cluster issues. +Ensure your explanations are simplified for clarity to non-technical users. +Utilize available tools for diagnosing the specific cluster in question. Focus your responses to be concise and relevant. +Keep responses concise, within 2000 characters. Provide extended answers only upon request.`) return c.ModifyAssistant(ctx, id, openai.AssistantRequest{ - Model: openai.GPT4TurboPreview, + Model: openai.GPT4Turbo, Instructions: &instructions, Tools: openAITools, }) diff --git a/internal/source/ai-brain/assistant.go b/internal/source/ai-brain/assistant.go index 0c1c1fc..a0f8a07 100644 --- a/internal/source/ai-brain/assistant.go +++ b/internal/source/ai-brain/assistant.go @@ -33,6 +33,8 @@ const ( serviceName = "botkube-plugins-source-ai-brain" ) +var temperature float32 = 0.1 + type tool func(ctx context.Context, args []byte) (string, error) // Payload represents incoming webhook payload. @@ -170,6 +172,7 @@ func (i *assistant) handleThread(ctx context.Context, p *Payload) (err error) { log.Info("created a new assistant run") run, err := i.openaiClient.CreateRun(ctx, threadID, openai.RunRequest{ AssistantID: i.assistID, + Temperature: &temperature, }) if err != nil { return fmt.Errorf("while creating a thread run: %w", err)