From cf8397a691baa5dd201e8af21b719f51bb3e2aa2 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Tue, 14 Jan 2025 10:38:42 -0800 Subject: [PATCH 01/23] Creating Conversation folder Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 0 conversation/go/sdk/README.md | 0 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 conversation/go/http/README.md create mode 100644 conversation/go/sdk/README.md diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md new file mode 100644 index 000000000..e69de29bb diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md new file mode 100644 index 000000000..e69de29bb From e87f4078644a1292d5b3fdbe89c1a751aecfd4ee Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Sun, 19 Jan 2025 21:17:59 -0800 Subject: [PATCH 02/23] COnverstaion API Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 2 + .../go/http/components/conversation.yaml | 0 conversation/go/http/conversation/go.mod | 3 ++ conversation/go/http/conversation/go.sum | 0 conversation/go/http/conversation/main.go | 48 ++++++++++++++++++ conversation/go/http/dapr.yaml | 7 +++ conversation/go/http/makefile | 2 + conversation/go/sdk/README.md | 1 + .../go/sdk/components/conversation.yaml | 0 conversation/go/sdk/conversation/go.mod | 21 ++++++++ conversation/go/sdk/conversation/go.sum | 43 ++++++++++++++++ conversation/go/sdk/conversation/main.go | 49 +++++++++++++++++++ conversation/go/sdk/dapr.yaml | 7 +++ conversation/go/sdk/go.mod | 3 ++ conversation/go/sdk/makefile | 2 + .../http/order-processor/package-lock.json | 1 + .../react-calculator/client/yarn.lock | 5 ++ .../react-calculator/yarn.lock | 5 ++ tutorials/pub-sub/react-form/client/yarn.lock | 5 ++ tutorials/pub-sub/react-form/yarn.lock | 5 ++ 20 files changed, 209 insertions(+) create mode 100644 conversation/go/http/components/conversation.yaml create mode 100644 conversation/go/http/conversation/go.mod create mode 100644 conversation/go/http/conversation/go.sum create mode 100644 conversation/go/http/conversation/main.go create mode 100644 conversation/go/http/dapr.yaml create mode 100644 conversation/go/http/makefile create mode 100644 conversation/go/sdk/components/conversation.yaml create mode 100644 conversation/go/sdk/conversation/go.mod create mode 100644 conversation/go/sdk/conversation/go.sum create mode 100644 conversation/go/sdk/conversation/main.go create mode 100644 conversation/go/sdk/dapr.yaml create mode 100644 conversation/go/sdk/go.mod create mode 100644 conversation/go/sdk/makefile diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index e69de29bb..eb07be211 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -0,0 +1,2 @@ +# Dapr Conversation + diff --git a/conversation/go/http/components/conversation.yaml b/conversation/go/http/components/conversation.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/conversation/go/http/conversation/go.mod b/conversation/go/http/conversation/go.mod new file mode 100644 index 000000000..6f4384989 --- /dev/null +++ b/conversation/go/http/conversation/go.mod @@ -0,0 +1,3 @@ +module conversation + +go 1.21 diff --git a/conversation/go/http/conversation/go.sum b/conversation/go/http/conversation/go.sum new file mode 100644 index 000000000..e69de29bb diff --git a/conversation/go/http/conversation/main.go b/conversation/go/http/conversation/main.go new file mode 100644 index 000000000..4e24e5022 --- /dev/null +++ b/conversation/go/http/conversation/main.go @@ -0,0 +1,48 @@ +package main + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "net/http" + "os" + "time" +) + +const stateStoreComponentName = "statestore" + +func main() { + daprHost := os.Getenv("DAPR_HOST") + if daprHost == "" { + daprHost = "http://localhost" + } + daprHttpPort := os.Getenv("DAPR_HTTP_PORT") + if daprHttpPort == "" { + daprHttpPort = "3500" + } + + client := http.Client{ + Timeout: 15 * time.Second, + } + + input, _ := json.Marshal([]map[string]string{ + { + "inputs": "what is Dapr", + }, + }) + + res, err := client.Post(daprHost+":"+daprHttpPort+"/v1.0-alpha1/conversation/"+stateStoreComponentName+"/converse", "application/json", bytes.NewReader(input)) + if err != nil { + panic(err) + } + + output, err := io.ReadAll(res.Request.Response.Body) + if err != nil { + panic(err) + } + fmt.Println("Retrieved response:", string(output)) + + res.Body.Close() + fmt.Println("Input sent sent:", input) +} diff --git a/conversation/go/http/dapr.yaml b/conversation/go/http/dapr.yaml new file mode 100644 index 000000000..e355de4d5 --- /dev/null +++ b/conversation/go/http/dapr.yaml @@ -0,0 +1,7 @@ +version: 1 +apps: + - appDirPath: ./conversation/ + appID: conversation + appPort: 6300 + daprHTTPPort: 6380 + command: ["go", "run", "."] diff --git a/conversation/go/http/makefile b/conversation/go/http/makefile new file mode 100644 index 000000000..e7a8826bf --- /dev/null +++ b/conversation/go/http/makefile @@ -0,0 +1,2 @@ +include ../../../docker.mk +include ../../../validate.mk \ No newline at end of file diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md index e69de29bb..276317d6d 100644 --- a/conversation/go/sdk/README.md +++ b/conversation/go/sdk/README.md @@ -0,0 +1 @@ +# Dapr Conversation \ No newline at end of file diff --git a/conversation/go/sdk/components/conversation.yaml b/conversation/go/sdk/components/conversation.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/conversation/go/sdk/conversation/go.mod b/conversation/go/sdk/conversation/go.mod new file mode 100644 index 000000000..74bc557c1 --- /dev/null +++ b/conversation/go/sdk/conversation/go.mod @@ -0,0 +1,21 @@ +module conversation + +go 1.22.6 + +toolchain go1.22.11 + +require github.com/dapr/go-sdk v1.11.0 + +require ( + github.com/dapr/dapr v1.14.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + go.opentelemetry.io/otel v1.27.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect + google.golang.org/grpc v1.65.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/conversation/go/sdk/conversation/go.sum b/conversation/go/sdk/conversation/go.sum new file mode 100644 index 000000000..d2b2ab596 --- /dev/null +++ b/conversation/go/sdk/conversation/go.sum @@ -0,0 +1,43 @@ +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/dapr/dapr v1.14.0 h1:SIQsNX1kH31JRDIS4k8IZ6eomM/BAcOP844PhQIT+BQ= +github.com/dapr/dapr v1.14.0/go.mod h1:oDNgaPHQIDZ3G4n4g89TElXWgkluYwcar41DI/oF4gw= +github.com/dapr/go-sdk v1.11.0 h1:clANpOQd6MsfvSa6snaX8MVk6eRx26Vsj5GxGdQ6mpE= +github.com/dapr/go-sdk v1.11.0/go.mod h1:btZ/tX8eYnx0fg3HiJUku8J5QBRXHsp3kAB1BUiTxXY= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= +go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= +golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d h1:k3zyW3BYYR30e8v3x0bTDdE9vpYFjZHK+HcyqkrppWk= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/conversation/go/sdk/conversation/main.go b/conversation/go/sdk/conversation/main.go new file mode 100644 index 000000000..089200d56 --- /dev/null +++ b/conversation/go/sdk/conversation/main.go @@ -0,0 +1,49 @@ +/* +Copyright 2024 The Dapr 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" + "fmt" + "log" + + dapr "github.com/dapr/go-sdk/client" +) + +func main() { + client, err := dapr.NewClient() + if err != nil { + panic(err) + } + + input := dapr.ConversationInput{ + Message: "hello world", + // Role: nil, // Optional + // ScrubPII: nil, // Optional + } + + fmt.Printf("conversation input: %s\n", input.Message) + + var conversationComponent = "echo" + + request := dapr.NewConversationRequest(conversationComponent, []dapr.ConversationInput{input}) + + resp, err := client.ConverseAlpha1(context.Background(), request) + if err != nil { + log.Fatalf("err: %v", err) + } + + fmt.Printf("conversation output: %s\n", resp.Outputs[0].Result) +} diff --git a/conversation/go/sdk/dapr.yaml b/conversation/go/sdk/dapr.yaml new file mode 100644 index 000000000..e355de4d5 --- /dev/null +++ b/conversation/go/sdk/dapr.yaml @@ -0,0 +1,7 @@ +version: 1 +apps: + - appDirPath: ./conversation/ + appID: conversation + appPort: 6300 + daprHTTPPort: 6380 + command: ["go", "run", "."] diff --git a/conversation/go/sdk/go.mod b/conversation/go/sdk/go.mod new file mode 100644 index 000000000..bdfba7c87 --- /dev/null +++ b/conversation/go/sdk/go.mod @@ -0,0 +1,3 @@ +module dapr_conversation_quickstart + +go 1.22.5 diff --git a/conversation/go/sdk/makefile b/conversation/go/sdk/makefile new file mode 100644 index 000000000..e7a8826bf --- /dev/null +++ b/conversation/go/sdk/makefile @@ -0,0 +1,2 @@ +include ../../../docker.mk +include ../../../validate.mk \ No newline at end of file diff --git a/pub_sub/javascript/http/order-processor/package-lock.json b/pub_sub/javascript/http/order-processor/package-lock.json index 4815c51c6..6c342295a 100644 --- a/pub_sub/javascript/http/order-processor/package-lock.json +++ b/pub_sub/javascript/http/order-processor/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "license": "ISC", "dependencies": { + "body-parser": "^1.19.0", "express": "^4.17.2" } }, diff --git a/tutorials/distributed-calculator/react-calculator/client/yarn.lock b/tutorials/distributed-calculator/react-calculator/client/yarn.lock index 61cf96285..ac9807e90 100644 --- a/tutorials/distributed-calculator/react-calculator/client/yarn.lock +++ b/tutorials/distributed-calculator/react-calculator/client/yarn.lock @@ -4525,6 +4525,11 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== +fsevents@^2.3.2, fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" diff --git a/tutorials/distributed-calculator/react-calculator/yarn.lock b/tutorials/distributed-calculator/react-calculator/yarn.lock index 8c21580fa..1b86a59e1 100644 --- a/tutorials/distributed-calculator/react-calculator/yarn.lock +++ b/tutorials/distributed-calculator/react-calculator/yarn.lock @@ -381,6 +381,11 @@ fresh@0.5.2: resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== +fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" diff --git a/tutorials/pub-sub/react-form/client/yarn.lock b/tutorials/pub-sub/react-form/client/yarn.lock index c26994644..59a85ac2d 100644 --- a/tutorials/pub-sub/react-form/client/yarn.lock +++ b/tutorials/pub-sub/react-form/client/yarn.lock @@ -4418,6 +4418,11 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== +fsevents@^2.3.2, fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + function-bind@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" diff --git a/tutorials/pub-sub/react-form/yarn.lock b/tutorials/pub-sub/react-form/yarn.lock index 2aabf7654..666864f06 100644 --- a/tutorials/pub-sub/react-form/yarn.lock +++ b/tutorials/pub-sub/react-form/yarn.lock @@ -381,6 +381,11 @@ fresh@0.5.2: resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== +fsevents@~2.3.2: + version "2.3.2" + resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" + integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== + function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" From 6395fad49fa3f56b397a470cc5e085f7d3026522 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Mon, 20 Jan 2025 16:21:50 -0800 Subject: [PATCH 03/23] Fixing Conversation HTTP example for RC5 Signed-off-by: Fernando Rocha --- conversation/components/conversation.yaml | 7 ++ conversation/go/http/README.md | 46 ++++++++++++ .../go/http/components/conversation.yaml | 0 .../go/http/conversation/conversation.go | 71 +++++++++++++++++++ conversation/go/http/conversation/main.go | 48 ------------- conversation/go/http/dapr.yaml | 6 +- .../conversation/{main.go => conversation.go} | 0 conversation/go/sdk/dapr.yaml | 4 +- 8 files changed, 130 insertions(+), 52 deletions(-) create mode 100644 conversation/components/conversation.yaml delete mode 100644 conversation/go/http/components/conversation.yaml create mode 100644 conversation/go/http/conversation/conversation.go delete mode 100644 conversation/go/http/conversation/main.go rename conversation/go/sdk/conversation/{main.go => conversation.go} (100%) diff --git a/conversation/components/conversation.yaml b/conversation/components/conversation.yaml new file mode 100644 index 000000000..efb651fef --- /dev/null +++ b/conversation/components/conversation.yaml @@ -0,0 +1,7 @@ +apiVersion: dapr.io/v1alpha1 +kind: Component +metadata: + name: echo +spec: + type: conversation.echo + version: v1 diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index eb07be211..462de6f93 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -1,2 +1,48 @@ # Dapr Conversation +In this quickstart, you'll send an input to a Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers. + +Visit [this](https://v1-15.docs.dapr.io/developing-applications/building-blocks/conversation/conversation-overview/) link for more information about Dapr and the Conversation API. + +> **Note:** This example leverages HTTP `requests` only. If you are looking for the example using the Dapr Client SDK (recommended) [click here](../sdk/). + +This quickstart includes one app: + +- `conversation.go`, responsible for sending and input to the underlying LLM and retrieving an output. + +## Run the app with the template file + +This section shows how to run the application using the [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. + +This example uses the Default LLM Component provided by Dapr for testing purposes. Here are other [supported Conversation components](https://v1-15.docs.dapr.io/reference/components-reference/supported-conversation/). + +Open a new terminal window and run the multi app run template: + + + +```bash +dapr run -f . +``` + +The terminal console output should look similar to this, where: + +- The app send an input `What is dapr?` to the `echo` LLM. +- The LLM echoes `What is dapr?`. + +```text +== APP - conversation == Input sent: What is dapr? +== APP - conversation == Output response: What is dapr? +``` + + diff --git a/conversation/go/http/components/conversation.yaml b/conversation/go/http/components/conversation.yaml deleted file mode 100644 index e69de29bb..000000000 diff --git a/conversation/go/http/conversation/conversation.go b/conversation/go/http/conversation/conversation.go new file mode 100644 index 000000000..fbf8860b2 --- /dev/null +++ b/conversation/go/http/conversation/conversation.go @@ -0,0 +1,71 @@ +package main + +import ( + "encoding/json" + "fmt" + "io" + "log" + "net/http" + "os" + "strings" + "time" +) + +const conversationComponentName = "echo" + +func main() { + daprHost := os.Getenv("DAPR_HOST") + if daprHost == "" { + daprHost = "http://localhost" + } + daprHttpPort := os.Getenv("DAPR_HTTP_PORT") + if daprHttpPort == "" { + daprHttpPort = "3500" + } + + client := http.Client{ + Timeout: 15 * time.Second, + } + + var inputBody = `{ + "name": "echo", + "inputs": [{"message":"What is dapr?"}], + "parameters": {}, + "metadata": {} + }` + + reqURL := daprHost + ":" + daprHttpPort + "/v1.0-alpha1/conversation/" + conversationComponentName + "/converse" + + req, err := http.NewRequest("POST", reqURL, strings.NewReader(inputBody)) + if err != nil { + log.Fatal(err.Error()) + } + + req.Header.Set("Content-Type", "application/json") + + // Send a request to the echo LLM component + res, err := client.Do(req) + if err != nil { + log.Fatal(err) + } + + defer res.Body.Close() + + fmt.Println("Input sent: What is dapr?") + + bodyBytes, err := io.ReadAll(res.Body) + if err != nil { + log.Fatal(err) + } + + // Unmarshal the response + var data map[string][]map[string]string + err = json.Unmarshal(bodyBytes, &data) + if err != nil { + log.Fatal(err) + } + + result := data["outputs"][0]["result"] + fmt.Println("Output response:", result) + +} diff --git a/conversation/go/http/conversation/main.go b/conversation/go/http/conversation/main.go deleted file mode 100644 index 4e24e5022..000000000 --- a/conversation/go/http/conversation/main.go +++ /dev/null @@ -1,48 +0,0 @@ -package main - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "net/http" - "os" - "time" -) - -const stateStoreComponentName = "statestore" - -func main() { - daprHost := os.Getenv("DAPR_HOST") - if daprHost == "" { - daprHost = "http://localhost" - } - daprHttpPort := os.Getenv("DAPR_HTTP_PORT") - if daprHttpPort == "" { - daprHttpPort = "3500" - } - - client := http.Client{ - Timeout: 15 * time.Second, - } - - input, _ := json.Marshal([]map[string]string{ - { - "inputs": "what is Dapr", - }, - }) - - res, err := client.Post(daprHost+":"+daprHttpPort+"/v1.0-alpha1/conversation/"+stateStoreComponentName+"/converse", "application/json", bytes.NewReader(input)) - if err != nil { - panic(err) - } - - output, err := io.ReadAll(res.Request.Response.Body) - if err != nil { - panic(err) - } - fmt.Println("Retrieved response:", string(output)) - - res.Body.Close() - fmt.Println("Input sent sent:", input) -} diff --git a/conversation/go/http/dapr.yaml b/conversation/go/http/dapr.yaml index e355de4d5..211d9cfd2 100644 --- a/conversation/go/http/dapr.yaml +++ b/conversation/go/http/dapr.yaml @@ -1,7 +1,9 @@ version: 1 +common: + resourcesPath: ../../components/ apps: - appDirPath: ./conversation/ appID: conversation - appPort: 6300 - daprHTTPPort: 6380 + appPort: 3500 + daprHTTPPort: 3501 command: ["go", "run", "."] diff --git a/conversation/go/sdk/conversation/main.go b/conversation/go/sdk/conversation/conversation.go similarity index 100% rename from conversation/go/sdk/conversation/main.go rename to conversation/go/sdk/conversation/conversation.go diff --git a/conversation/go/sdk/dapr.yaml b/conversation/go/sdk/dapr.yaml index e355de4d5..046b7bde3 100644 --- a/conversation/go/sdk/dapr.yaml +++ b/conversation/go/sdk/dapr.yaml @@ -2,6 +2,6 @@ version: 1 apps: - appDirPath: ./conversation/ appID: conversation - appPort: 6300 - daprHTTPPort: 6380 + appPort: 3500 + daprHTTPPort: 3501 command: ["go", "run", "."] From 2f2c0b517d93c7d602db1ece5ec1c0a8c4ab64b8 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Mon, 20 Jan 2025 19:38:14 -0800 Subject: [PATCH 04/23] Fixing Conversation SDK example for RC5 Signed-off-by: Fernando Rocha --- jobs/go/http/README.md | 2 +- jobs/go/sdk/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/jobs/go/http/README.md b/jobs/go/http/README.md index 67233bab8..077ef819b 100644 --- a/jobs/go/http/README.md +++ b/jobs/go/http/README.md @@ -2,7 +2,7 @@ In this quickstart, you'll schedule, get, and delete a job using Dapr's Job API. This API is responsible for scheduling and running jobs at a specific time or interval. -Visit [this](https://v1-14.docs.dapr.io/developing-applications/building-blocks/jobs/) link for more information about Dapr and the Jobs API. +Visit [this](https://docs.dapr.io/developing-applications/building-blocks/jobs/) link for more information about Dapr and the Jobs API. > **Note:** This example leverages HTTP `requests` only. If you are looking for the example using the Dapr Client SDK (recommended) [click here](../sdk/). diff --git a/jobs/go/sdk/README.md b/jobs/go/sdk/README.md index 0938ebd7e..8f8c7468d 100644 --- a/jobs/go/sdk/README.md +++ b/jobs/go/sdk/README.md @@ -2,7 +2,7 @@ In this quickstart, you'll schedule, get, and delete a job using Dapr's Job API. This API is responsible for scheduling and running jobs at a specific time or interval. -Visit [this](https://v1-14.docs.dapr.io/developing-applications/building-blocks/jobs/) link for more information about Dapr and the Job API. +Visit [this](https://docs.dapr.io/developing-applications/building-blocks/jobs/) link for more information about Dapr and the Job API. > **Note:** This example leverages the SDK only. If you are looking for the example using the HTTP requests [click here](../http/). From e2b6a484592a4ae9a5e92e5af2fe74197417c6d6 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Tue, 21 Jan 2025 10:13:46 -0800 Subject: [PATCH 05/23] Update conversation.go Co-authored-by: Mike Nguyen Signed-off-by: Fernando Rocha --- conversation/go/http/conversation/conversation.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conversation/go/http/conversation/conversation.go b/conversation/go/http/conversation/conversation.go index fbf8860b2..a7420d9a7 100644 --- a/conversation/go/http/conversation/conversation.go +++ b/conversation/go/http/conversation/conversation.go @@ -60,8 +60,7 @@ func main() { // Unmarshal the response var data map[string][]map[string]string - err = json.Unmarshal(bodyBytes, &data) - if err != nil { + if err := json.Unmarshal(bodyBytes, &data); err != nil { log.Fatal(err) } From 984c9c5a06ce43eddfbeafe1e84459b576fe4ff9 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Tue, 21 Jan 2025 10:13:56 -0800 Subject: [PATCH 06/23] Update go.mod Co-authored-by: Mike Nguyen Signed-off-by: Fernando Rocha --- conversation/go/http/conversation/go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/http/conversation/go.mod b/conversation/go/http/conversation/go.mod index 6f4384989..0a6357435 100644 --- a/conversation/go/http/conversation/go.mod +++ b/conversation/go/http/conversation/go.mod @@ -1,3 +1,3 @@ module conversation -go 1.21 +go 1.23.5 From a75d653f7b1f9ef4b723991370275f98d4062fb2 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Tue, 21 Jan 2025 10:14:26 -0800 Subject: [PATCH 07/23] Update go.mod Co-authored-by: Mike Nguyen Signed-off-by: Fernando Rocha --- conversation/go/sdk/conversation/go.mod | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/conversation/go/sdk/conversation/go.mod b/conversation/go/sdk/conversation/go.mod index 74bc557c1..284660cc9 100644 --- a/conversation/go/sdk/conversation/go.mod +++ b/conversation/go/sdk/conversation/go.mod @@ -1,8 +1,6 @@ module conversation -go 1.22.6 - -toolchain go1.22.11 +go 1.23.5 require github.com/dapr/go-sdk v1.11.0 From ea48818b042485f7544226b6198107db2289abdb Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Tue, 21 Jan 2025 15:33:10 -0800 Subject: [PATCH 08/23] Finishing conversation sdk and fixing components path Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 15 ++++- .../go/http/conversation/conversation.go | 14 +++++ conversation/go/sdk/README.md | 62 ++++++++++++++++++- .../go/sdk/components/conversation.yaml | 0 .../go/sdk/conversation/conversation.go | 6 +- conversation/go/sdk/conversation/go.mod | 22 +++---- conversation/go/sdk/conversation/go.sum | 42 +++++++------ conversation/go/sdk/dapr.yaml | 2 + conversation/go/sdk/go.mod | 3 - 9 files changed, 127 insertions(+), 39 deletions(-) delete mode 100644 conversation/go/sdk/components/conversation.yaml delete mode 100644 conversation/go/sdk/go.mod diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index 462de6f93..c3e4849f5 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -27,7 +27,7 @@ expected_stderr_lines: output_match_mode: substring match_order: none background: false -sleep: 5 +sleep: 60 timeout_seconds: 120 --> @@ -46,3 +46,16 @@ The terminal console output should look similar to this, where: ``` + +2. Stop and clean up application processes + + + +```bash +dapr stop -f . +``` + + \ No newline at end of file diff --git a/conversation/go/http/conversation/conversation.go b/conversation/go/http/conversation/conversation.go index fbf8860b2..e460145b6 100644 --- a/conversation/go/http/conversation/conversation.go +++ b/conversation/go/http/conversation/conversation.go @@ -1,3 +1,17 @@ +/* +Copyright 2024 The Dapr 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 ( diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md index 276317d6d..b91a59b48 100644 --- a/conversation/go/sdk/README.md +++ b/conversation/go/sdk/README.md @@ -1 +1,61 @@ -# Dapr Conversation \ No newline at end of file +# Dapr Conversation + +In this quickstart, you'll send an input to a Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers. + +Visit [this](https://v1-15.docs.dapr.io/developing-applications/building-blocks/conversation/conversation-overview/) link for more information about Dapr and the Conversation API. + +> **Note:** This example leverages HTTP `requests` only. If you are looking for the example using the HTTP API [click here](../http/). + +This quickstart includes one app: + +- `conversation.go`, responsible for sending and input to the underlying LLM and retrieving an output. + +## Run the app with the template file + +This section shows how to run the application using the [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. + +This example uses the Default LLM Component provided by Dapr for testing purposes. Here are other [supported Conversation components](https://v1-15.docs.dapr.io/reference/components-reference/supported-conversation/). + +Open a new terminal window and run the multi app run template: + + + +```bash +dapr run -f . +``` + +The terminal console output should look similar to this, where: + +- The app send an input `What is dapr?` to the `echo` LLM. +- The LLM echoes `What is dapr?`. + +```text +== APP - conversation == Input sent: What is dapr? +== APP - conversation == Output response: What is dapr? +``` + + + +2. Stop and clean up application processes + + + +```bash +dapr stop -f . +``` + + \ No newline at end of file diff --git a/conversation/go/sdk/components/conversation.yaml b/conversation/go/sdk/components/conversation.yaml deleted file mode 100644 index e69de29bb..000000000 diff --git a/conversation/go/sdk/conversation/conversation.go b/conversation/go/sdk/conversation/conversation.go index 089200d56..ff2d7bb4a 100644 --- a/conversation/go/sdk/conversation/conversation.go +++ b/conversation/go/sdk/conversation/conversation.go @@ -29,12 +29,12 @@ func main() { } input := dapr.ConversationInput{ - Message: "hello world", + Message: "What is dapr?", // Role: nil, // Optional // ScrubPII: nil, // Optional } - fmt.Printf("conversation input: %s\n", input.Message) + fmt.Println("Input sent:", input.Message) var conversationComponent = "echo" @@ -45,5 +45,5 @@ func main() { log.Fatalf("err: %v", err) } - fmt.Printf("conversation output: %s\n", resp.Outputs[0].Result) + fmt.Println("Output response:", resp.Outputs[0].Result) } diff --git a/conversation/go/sdk/conversation/go.mod b/conversation/go/sdk/conversation/go.mod index 74bc557c1..64c463f3f 100644 --- a/conversation/go/sdk/conversation/go.mod +++ b/conversation/go/sdk/conversation/go.mod @@ -1,21 +1,21 @@ module conversation -go 1.22.6 +go 1.23.3 -toolchain go1.22.11 +toolchain go1.23.5 -require github.com/dapr/go-sdk v1.11.0 +require github.com/dapr/go-sdk v1.12.0-rc.1 require ( - github.com/dapr/dapr v1.14.0 // indirect + github.com/dapr/dapr v1.15.0-rc.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/kr/pretty v0.3.1 // indirect - go.opentelemetry.io/otel v1.27.0 // indirect - golang.org/x/net v0.26.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/text v0.16.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d // indirect - google.golang.org/grpc v1.65.0 // indirect - google.golang.org/protobuf v1.34.2 // indirect + go.opentelemetry.io/otel v1.32.0 // indirect + golang.org/x/net v0.32.0 // indirect + golang.org/x/sys v0.28.0 // indirect + golang.org/x/text v0.21.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect + google.golang.org/grpc v1.68.1 // indirect + google.golang.org/protobuf v1.35.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/conversation/go/sdk/conversation/go.sum b/conversation/go/sdk/conversation/go.sum index d2b2ab596..3f4a31e7c 100644 --- a/conversation/go/sdk/conversation/go.sum +++ b/conversation/go/sdk/conversation/go.sum @@ -1,10 +1,12 @@ github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/dapr/dapr v1.14.0 h1:SIQsNX1kH31JRDIS4k8IZ6eomM/BAcOP844PhQIT+BQ= -github.com/dapr/dapr v1.14.0/go.mod h1:oDNgaPHQIDZ3G4n4g89TElXWgkluYwcar41DI/oF4gw= -github.com/dapr/go-sdk v1.11.0 h1:clANpOQd6MsfvSa6snaX8MVk6eRx26Vsj5GxGdQ6mpE= -github.com/dapr/go-sdk v1.11.0/go.mod h1:btZ/tX8eYnx0fg3HiJUku8J5QBRXHsp3kAB1BUiTxXY= +github.com/dapr/dapr v1.15.0-rc.1 h1:7JP3zSannxQwV27A9pPR2b/DSNmgcSjJOhRDwM4eFpQ= +github.com/dapr/dapr v1.15.0-rc.1/go.mod h1:SycZrBWgfmog+C5T4p0X6VIpnREQ3xajrYxdih+gn9w= +github.com/dapr/go-sdk v1.12.0-rc.1 h1:KK92BahLmwGowVRjFxsjySl25M6wwuJSjesYIIF6h0c= +github.com/dapr/go-sdk v1.12.0-rc.1/go.mod h1:OxCF7Eh8IZvmNv6Euk+mnLrehJyLQRYb4TAU7uHq7Ow= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= @@ -20,22 +22,22 @@ github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZV github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -go.opentelemetry.io/otel v1.27.0 h1:9BZoF3yMK/O1AafMiQTVu0YDj5Ea4hPhxCs7sGva+cg= -go.opentelemetry.io/otel v1.27.0/go.mod h1:DMpAK8fzYRzs+bi3rS5REupisuqTheUlSZJ1WnZaPAQ= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 h1:yixxcjnhBmY0nkL253HFVIm0JsFHwrHdT3Yh6szTnfY= -golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d h1:k3zyW3BYYR30e8v3x0bTDdE9vpYFjZHK+HcyqkrppWk= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240624140628-dc46fd24d27d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= -google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= -google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U= +go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 h1:e66Fs6Z+fZTbFBAxKfP3PALWBtpfqks2bwGcexMxgtk= +golang.org/x/exp v0.0.0-20240909161429-701f63a606c0/go.mod h1:2TbTHSBQa924w8M6Xs1QcRcFwyucIwBGpK1p2f1YFFY= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a h1:hgh8P4EuoxpsuKMXX/To36nOFD7vixReXgn8lPGnt+o= +google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU= +google.golang.org/grpc v1.68.1 h1:oI5oTa11+ng8r8XMMN7jAOmWfPZWbYpCFaMUTACxkM0= +google.golang.org/grpc v1.68.1/go.mod h1:+q1XYFJjShcqn0QZHvCyeR4CXPA+llXIeUIfIe00waw= +google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io= +google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= diff --git a/conversation/go/sdk/dapr.yaml b/conversation/go/sdk/dapr.yaml index 046b7bde3..211d9cfd2 100644 --- a/conversation/go/sdk/dapr.yaml +++ b/conversation/go/sdk/dapr.yaml @@ -1,4 +1,6 @@ version: 1 +common: + resourcesPath: ../../components/ apps: - appDirPath: ./conversation/ appID: conversation diff --git a/conversation/go/sdk/go.mod b/conversation/go/sdk/go.mod deleted file mode 100644 index bdfba7c87..000000000 --- a/conversation/go/sdk/go.mod +++ /dev/null @@ -1,3 +0,0 @@ -module dapr_conversation_quickstart - -go 1.22.5 From 92a70337321e4c9c5603004e36c4eb8dd1d546fc Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Tue, 21 Jan 2025 15:39:16 -0800 Subject: [PATCH 09/23] Update conversation/go/http/README.md Co-authored-by: Mike Nguyen Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index c3e4849f5..bc46d4cac 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -37,7 +37,7 @@ dapr run -f . The terminal console output should look similar to this, where: -- The app send an input `What is dapr?` to the `echo` LLM. +- The app sends an input `What is dapr?` to the `echo` LLM. - The LLM echoes `What is dapr?`. ```text From 695cec4728e6a3cdb1bb7eec9df132a4f2d026d0 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 09:15:15 -0800 Subject: [PATCH 10/23] Update conversation/go/sdk/dapr.yaml Co-authored-by: Mike Nguyen Signed-off-by: Fernando Rocha --- conversation/go/sdk/dapr.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/conversation/go/sdk/dapr.yaml b/conversation/go/sdk/dapr.yaml index 211d9cfd2..1187afdd2 100644 --- a/conversation/go/sdk/dapr.yaml +++ b/conversation/go/sdk/dapr.yaml @@ -4,6 +4,5 @@ common: apps: - appDirPath: ./conversation/ appID: conversation - appPort: 3500 daprHTTPPort: 3501 command: ["go", "run", "."] From 680cf2924ff6f113abe319dc9518b6ab7b93f4c4 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 09:15:23 -0800 Subject: [PATCH 11/23] Update conversation/go/http/dapr.yaml Co-authored-by: Mike Nguyen Signed-off-by: Fernando Rocha --- conversation/go/http/dapr.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/conversation/go/http/dapr.yaml b/conversation/go/http/dapr.yaml index 211d9cfd2..1187afdd2 100644 --- a/conversation/go/http/dapr.yaml +++ b/conversation/go/http/dapr.yaml @@ -4,6 +4,5 @@ common: apps: - appDirPath: ./conversation/ appID: conversation - appPort: 3500 daprHTTPPort: 3501 command: ["go", "run", "."] From 5c3264452d221c8c9c2bedad5962e9b2b01eee13 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 09:15:32 -0800 Subject: [PATCH 12/23] Update conversation/go/sdk/dapr.yaml Co-authored-by: Mike Nguyen Signed-off-by: Fernando Rocha --- conversation/go/sdk/dapr.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/conversation/go/sdk/dapr.yaml b/conversation/go/sdk/dapr.yaml index 1187afdd2..6a6c0e0fc 100644 --- a/conversation/go/sdk/dapr.yaml +++ b/conversation/go/sdk/dapr.yaml @@ -4,5 +4,4 @@ common: apps: - appDirPath: ./conversation/ appID: conversation - daprHTTPPort: 3501 command: ["go", "run", "."] From 9820c13b082a1a833ff744825255e080517a476b Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 09:18:56 -0800 Subject: [PATCH 13/23] Updating sleep and timeout times Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 4 ++-- conversation/go/sdk/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index bc46d4cac..5bc8fe6c3 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -27,8 +27,8 @@ expected_stderr_lines: output_match_mode: substring match_order: none background: false -sleep: 60 -timeout_seconds: 120 +sleep: 15 +timeout_seconds: 30 --> ```bash diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md index b91a59b48..9ac4e3e26 100644 --- a/conversation/go/sdk/README.md +++ b/conversation/go/sdk/README.md @@ -28,7 +28,7 @@ output_match_mode: substring match_order: none background: false sleep: 15 -timeout_seconds: 120 +timeout_seconds: 30 --> ```bash From 0a8dc8b30ea43b0279af04e6cf95df1e9e5d6656 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 10:35:05 -0800 Subject: [PATCH 14/23] Update conversation/go/sdk/README.md Co-authored-by: Alice Gibbons Signed-off-by: Fernando Rocha --- conversation/go/sdk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md index 9ac4e3e26..897a002f3 100644 --- a/conversation/go/sdk/README.md +++ b/conversation/go/sdk/README.md @@ -1,4 +1,4 @@ -# Dapr Conversation +# Dapr Conversation API (Go SDK) In this quickstart, you'll send an input to a Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers. From ae9c2fb46d63defa7843e11f4c26cd9f22987c3e Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 10:37:11 -0800 Subject: [PATCH 15/23] Update conversation/go/http/README.md Co-authored-by: Alice Gibbons Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index 5bc8fe6c3..063761ab9 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -37,7 +37,7 @@ dapr run -f . The terminal console output should look similar to this, where: -- The app sends an input `What is dapr?` to the `echo` LLM. +- The app sends an input `What is dapr?` to the `echo` Component mock LLM. - The LLM echoes `What is dapr?`. ```text From 63c2247f81c47ca1cdcdd9ca1301d6981096a6cd Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 10:37:21 -0800 Subject: [PATCH 16/23] Update conversation/go/http/README.md Co-authored-by: Alice Gibbons Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index 063761ab9..b304786d1 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -1,6 +1,6 @@ # Dapr Conversation -In this quickstart, you'll send an input to a Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers. +In this quickstart, you'll send an input to a mock Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers. Visit [this](https://v1-15.docs.dapr.io/developing-applications/building-blocks/conversation/conversation-overview/) link for more information about Dapr and the Conversation API. From e47efba65f544e76eb28d30ff4431b8fdbb66a87 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 10:37:28 -0800 Subject: [PATCH 17/23] Update conversation/go/sdk/README.md Co-authored-by: Alice Gibbons Signed-off-by: Fernando Rocha --- conversation/go/sdk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md index 897a002f3..d9dc24c8d 100644 --- a/conversation/go/sdk/README.md +++ b/conversation/go/sdk/README.md @@ -1,6 +1,6 @@ # Dapr Conversation API (Go SDK) -In this quickstart, you'll send an input to a Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers. +In this quickstart, you'll send an input to a mock Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers. Visit [this](https://v1-15.docs.dapr.io/developing-applications/building-blocks/conversation/conversation-overview/) link for more information about Dapr and the Conversation API. From 834ab60abe6101a63a8fac8a8cf5fb6b52ed90a3 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 11:16:14 -0800 Subject: [PATCH 18/23] Update conversation/go/http/README.md Co-authored-by: Alice Gibbons Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index b304786d1..89446270c 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -38,7 +38,7 @@ dapr run -f . The terminal console output should look similar to this, where: - The app sends an input `What is dapr?` to the `echo` Component mock LLM. -- The LLM echoes `What is dapr?`. +- The mock LLM echoes `What is dapr?`. ```text == APP - conversation == Input sent: What is dapr? From b4f0d219c1ffb73a290c9a9673862322f5a14ec1 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 11:24:38 -0800 Subject: [PATCH 19/23] Comversation README improvements Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 2 +- conversation/go/sdk/README.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index 89446270c..bd70c1f39 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -14,7 +14,7 @@ This quickstart includes one app: This section shows how to run the application using the [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. -This example uses the Default LLM Component provided by Dapr for testing purposes. Here are other [supported Conversation components](https://v1-15.docs.dapr.io/reference/components-reference/supported-conversation/). +This example uses the default LLM Component provided by Dapr which simply echoes the input provided, for testing purposes. Here are other [supported Conversation components](https://v1-15.docs.dapr.io/reference/components-reference/supported-conversation/). Open a new terminal window and run the multi app run template: diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md index d9dc24c8d..406b5cc31 100644 --- a/conversation/go/sdk/README.md +++ b/conversation/go/sdk/README.md @@ -4,7 +4,7 @@ In this quickstart, you'll send an input to a mock Large Language Model (LLM) us Visit [this](https://v1-15.docs.dapr.io/developing-applications/building-blocks/conversation/conversation-overview/) link for more information about Dapr and the Conversation API. -> **Note:** This example leverages HTTP `requests` only. If you are looking for the example using the HTTP API [click here](../http/). +> **Note:** This example leverages the Dapr SDK. If you are looking for the example using the HTTP API [click here](../http/). This quickstart includes one app: @@ -14,7 +14,7 @@ This quickstart includes one app: This section shows how to run the application using the [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. -This example uses the Default LLM Component provided by Dapr for testing purposes. Here are other [supported Conversation components](https://v1-15.docs.dapr.io/reference/components-reference/supported-conversation/). +This example uses the default LLM Component provided by Dapr which simply echoes the input provided, for testing purposes. Here are other [supported Conversation components](https://v1-15.docs.dapr.io/reference/components-reference/supported-conversation/). Open a new terminal window and run the multi app run template: From 1abe94090bbed28ecd7698460b067e457a0d51ed Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 12:35:19 -0800 Subject: [PATCH 20/23] Update conversation/go/http/README.md Co-authored-by: Alice Gibbons Signed-off-by: Fernando Rocha --- conversation/go/http/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/http/README.md b/conversation/go/http/README.md index bd70c1f39..faf34d743 100644 --- a/conversation/go/http/README.md +++ b/conversation/go/http/README.md @@ -1,4 +1,4 @@ -# Dapr Conversation +# Dapr Conversation API (Go HTTP) In this quickstart, you'll send an input to a mock Large Language Model (LLM) using Dapr's Conversation API. This API is responsible for providing one consistent API entry point to talk to underlying LLM providers. From 8cd76a640ec97159974b84eb7a513f4113631396 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 12:35:29 -0800 Subject: [PATCH 21/23] Update conversation/go/sdk/README.md Co-authored-by: Alice Gibbons Signed-off-by: Fernando Rocha --- conversation/go/sdk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md index 406b5cc31..cfb7723a0 100644 --- a/conversation/go/sdk/README.md +++ b/conversation/go/sdk/README.md @@ -37,7 +37,7 @@ dapr run -f . The terminal console output should look similar to this, where: -- The app send an input `What is dapr?` to the `echo` LLM. +- The app sends an input `What is dapr?` to the `echo` Component mock LLM. - The LLM echoes `What is dapr?`. ```text From 51b7ba5f14d4c76fa16451ccb2a90b8628fb6758 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 12:35:35 -0800 Subject: [PATCH 22/23] Update conversation/go/sdk/README.md Co-authored-by: Alice Gibbons Signed-off-by: Fernando Rocha --- conversation/go/sdk/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conversation/go/sdk/README.md b/conversation/go/sdk/README.md index cfb7723a0..2e0bf997c 100644 --- a/conversation/go/sdk/README.md +++ b/conversation/go/sdk/README.md @@ -38,7 +38,7 @@ dapr run -f . The terminal console output should look similar to this, where: - The app sends an input `What is dapr?` to the `echo` Component mock LLM. -- The LLM echoes `What is dapr?`. +- The mock LLM echoes `What is dapr?`. ```text == APP - conversation == Input sent: What is dapr? From 5e29784aaabc58f1ca7f77d6ba7a2c58f15d8528 Mon Sep 17 00:00:00 2001 From: Fernando Rocha Date: Thu, 23 Jan 2025 12:41:21 -0800 Subject: [PATCH 23/23] removing files from PR Signed-off-by: Fernando Rocha --- pub_sub/javascript/http/order-processor/package-lock.json | 1 - .../distributed-calculator/react-calculator/client/yarn.lock | 5 ----- tutorials/distributed-calculator/react-calculator/yarn.lock | 5 ----- tutorials/pub-sub/react-form/client/yarn.lock | 5 ----- tutorials/pub-sub/react-form/yarn.lock | 5 ----- 5 files changed, 21 deletions(-) diff --git a/pub_sub/javascript/http/order-processor/package-lock.json b/pub_sub/javascript/http/order-processor/package-lock.json index 6c342295a..4815c51c6 100644 --- a/pub_sub/javascript/http/order-processor/package-lock.json +++ b/pub_sub/javascript/http/order-processor/package-lock.json @@ -9,7 +9,6 @@ "version": "1.0.0", "license": "ISC", "dependencies": { - "body-parser": "^1.19.0", "express": "^4.17.2" } }, diff --git a/tutorials/distributed-calculator/react-calculator/client/yarn.lock b/tutorials/distributed-calculator/react-calculator/client/yarn.lock index ac9807e90..61cf96285 100644 --- a/tutorials/distributed-calculator/react-calculator/client/yarn.lock +++ b/tutorials/distributed-calculator/react-calculator/client/yarn.lock @@ -4525,11 +4525,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2, fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - function-bind@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" diff --git a/tutorials/distributed-calculator/react-calculator/yarn.lock b/tutorials/distributed-calculator/react-calculator/yarn.lock index 1b86a59e1..8c21580fa 100644 --- a/tutorials/distributed-calculator/react-calculator/yarn.lock +++ b/tutorials/distributed-calculator/react-calculator/yarn.lock @@ -381,11 +381,6 @@ fresh@0.5.2: resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== -fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz" diff --git a/tutorials/pub-sub/react-form/client/yarn.lock b/tutorials/pub-sub/react-form/client/yarn.lock index 59a85ac2d..c26994644 100644 --- a/tutorials/pub-sub/react-form/client/yarn.lock +++ b/tutorials/pub-sub/react-form/client/yarn.lock @@ -4418,11 +4418,6 @@ fs.realpath@^1.0.0: resolved "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2, fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - function-bind@^1.1.1: version "1.1.1" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" diff --git a/tutorials/pub-sub/react-form/yarn.lock b/tutorials/pub-sub/react-form/yarn.lock index 666864f06..2aabf7654 100644 --- a/tutorials/pub-sub/react-form/yarn.lock +++ b/tutorials/pub-sub/react-form/yarn.lock @@ -381,11 +381,6 @@ fresh@0.5.2: resolved "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz" integrity sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q== -fsevents@~2.3.2: - version "2.3.2" - resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" - integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== - function-bind@^1.1.2: version "1.1.2" resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz"