37 lines
796 B
Go
37 lines
796 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/urfave/cli"
|
|
)
|
|
|
|
func main() {
|
|
// Usage: go run cmd/answer.go question...
|
|
// - flags:
|
|
// --model=[model string such as openai/gpt-4o, anthropic/claude..., google/gemini-1.5. Default: openai/gpt-4o]
|
|
// --search-provider=[search provider string such as google, duckduckgo. Default: google]
|
|
|
|
var app = cli.App{
|
|
Name: "answer",
|
|
Usage: "has an llm search the web for you to answer a question",
|
|
Version: "0.1",
|
|
Description: "",
|
|
|
|
Action: func(c *cli.Context) error {
|
|
// if there is no question to answer, print usage
|
|
if c.NArg() == 0 {
|
|
return cli.ShowAppHelp(c)
|
|
}
|
|
|
|
// get the question
|
|
fmt.Println("Head: ", c.Args().First())
|
|
fmt.Println("Tail: ", c.Args().Tail())
|
|
|
|
return nil
|
|
},
|
|
}
|
|
|
|
app.Run()
|
|
|
|
}
|