-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
75 lines (59 loc) · 2.03 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
74
75
package main
import (
_ "embed"
"github.com/ansys/allie-sharedtypes/pkg/config"
"github.com/ansys/allie-sharedtypes/pkg/logging"
"github.com/ansys/allie-flowkit/pkg/functiondefinitions"
"github.com/ansys/allie-flowkit/pkg/grpcserver"
"github.com/ansys/allie-flowkit/pkg/internalstates"
)
//go:embed pkg/externalfunctions/externalfunctions.go
var externalFunctionsFile string
//go:embed pkg/externalfunctions/dataextraction.go
var dataExtractionFile string
//go:embed pkg/externalfunctions/generic.go
var genericFile string
//go:embed pkg/externalfunctions/knowledgedb.go
var knowledgeDBFile string
//go:embed pkg/externalfunctions/llmhandler.go
var llmHandlerFile string
//go:embed pkg/externalfunctions/ansysgpt.go
var ansysGPTFile string
func init() {
// initialize config
config.InitConfig([]string{"EXTERNALFUNCTIONS_GRPC_PORT", "LLM_HANDLER_ENDPOINT"}, map[string]interface{}{
"SERVICE_NAME": "allie-flowkit",
"VERSION": "1.0",
"STAGE": "PROD",
"ERROR_FILE_LOCATION": "error.log",
"LOG_LEVEL": "error",
"LOCAL_LOGS_LOCATION": "logs.log",
"DATADOG_SOURCE": "nginx",
})
// initialize logging
logging.InitLogger(config.GlobalConfig)
}
func main() {
// Initialize internal states
internalstates.InitializeInternalStates()
// Create file list
files := map[string]string{
"data_extraction": dataExtractionFile,
"generic": genericFile,
"knowledge_db": knowledgeDBFile,
"llm_handler": llmHandlerFile,
"ansys_gpt": ansysGPTFile,
}
// Load function definitions
for category, file := range files {
err := functiondefinitions.ExtractFunctionDefinitionsFromPackage(file, category)
if err != nil {
logging.Log.Fatalf(&logging.ContextMap{}, "Error extracting function definitions from package: %v", err)
}
}
// Log the version of the system
logging.Log.Info(&logging.ContextMap{}, "Launching Allie Flowkit")
// start the gRPC server
grpcserver.StartServer()
logging.Log.Fatalf(&logging.ContextMap{}, "Error in gRPC server. Exiting application.")
}