Skip to content

Commit

Permalink
option to log used flags
Browse files Browse the repository at this point in the history
  • Loading branch information
ztkent committed May 6, 2024
1 parent 31ce62c commit 8b1b2b1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
16 changes: 15 additions & 1 deletion cmd/moki/moki.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,29 @@ func main() {
// Define the flags
helpFlag := flag.Bool("h", false, "Show this message")
convFlag := flag.Bool("c", false, "Start a conversation with Moki")
aiFlag := flag.String("llm", aiutil.DefaultProvider, "Selct the LLM provider, either OpenAI, Replicate, or Anyscale")
aiFlag := flag.String("llm", aiutil.DefaultProvider, "Selct the LLM provider, either OpenAI, Anyscale, or Replicate")
modelFlag := flag.String("m", "", "Set the model to use for the LLM response")
temperatureFlag := flag.Float64("t", aiutil.DefaultTemp, "Set the temperature for the LLM response")
maxTokensFlag := flag.Int("max-tokens", aiutil.DefaultMaxTokens, "Set the maximum number of tokens to generate per response")
ragFlag := flag.Bool("r", true, "Enable RAG functionality")
flagFlag := flag.Bool("flags", false, "Log the flags used for this request")

// Parse the flags
flag.Parse()

// Log the flags for this request
if *flagFlag {
logger.WithFields(logrus.Fields{
"helpFlag": *helpFlag,
"convFlag": *convFlag,
"aiFlag": *aiFlag,
"modelFlag": *modelFlag,
"temperatureFlag": *temperatureFlag,
"maxTokensFlag": *maxTokensFlag,
"ragFlag": *ragFlag,
}).Infoln("Flags")
}

// Show the help message
if *helpFlag {
fmt.Println(tools.HelpMessage)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ module github.com/Ztkent/moki
go 1.22.0

require (
github.com/Ztkent/ai-util v0.5.2
github.com/charmbracelet/bubbles v0.18.0
github.com/charmbracelet/bubbletea v0.26.1
github.com/sirupsen/logrus v1.9.3
github.com/Ztkent/ai-util v0.5.0
)

require (
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
github.com/Ztkent/ai-util v0.5.0 h1:ByW7oNeVK7AFhrxSiVinvgaTvW2Y+gjlExGP/hm4sr8=
github.com/Ztkent/ai-util v0.5.0/go.mod h1:FvLs1F4FedqW6VUtfx4WDajkJMW/ey1rHi7AZZ1nA3M=
github.com/Ztkent/ai-util v0.5.2 h1:ZnBHF9pVrq/1pO7fTMjydWc9oR5IoDEFFS8MYzVcVSM=
github.com/Ztkent/ai-util v0.5.2/go.mod h1:FvLs1F4FedqW6VUtfx4WDajkJMW/ey1rHi7AZZ1nA3M=
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=
Expand Down

0 comments on commit 8b1b2b1

Please sign in to comment.