Skip to content

Commit

Permalink
feat: function categories (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurasgkadri98 authored Sep 10, 2024
1 parent b1abc72 commit bf095e3
Show file tree
Hide file tree
Showing 10 changed files with 2,128 additions and 1,845 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.0
toolchain go1.22.5

require (
github.com/ansys/allie-sharedtypes v0.0.0-20240904075127-5291d92348f7
github.com/ansys/allie-sharedtypes v0.0.0-20240906091513-a52185c93d7b
github.com/google/go-github/v56 v56.0.0
github.com/google/uuid v1.6.0
github.com/pandodao/tokenizer-go v0.2.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ github.com/ansys/allie-sharedtypes v0.0.0-20240902100814-0bdc50fadbec h1:l2fkYSi
github.com/ansys/allie-sharedtypes v0.0.0-20240902100814-0bdc50fadbec/go.mod h1:tp0CyD2VVrFzR6BzgcXAShhSGEcFWGr/+EMvyb1JJqM=
github.com/ansys/allie-sharedtypes v0.0.0-20240904075127-5291d92348f7 h1:gCamyW5nSvIyevlpuT/PHpY9yNcKTJWHJGmMOR+jD1g=
github.com/ansys/allie-sharedtypes v0.0.0-20240904075127-5291d92348f7/go.mod h1:tp0CyD2VVrFzR6BzgcXAShhSGEcFWGr/+EMvyb1JJqM=
github.com/ansys/allie-sharedtypes v0.0.0-20240906091513-a52185c93d7b h1:qnxBqYvjM8shO1SeUbcthOxIT6KM1LAxamY0UXAjK5Q=
github.com/ansys/allie-sharedtypes v0.0.0-20240906091513-a52185c93d7b/go.mod h1:tp0CyD2VVrFzR6BzgcXAShhSGEcFWGr/+EMvyb1JJqM=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
Expand Down
33 changes: 26 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ 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{}{
Expand All @@ -37,14 +49,21 @@ func main() {
// Initialize internal states
internalstates.InitializeInternalStates()

// Load function definitions
err := functiondefinitions.ExtractFunctionDefinitionsFromPackage(externalFunctionsFile)
if err != nil {
logging.Log.Fatalf(internalstates.Ctx, "Error extracting function definitions from package: %v", err)
// Create file list
files := map[string]string{
"data_extraction": dataExtractionFile,
"generic": genericFile,
"knowledge_db": knowledgeDBFile,
"llm_handler": llmHandlerFile,
"ansys_gpt": ansysGPTFile,
}
err = functiondefinitions.ExtractFunctionDefinitionsFromPackage(dataExtractionFile)
if err != nil {
logging.Log.Fatalf(internalstates.Ctx, "Error extracting function definitions from package: %v", err)

// Load function definitions
for category, file := range files {
err := functiondefinitions.ExtractFunctionDefinitionsFromPackage(file, category)
if err != nil {
logging.Log.Fatalf(internalstates.Ctx, "Error extracting function definitions from package: %v", err)
}
}

// Log the version of the system
Expand Down
Loading

0 comments on commit bf095e3

Please sign in to comment.