Re-org and changed the model. Seems like mixtral is bad???

This commit is contained in:
2024-01-21 00:27:52 -07:00
parent 7fbfb3fd26
commit 37cbe4ec4d
8 changed files with 202 additions and 148 deletions

28
lib/errors.go Normal file
View File

@ -0,0 +1,28 @@
package lib
import (
"net"
"os"
"github.com/diamondburned/arikawa/v3/api"
"github.com/diamondburned/arikawa/v3/discord"
"github.com/diamondburned/arikawa/v3/utils/json/option"
)
func ErrorResponse(err error) *api.InteractionResponseData {
var content string
switch e := err.(type) {
case *net.OpError:
content = "**Network Error:** " + e.Error()
case *os.PathError:
content = "**File Error:** " + e.Error()
default:
content = "**Error:** " + err.Error()
}
return &api.InteractionResponseData{
Content: option.NewNullableString(content),
Flags: discord.EphemeralMessage,
AllowedMentions: &api.AllowedMentions{},
}
}

View File

@ -20,15 +20,14 @@ func ReplicateTextGeneration(prompt string) (string, error) {
}
input := replicate.PredictionInput{
"prompt": prompt,
"max_new_tokens": 4096,
"prompt": prompt,
}
webhook := replicate.Webhook{
URL: "https://example.com/webhook",
Events: []replicate.WebhookEventType{"start", "completed"},
}
prediction, predictionError := client.Run(context.Background(), "mistralai/mistral-7b-instruct-v0.2:79052a3adbba8116ebc6697dcba67ad0d58feff23e7aeb2f103fc9aa545f9269", input, &webhook)
prediction, predictionError := client.Run(context.Background(), "meta/llama-2-70b-chat:2d19859030ff705a87c746f7e96eea03aefb71f166725aee39692f1476566d48", input, &webhook)
if predictionError != nil {
return "", predictionError