💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
### 创建客户端 package main import ( "context" "fmt" "demo2/pb" "google.golang.org/grpc" ) func main() { // 1 创建连接grpc conn, err := grpc.Dial("127.0.0.1:8800", grpc.WithInsecure()) if err != nil { fmt.Println("conn", err) } defer conn.Close() // 2 初始化客户端 gclient := pb.NewSayNameClient(conn) var teacher pb.Teacher teacher.Name = "李白" teacher.Age = 100 // 3 调用远程服务 t, err := gclient.SayHello(context.TODO(), &teacher) fmt.Println(t,err) }