Skip to content

Commit 8b1b2b1

Browse files
committed
option to log used flags
1 parent 31ce62c commit 8b1b2b1

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

cmd/moki/moki.go

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,29 @@ func main() {
4242
// Define the flags
4343
helpFlag := flag.Bool("h", false, "Show this message")
4444
convFlag := flag.Bool("c", false, "Start a conversation with Moki")
45-
aiFlag := flag.String("llm", aiutil.DefaultProvider, "Selct the LLM provider, either OpenAI, Replicate, or Anyscale")
45+
aiFlag := flag.String("llm", aiutil.DefaultProvider, "Selct the LLM provider, either OpenAI, Anyscale, or Replicate")
4646
modelFlag := flag.String("m", "", "Set the model to use for the LLM response")
4747
temperatureFlag := flag.Float64("t", aiutil.DefaultTemp, "Set the temperature for the LLM response")
4848
maxTokensFlag := flag.Int("max-tokens", aiutil.DefaultMaxTokens, "Set the maximum number of tokens to generate per response")
4949
ragFlag := flag.Bool("r", true, "Enable RAG functionality")
50+
flagFlag := flag.Bool("flags", false, "Log the flags used for this request")
5051

5152
// Parse the flags
5253
flag.Parse()
5354

55+
// Log the flags for this request
56+
if *flagFlag {
57+
logger.WithFields(logrus.Fields{
58+
"helpFlag": *helpFlag,
59+
"convFlag": *convFlag,
60+
"aiFlag": *aiFlag,
61+
"modelFlag": *modelFlag,
62+
"temperatureFlag": *temperatureFlag,
63+
"maxTokensFlag": *maxTokensFlag,
64+
"ragFlag": *ragFlag,
65+
}).Infoln("Flags")
66+
}
67+
5468
// Show the help message
5569
if *helpFlag {
5670
fmt.Println(tools.HelpMessage)

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ module github.com/Ztkent/moki
33
go 1.22.0
44

55
require (
6+
github.com/Ztkent/ai-util v0.5.2
67
github.com/charmbracelet/bubbles v0.18.0
78
github.com/charmbracelet/bubbletea v0.26.1
89
github.com/sirupsen/logrus v1.9.3
9-
github.com/Ztkent/ai-util v0.5.0
1010
)
1111

1212
require (

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
github.com/PuerkitoBio/goquery v1.9.2 h1:4/wZksC3KgkQw7SQgkKotmKljk0M6V8TUvA8Wb4yPeE=
22
github.com/PuerkitoBio/goquery v1.9.2/go.mod h1:GHPCaP0ODyyxqcNoFGYlAprUFH81NuRPd0GX3Zu2Mvk=
3-
github.com/Ztkent/ai-util v0.5.0 h1:ByW7oNeVK7AFhrxSiVinvgaTvW2Y+gjlExGP/hm4sr8=
4-
github.com/Ztkent/ai-util v0.5.0/go.mod h1:FvLs1F4FedqW6VUtfx4WDajkJMW/ey1rHi7AZZ1nA3M=
3+
github.com/Ztkent/ai-util v0.5.2 h1:ZnBHF9pVrq/1pO7fTMjydWc9oR5IoDEFFS8MYzVcVSM=
4+
github.com/Ztkent/ai-util v0.5.2/go.mod h1:FvLs1F4FedqW6VUtfx4WDajkJMW/ey1rHi7AZZ1nA3M=
55
github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsViSLyss=
66
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
77
github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4=

0 commit comments

Comments
 (0)