Skip to content

Commit

Permalink
chore: remove additional instructions config value
Browse files Browse the repository at this point in the history
  • Loading branch information
japelsin committed Feb 26, 2024
1 parent 19a9491 commit 8940c91
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 36 deletions.
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,3 @@ Available Commands:
reset Reset config
set Set config value
```

#### Config Values

##### Additional Instructions
Instructions appended to queries. If you intend to use `pplx` as a search engine it's recommended to instruct it to always provide its sources.

##### Model
Model to use. The available models are: `sonar-small-chat`, `sonar-small-online `, `sonar-medium-chat`, `sonar-medium-online`, `llama-2-70b-chat`, `codellama-34b-instruct`, `codellama-70b-instruct`, `mistral-7b-instruct`, and `mixtral-8x7b-instruct`.

##### API Key
Self explanatory.
13 changes: 1 addition & 12 deletions cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,10 @@ var configResetCmd = &cobra.Command{
var configSetCmd = &cobra.Command{
Use: "set",
Short: "Set config value",
ValidArgs: []string{utils.AdditionalInstructionsKey, utils.ApiKeyKey, utils.ModelKey},
ValidArgs: []string{utils.ApiKeyKey, utils.ModelKey},
Args: cobra.OnlyValidArgs,
}

var configSetAdditionalInstructionsCmd = &cobra.Command{
Use: utils.AdditionalInstructionsKey,
Short: "Set additional instructions to include at the end of each query",
Args: cobra.RangeArgs(0, 1),
Run: func(cmd *cobra.Command, args []string) {
value := ensureValue("Additional instructions", args)
updateConfigValue(utils.AdditionalInstructionsKey, value)
},
}

var configSetApiKeyCmd = &cobra.Command{
Use: "api_key",
Short: "Set API key",
Expand Down Expand Up @@ -111,7 +101,6 @@ func init() {
configCmd.AddCommand(configSetCmd)

// Set subcommands
configSetCmd.AddCommand(configSetAdditionalInstructionsCmd)
configSetCmd.AddCommand(configSetApiKeyCmd)
configSetCmd.AddCommand(configSetModelCmd)
}
4 changes: 1 addition & 3 deletions cmd/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ var searchCmd = &cobra.Command{
payload["stream"] = true
payload["model"] = viper.Get(utils.ModelKey)
payload["max_tokens"] = viper.Get(utils.MaxTokensKey)

additionalInstructions := viper.Get(utils.AdditionalInstructionsKey)
payload["messages"] = []perplexityPayloadMessage{{"user", fmt.Sprintf("%s %s", query, additionalInstructions)}}
payload["messages"] = []perplexityPayloadMessage{{"user", query}}

// Skip validation for now
cmd.Flags().VisitAll(func(flag *pflag.Flag) {
Expand Down
17 changes: 8 additions & 9 deletions utils/constants.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package utils

const (
AdditionalInstructionsKey = "additional_instructions"
ApiKeyKey = "api_key"
MaxTokensKey = "max_tokens"
ModelKey = "model"
TemperatureKey = "temperature"
TopPKey = "top_p"
TopKKey = "top_k"
PresencePenaltyKey = "presence_penalty"
FrequencyPenaltyKey = "frequency_penalty"
ApiKeyKey = "api_key"
MaxTokensKey = "max_tokens"
ModelKey = "model"
TemperatureKey = "temperature"
TopPKey = "top_p"
TopKKey = "top_k"
PresencePenaltyKey = "presence_penalty"
FrequencyPenaltyKey = "frequency_penalty"
)

var AvailableModels = []string{"sonar-small-chat", "sonar-small-online", "sonar-medium-chat", "sonar-medium-online", "llama-2-70b-chat", "codellama-34b-instruct", "codellama-70b-instruct", "mistral-7b-instruct", "mixtral-8x7b-instruct"}
1 change: 0 additions & 1 deletion utils/resetConfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
)

func ResetConfig() {
viper.Set(AdditionalInstructionsKey, "")
viper.Set(ApiKeyKey, "")
viper.Set(MaxTokensKey, "1000")
viper.Set(ModelKey, "sonar-small-online")
Expand Down

0 comments on commit 8940c91

Please sign in to comment.