This repository has been archived by the owner on Nov 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
73 lines (66 loc) · 1.65 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
package main
import (
"os"
"github.com/distantmagic/paddler/llamacpp"
"github.com/distantmagic/paddler/netcfg"
"github.com/distantmagic/structured/cmd"
"github.com/hashicorp/go-hclog"
"github.com/urfave/cli/v2"
)
func main() {
logger := hclog.Default()
serve := &cmd.Serve{
Logger: logger.Named("server"),
HttpAddress: &netcfg.HttpAddressConfiguration{},
LlamaCppConfiguration: &llamacpp.LlamaCppConfiguration{
HttpAddress: &netcfg.HttpAddressConfiguration{},
},
}
app := &cli.App{
Name: "structured",
Usage: "Extract structured data from unstructured text",
Commands: []*cli.Command{
{
Name: "serve",
Usage: "start http server for API",
Flags: []cli.Flag{
&cli.StringFlag{
Name: "host",
Value: "127.0.0.1",
Destination: &serve.HttpAddress.Host,
},
&cli.UintFlag{
Name: "port",
Value: 8087,
Destination: &serve.HttpAddress.Port,
},
&cli.StringFlag{
Name: "scheme",
Value: "http",
Destination: &serve.HttpAddress.Scheme,
},
&cli.StringFlag{
Name: "llamacpp-host",
Value: "127.0.0.1",
Destination: &serve.LlamaCppConfiguration.HttpAddress.Host,
},
&cli.UintFlag{
Name: "llamacpp-port",
Value: 8081,
Destination: &serve.LlamaCppConfiguration.HttpAddress.Port,
},
&cli.StringFlag{
Name: "llamacpp-scheme",
Value: "http",
Destination: &serve.LlamaCppConfiguration.HttpAddress.Scheme,
},
},
Action: serve.Action,
},
},
}
err := app.Run(os.Args)
if err != nil {
panic(err)
}
}