-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updating OpenAI embedding example to use gateways to work better with… (
#2) … docker run
- Loading branch information
1 parent
012e520
commit 7d32049
Showing
3 changed files
with
52 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Computing text embeddings with Open AI | ||
|
||
This sample application shows how to use Open AI to compute text embeddings by calling the API. | ||
|
||
## Configure you OpenAI API Key | ||
|
||
Export to the ENV the access key to OpenAI | ||
|
||
``` | ||
export OPEN_AI_ACCESS_KEY=... | ||
``` | ||
|
||
## Deploy the LangStream application | ||
|
||
``` | ||
./bin/langstream docker run test -app examples/applications/compute-openai-embeddings -s examples/secrets/secrets.yaml | ||
``` | ||
|
||
## Talk with the Chat bot using the CLI | ||
Since the application opens a gateway, we can use the gateway API to send and consume messages. | ||
|
||
``` | ||
./bin/langstream gateway chat test -cg output -pg input -p sessionId=$(uuidgen) | ||
``` | ||
|
21 changes: 21 additions & 0 deletions
21
examples/applications/compute-openai-embeddings/gateways.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
gateways: | ||
- id: "input" | ||
type: produce | ||
topic: "input-topic" | ||
parameters: | ||
- sessionId | ||
produceOptions: | ||
headers: | ||
- key: langstream-client-session-id | ||
valueFromParameters: sessionId | ||
|
||
- id: "output" | ||
type: consume | ||
topic: "output-topic" | ||
parameters: | ||
- sessionId | ||
consumeOptions: | ||
filters: | ||
headers: | ||
- key: langstream-client-session-id | ||
valueFromParameters: sessionId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters