Skip to content

Commit

Permalink
add possiblity to use different instruct sets
Browse files Browse the repository at this point in the history
  • Loading branch information
ili16 committed Feb 27, 2024
1 parent 392e0bf commit f0dbb99
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion ollama/ollama.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,18 @@ import (
type ResponseData struct {
Response string `json:"response"`
PromptID string `json:"promptID"`
Instruct string `json:"instruct"`
}

func GenerateResponse(prompt map[string]interface{}) (ResponseData, error) {
url := os.Getenv("OLLAMA_URL") + "/api/generate"

instruct, err := redis.GetSetMember("default")
set, ok := prompt["instructType"].(string)
if !ok {
set = "default"
}

instruct, err := redis.GetSetMember(set)
if err != nil {
return ResponseData{}, errors.New("no data available")
}
Expand Down Expand Up @@ -103,6 +109,7 @@ func GenerateResponse(prompt map[string]interface{}) (ResponseData, error) {
responseData := ResponseData{
Response: response,
PromptID: PromptID,
Instruct: instruct,
}

return responseData, nil
Expand Down

0 comments on commit f0dbb99

Please sign in to comment.