From 1097caf05816091ac8e6386b84a8bdafce16e696 Mon Sep 17 00:00:00 2001 From: Hiromu OCHIAI Date: Mon, 11 Sep 2023 18:08:37 +0900 Subject: [PATCH 1/2] Fix API test Related #28 --- testapp/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/testapp/main.go b/testapp/main.go index c7ffea9..5a18e31 100644 --- a/testapp/main.go +++ b/testapp/main.go @@ -156,8 +156,8 @@ var ( funcs := fc.Funcs{ "GetDate": fc.Func{GetDate, "A function to get date today", fc.Params{}}, "GetWeather": fc.Func{GetWeather, "A function to get weather information", fc.Params{ - {"location", "string", "location of the wather", true}, - {"date", "integer", "date MMDD as number", true}, + {"location", "string", "location of the wather", true, nil}, + {"date", "integer", "date MMDD as number", true, nil}, }}, } client := openaigo.NewClient(OPENAI_API_KEY) From c251a3c9622086e4eae4a9770b2c37a58f2371a3 Mon Sep 17 00:00:00 2001 From: Hiromu OCHIAI Date: Mon, 11 Sep 2023 18:22:32 +0900 Subject: [PATCH 2/2] Hide "invoke" method of functioncall --- functioncall/invoke.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/functioncall/invoke.go b/functioncall/invoke.go index 9550ecf..e28f1cd 100644 --- a/functioncall/invoke.go +++ b/functioncall/invoke.go @@ -12,14 +12,14 @@ type Invocation interface { } func (funcs Funcs) Call(invocation Invocation) string { - b, err := json.Marshal(funcs.Invoke(invocation)) + b, err := json.Marshal(funcs.invoke(invocation)) if err != nil { return err.Error() } return string(b) } -func (funcs Funcs) Invoke(invocation Invocation) any { +func (funcs Funcs) invoke(invocation Invocation) any { f, ok := funcs[invocation.Name()] if !ok { return fmt.Sprintf("function not found: %s", invocation.Name())