You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "AlexStocks (via GitHub)" <gi...@apache.org> on 2025/02/24 14:52:04 UTC
[PR] Revert "add llm integration example with ollama to dubbo-go" [dubbo-go-samples]
AlexStocks opened a new pull request, #794:
URL: https://github.com/apache/dubbo-go-samples/pull/794
Reverts apache/dubbo-go-samples#793
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Revert "add llm integration example with ollama to dubbo-go" [dubbo-go-samples]
Posted by "No-SilverBullet (via GitHub)" <gi...@apache.org>.
No-SilverBullet commented on code in PR #794:
URL: https://github.com/apache/dubbo-go-samples/pull/794#discussion_r1967821343
##########
llm/go-client/cmd/client.go:
##########
@@ -0,0 +1,67 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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"
+ "fmt"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/client"
+ _ "dubbo.apache.org/dubbo-go/v3/imports"
+)
+
+import (
+ greet "github.com/apache/dubbo-go-samples/llm/proto"
+)
+
+func main() {
+ cli, err := client.NewClient(
+ client.WithClientURL("tri://127.0.0.1:20000"),
+ )
+ if err != nil {
+ fmt.Printf("Error creating client: %v\n", err)
+ return
+ }
+
+ svc, err := greet.NewGreetService(cli)
+ if err != nil {
+ fmt.Printf("Error creating service: %v\n", err)
+ return
+ }
+
+ stream, err := svc.Greet(context.Background(), &greet.GreetRequest{
+ Prompt: "Write a simple function to calculate fibonacci sequence in Go",
+ })
+ if err != nil {
+ fmt.Printf("Error calling service: %v\n", err)
+ return
+ }
+
+ for stream.Recv() {
+ fmt.Print(stream.Msg().Content)
+ }
+
+ if err := stream.Err(); err != nil {
+ fmt.Printf("Stream error: %v\n", err)
+ return
+ }
+
+ stream.Close()
Review Comment:
use `defer` to release stream connection may be better
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] Revert "add llm integration example with ollama to dubbo-go" [dubbo-go-samples]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks merged PR #794:
URL: https://github.com/apache/dubbo-go-samples/pull/794
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org