mirror of
https://github.com/Direct-Dev-Ru/go-lcg.git
synced 2025-11-16 09:39:56 +00:00
feat: update prompt and model
This commit is contained in:
@@ -18,6 +18,7 @@ type Gpt3 struct {
|
|||||||
HomeDir string
|
HomeDir string
|
||||||
ApiKeyFile string
|
ApiKeyFile string
|
||||||
ApiKey string
|
ApiKey string
|
||||||
|
Temperature float64
|
||||||
}
|
}
|
||||||
|
|
||||||
type Chat struct {
|
type Chat struct {
|
||||||
@@ -26,8 +27,9 @@ type Chat struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Gpt3Request struct {
|
type Gpt3Request struct {
|
||||||
Model string `json:"model"`
|
Model string `json:"model"`
|
||||||
Messages []Chat `json:"messages"`
|
Messages []Chat `json:"messages"`
|
||||||
|
Temperature float64 `json:"temperature"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Gpt3Response struct {
|
type Gpt3Response struct {
|
||||||
@@ -139,6 +141,7 @@ func (gpt3 *Gpt3) Completions(ask string) string {
|
|||||||
payload := Gpt3Request{
|
payload := Gpt3Request{
|
||||||
gpt3.Model,
|
gpt3.Model,
|
||||||
messages,
|
messages,
|
||||||
|
gpt3.Temperature,
|
||||||
}
|
}
|
||||||
payloadJson, err := json.Marshal(payload)
|
payloadJson, err := json.Marshal(payload)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
5
main.go
5
main.go
@@ -16,8 +16,8 @@ import (
|
|||||||
const (
|
const (
|
||||||
HOST = "https://api.openai.com/v1/"
|
HOST = "https://api.openai.com/v1/"
|
||||||
COMPLETIONS = "chat/completions"
|
COMPLETIONS = "chat/completions"
|
||||||
MODEL = "gpt-3.5-turbo"
|
MODEL = "gpt-4o-mini"
|
||||||
PROMPT = "I want you to reply with linux command and nothing else. Do not write explanations."
|
PROMPT = "Reply with linux command and nothing else. No need explanation. No need code blocks"
|
||||||
|
|
||||||
// This file is created in the user's home directory
|
// This file is created in the user's home directory
|
||||||
// Example: /home/username/.openai_api_key
|
// Example: /home/username/.openai_api_key
|
||||||
@@ -136,6 +136,7 @@ func main() {
|
|||||||
Prompt: PROMPT,
|
Prompt: PROMPT,
|
||||||
HomeDir: currentUser.HomeDir,
|
HomeDir: currentUser.HomeDir,
|
||||||
ApiKeyFile: API_KEY_FILE,
|
ApiKeyFile: API_KEY_FILE,
|
||||||
|
Temperature: 0.01,
|
||||||
}
|
}
|
||||||
|
|
||||||
if h == CMD_UPDATE {
|
if h == CMD_UPDATE {
|
||||||
|
|||||||
Reference in New Issue
Block a user