chore: update approval example to be easier to understand
Change-Id: Ia999549cce2940aee6d2e1e57ad90c28d5d2f15fdrew/english
parent
85592f893f
commit
3ce08012fd
@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2025 CloudWeGo Authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package main
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"log"
|
|
||||||
|
|
||||||
"github.com/cloudwego/eino/components/tool"
|
|
||||||
"github.com/cloudwego/eino/components/tool/utils"
|
|
||||||
|
|
||||||
tool2 "github.com/cloudwego/eino-examples/adk/common/tool"
|
|
||||||
)
|
|
||||||
|
|
||||||
type bookInput struct {
|
|
||||||
Location string `json:"location"`
|
|
||||||
PassengerName string `json:"passenger_name"`
|
|
||||||
PassengerPhoneNumber string `json:"passenger_phone_number"`
|
|
||||||
}
|
|
||||||
|
|
||||||
func getTools() []tool.BaseTool {
|
|
||||||
getWeather, err := utils.InferTool(
|
|
||||||
"BookTicket",
|
|
||||||
"this tool can book ticket of the specific location",
|
|
||||||
func(ctx context.Context, input bookInput) (output string, err error) {
|
|
||||||
return "success", nil
|
|
||||||
})
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return []tool.BaseTool{
|
|
||||||
&tool2.InvokableApprovableTool{InvokableTool: getWeather},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue