vania-janet/multiturn-rag-retrieval-data huggingface dataset:
git clone https://github.com/ibm-functions/template-get-external-resource.git
2. Navigate to the directory for the action runtime that you want to use. For example, nodejs.
cd template-get-external-resource/runtimes/nodejs
3. Deploy the template with a custom package name as an environment variable.
PACKAGE_NAME=<name> ibmcloud fn deploy -m manifest.yaml
<-- </ol> -->After the template deploys, you can make further edits to the code to customize it as needed, or go back and check out the catalog of available templates.<-- </section "id="section-get-http-resource-template-cli" "> --><-- <section "id="section-get-http-resource-template-invoke" "> --> Invoking the Get HTTP Resource action Test out the Get HTTP Resource action by using one of the following methods:<-- <ul> --> * From the Cloud Functions Actions]Actions page] ! ! ! ! ! page, select the action and then click Invoke.
You can change the input parameter by selecting Change Input and then entering valid JSON in the following format:

{
"location": "<new location>"
}

For example,

{
"location": "Paris"
}
* Opening a URL by using the following structure https://<apihost>/api/v1/web/<namespace_ID>/<package name>/location.html in your browser. You can get the URL for any action by running the action get command.
ibmcloud fn action get <action_name> --url

Add a parameter for location by appending ?location=<city> to the end of the URL.

https://us-south.functions.cloud.ibm.com/api/v1/web/myusername@email.com_myspace/get-http-resource/location?location=Paris
The following table summarizes the options that are used with the build create command in this example. For more information about the command and its options, see the [ibmcloud ce build create](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-build-create) command.



Table 1. Command description

 Option Description 

 --name The name of the build. Use a name that is unique within the project. This value is required.<br><br><br><br> * The name must begin with a lowercase letter.<br> * The name must end with a lowercase alphanumeric character.<br> * The name must be 55 characters or fewer and can contain letters, numbers, and hyphens (-).<br><br><br> 
 --source The URL of the Git repository that contains your source code; for example, https://github.com/IBM/CodeEngine. 
 --context-dir The directory in the repository that contains the buildpacks file or the Dockerfile. Specify this value if your buildpacks file or Dockerfile is contained in a subdirectory. This value is optional. 



2. Use the build get command to check the status of your build.

ibmcloud ce build get --name helloworld-build

Example output

Notice the generated name for the image, and that the name of the automatically created registry secret is of the format, ce-auto-icr-private-<region>.

Getting build 'helloworld-build'
OK

Name: helloworld-build
ID: abcdefgh-abcd-abcd-abcd-1a2b3c4d5e6f
Project Name: myproject
Project ID: 01234567-abcd-abcd-abcd-abcdabcd1111
Age: 2d15h
Created: 2022-05-24T09:58:43-05:00
Build Type: git
Status: Succeeded
Reason: all validations succeeded
ibmcloud ce job create --name myjob-repo --build-source https://github.com/IBM/CodeEngine --build-context-dir helloworld --wait

Example output

Creating job 'myjob-repo'...
Submitting build run 'myjob-repo-run-220420-15590196'...
Creating image 'private.us.icr.io/ce--abcde-glxo4kabcde/job-myjob-repo'...
Waiting for build run to complete...
Build run status: 'Running'
Build run completed successfully.
Run 'ibmcloud ce buildrun get -n myjob-repo-run-220420-15590196' to check the build run status.
OK

Because we specified the --wait option, the output of the job create command provides information on the progression of the build run before the job is created.

In this example, the built image is uploaded to the ce--abcde-glxo4kabcde namespace in IBM Cloud Container Registry.

The following table summarizes the options that are used with the job create command in this example. For more information about the command and its options, see the [ibmcloud ce job create](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-job-create) command.



Table 1. Command description

 Option Description 

 --name The name of the job. Use a name that is unique within the project. This value is required.<br><br><br><br> * The name must begin and end with a lowercase alphanumeric character.<br> * The name must be 63 characters or fewer and can contain letters, numbers, and hyphens (-).<br><br><br> 
 --build-source The URL of the Git repository that contains your source code; for example, https://github.com/IBM/CodeEngine.
Test it out by going to [https://myweatherprovider.mybluemix.net/today?zipcode=90210](https://myweatherprovider.mybluemix.net/today?zipcode=90210).

![explore-weatherapp-3.png](https://cloud.ibm.com/docs-content/v1/content/78bb71851d95d7580503eb9ba10cf3ae31490ade/apiconnect/tutorials/images/explore-weatherapp-3.png)



--------------------





 Import the sample app's OpenAPI spec to create a REST API proxy 



1. Launch the API Designer. In your terminal window, enter the following command: apic edit.
2. Log in using your IBMid. ![screenshot_apic-edit_login.png](https://cloud.ibm.com/docs-content/v1/content/78bb71851d95d7580503eb9ba10cf3ae31490ade/apiconnect/tutorials/images/screenshot_apic-edit_login.png)
3. In the API Designer, ensure that the navigation panel is open. If not, click >> to open it.
4. In the navigation panel, click Drafts.
5. Go to the APIs tab.
6. In the APIs tab, click Add.
7. From the drop-down menu, click Import API from a file or URL. ![toolkit-import-1.png](https://cloud.ibm.com/docs-content/v1/content/78bb71851d95d7580503eb9ba10cf3ae31490ade/apiconnect/tutorials/images/toolkit-import-1.png)
8.
Note, even though the --server and --username options are specified in the example command, the default value for the --server option is us.icr.io and the --username option defaults to iamapikey when the server is us.icr.io.

ibmcloud ce secret create --format registry --name myregistry --server us.icr.io --username iamapikey --password APIKEY

Example output

Creating registry secret 'myregistry'...
OK
3. Create your app and reference the hello_repo image in Container Registry. For example, use the [ibmcloud ce app create](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-application-create) command to create the myhelloapp app to reference the us.icr.io/mynamespace/hello_repo by using the myregistry access information.

ibmcloud ce app create --name myhelloapp --image us.icr.io/mynamespace/hello_repo --registry-secret myregistry

The format of the name of the image for this application is REGISTRY/NAMESPACE/REPOSITORY:TAG where REGISTRY and TAG are optional. If REGISTRY is not specified, the default is docker.io. If TAG is not specified, the default is latest.
4. After your app deploys, you can access the app. To obtain the URL of your app, run ibmcloud ce app get --name myhelloapp --output url. When you curl the myhelloapp app, Hello World is returned.

curl https://myhelloapp.abcdabcdhye.us-south.codeengine.appdomain.cloud







 Next steps 



* After your app deploys, [access your app](https://cloud.ibm.com/docs/codeengine?topic=codeengine-access-service) through a URL.
* For Windows, run set MQSAMP_USER_ID=<yourusername>
* For Mac or Linux, export MQSAMP_USER_ID=<yourusername>

<-- </ul> -->

5. Ensure the MQSERVER environment variable is not set by running unset MQSERVER6. Run the sample amqsputc, specifying queue name and queue manager name, for example:
amqsputc DEV.QUEUE.1 QM1
7. Enter the password for the application credential being used8. Once the message 'target queue is DEV.QUEUE.1' appears on command line, it is ready to send messages:
<-- <ol> -->

1. Type the message data/string and when ready press “ENTER” to send the message.
2. An empty string “ENTER” will end the sample.

<-- </ol> -->

9. You can use amqsgetc to receive the messages sent.
amqsgetc DEV.QUEUE.1 <YOURQMGRNAME>
<-- </ol> -->The C MQI sample program is using a secured connection to send/receive messages.<-- </section "id="section-export-the-necessary-environment-variables" "> --><-- </section "id="section-mqoc_connect_app_ssl_c_tasks" "> --><-- <section "id="section-mqoc_connect_app_ssl_jms_tasks" "> --> Tasks specific to the JMS Program If you are not familiar with the JMS sample program, there is a full tutorial on how to install and run the sample without TLS here: https://developer.ibm.com/learningpaths/ibm-mq-badge/write-run-first-mq-app/]https_developer_.ibm_.com_learningpaths_ibm_-mq_-badge_write_-run_-first_-mq_-app] !
curl "https://kafka-sender-app.abcdabcdabc.us-south.codeengine.appdomain.cloud?topic=kafka-topic1&num=1"
3. View events in logs. When your Kafka event subscription is created with a broker, topics and an access secret that are valid, and you have a Kafka app that produces messages on that topic (such as kafka-sender-app), then you can see events in logs for your destination Code Engine job that receives Kafka messages, such as kafka-receiver-job. For each message that is sent by using curl, the same number of job runs are triggered by the Kafka events. To view the events sent to jobs, use the ibmcloud ce jobrun logs command.



1. Use the ibmcloud ce jobrun list command to list the job runs for the kafka-receiver-job job.

ibmcloud ce jobrun list --job kafka-receiver-job
2. Use the ibmcloud ce jobrun logs command to obtain the logs for a specific job run.

ibmcloud ce jobrun logs -n kafka-receiver-job-abcde

Example output

Getting logs for all instances of job run 'kafka-receiver-job-abcde'...
Getting jobrun 'kafka-receiver-job-abcde'...
Getting instances of jobrun 'kafka-receiver-job-abcde'...
OK

kafka-receiver-job-abcde-0-0/kafka-receiver-job:
Hello from helloworld! I'm a batch job! Index: 0

Hello World from:
. ___ __ ____ ____
./ __)/ ( ( __)
( (__( O )) D ( ) _)
.___)__/(____/(____)
.____ __ _ ___ __ __ _ ____
This tutorial has a few quick examples on prefixes, transactions, leases, and watchers.

Expanded examples and features can be found in the [etcd demo](https://etcd.io/docs/v3.3.12/demo/), and more general information on using etcd is in [Interacting with etcd](https://etcd.io/docs/v3.3.12/dev-guide/interacting_v3/).



 Prefixes 

etcd stores key-values in a hierarchical system that allows you to store and retrieve information that is nested under layers of keys.

$ etcdctl put /foo-service/container1 examplename
OK

Use the --prefix option on the get command to query on the top-level directory.

$ etcdctl get --prefix /foo-service
/foo-service/container1
examplename

If adding more subdirectory keys and values, then the --prefix option returns all of them in the top-level directory.

$ etcdctl put /foo-service/container2 examplename2
OK
$ etcdctl put /foo-service/container3 examplename3
OK

$ etcdctl get --prefix /foo-service
/foo-service/container1
examplename
/foo-service/container2
examplename2
/foo-service/container3
examplename3





 Transactions 

Transactions take a series of etcd commands and apply them all as a single, atomic transaction. The txn command is broken into three parts.



* Define the key you would like to modify and its value before modifying.
* If the comparison is successful, enter the commands to run.
* If the comparison is a failure, enter the commands to run.



If you use interactive mode, etcdctl txn -i, the session prompts for the parts.

$ etcdctl put key1 1
OK

$ etcdctl txn -i
 compares:
mod("key1") > "0"
 success requests (get, put, delete):
put key1 "overwrote-key1"
>
./kafka-avro-console-[producer|consumer] --broker-list $BOOTSTRAP_ENDPOINTS --topic schema-test --property schema.registry.url=$SCHEMA_REGISTRY_URL --property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}' --property basic.auth.credentials.source=URL --producer.config $CONFIG_FILE

Replace the following variables in the example with your own values.



* BOOTSTRAP_ENDPOINTS with the value from your Event Streams Service Credentials tab in the IBM Cloud console, as the list of your bootstrap servers.
* SCHEMA_REGISTRY_URL with the kafka_http_url value from your Event Streams Service Credentials tab in the IBM Cloud console, with the username token and apikey, along with the path /confluent (for example, https://{token}:{apikey}@{kafka_http_url}/{confluent}).
* CONFIG_FILE with the path of the configuration file.



To execute using the credentials source method of USER_INFO, use the following code.

./kafka-avro-console-[producer|consumer] --broker-list $BOOTSTRAP_ENDPOINTS --topic schema-test --property schema.registry.url=$SCHEMA_REGISTRY_URL --property value.schema='{"type":"record","name":"myrecord","fields":[{"name":"f1","type":"string"}]}' --property basic.auth.credentials.source=USER_INFO --property basic.auth.user.info=token:apikey --producer.config $CONFIG_FILE

Replace the following variables in the example with your own values.



* BOOTSTRAP_ENDPOINTS with the value from your Event Streams Service Credentials tab in the IBM Cloud console, as the list of your bootstrap servers.
ddoc='cities-designdoc',
index='cities',
query='lat:\[0+TO+90\]',
sort=['<distance,lon,lat,-74.0059,40.7127,km>']
).get_result()

print(response)

postSearchOptions := service.NewPostSearchOptions(
"examples",
"cities-designdoc",
"cities",
"lat:\[0+TO+90\]",
)
postSearchOptions.SetSort([]string{"<distance,lon,lat,-74.0059,40.7127,km>"})

searchResult, _, err := service.PostSearch(postSearchOptions)
if err != nil {
panic(err)
}

b, _ := json.MarshalIndent(searchResult, "", " ")
fmt.Println(string(b))

The previous Go example requires the following import block:

import (
"encoding/json"
"fmt"
"github.com/IBM/cloudant-go-sdk/cloudantv1"
)

See the following example (abbreviated) response that includes a list of northern hemisphere cities that are sorted by distance to New York:

{
"total_rows": 205,
"bookmark": "g1A...XIU",
"rows": [
{
"id": "city180",
"order":
8.530665755719783,
18
],
"fields": {
"city": "New York, N.Y.",
"lat": 40.78333333333333,
"lon": -73.96666666666667
}
},
{
"id": "city177",
You can get the URL for any action by running the action get command.
ibmcloud fn action get <action_name> --url

Add a parameter for location by appending ?location=<city> to the end of the URL.

https://us-south.functions.cloud.ibm.com/api/v1/web/myusername@email.com_myspace/get-http-resource/location?location=Paris
* Curling the following URL: https://us-south.functions.cloud.ibm.com/api/v1/web/<namespace_ID>/<package_name>/location?location=<city>. For example:
curl https://us-south.functions.cloud.ibm.com/api/v1/web/myusername@email.com_myspace/get-http-resource/location?location=Paris
<-- </ul> -->All these invocations return the default location Austin or else the location parameter that you specified in JSON format. {
"body": {
"location": "Paris"
},
"headers": {
"Content-Type": "application/json"
},
"statusCode": 200
}
<-- </section "id="section-get-http-resource-template-invoke" "> --><-- </section "id="section-get-http-resource-template" "> --><-- <section "id="section-hello-world-template" "> --> Deploying the Hello World template You can deploy this basic Hello World action to get started with Cloud Functions or to test other entities you create, such as triggers and rules.When you deploy this template, you create a single action called helloworld.
curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --header "Accept: audio/wav" --output full-cheerful-style.wav --data "{"text":"<express-as style='cheerful'>Oh, that's good news! I am very happy for you!</express-as>"}" "{url}/v1/synthesize?voice=en-US_EmmaExpressive"

The following example HTTP request uses the cheerful style for the first sentence of the request only. The second sentence is spoken with the default voice. The example again uses the en-US_EmmaExpressive voice.

IBM Cloud

curl -X POST -u "apikey:{apikey}" --header "Content-Type: application/json" --header "Accept: audio/wav" --output partial-cheerful-style.wav --data "{"text":"<express-as style='cheerful'>Oh, that's good news!</express-as> Do you need any further help?"}" "{url}/v1/synthesize?voice=en-US_EmmaExpressive"

IBM Cloud Pak for Data

curl -X POST --header "Authorization: Bearer {token}" --header "Content-Type: application/json" --header "Accept: audio/wav" --output partial-cheerful-style.wav --data "{"text":"<express-as style='cheerful'>Oh, that's good news!</express-as> Do you need any further help?"}" "{url}/v1/synthesize?voice=en-US_EmmaExpressive"







 Emphasizing interjections 

When you use expressive neural voices, the service automatically detects a number of common interjections based on context. In the resulting audio, it gives them the natural emphasis that a human would use in normal conversation.

Table 2 lists the interjections that the service recognizes and provides examples of how they are pronounced in synthesized speech. The samples use the en-US_AllisonExpressive voice.
2. Target a resource group by running the following command. To get a list of your resource groups, run ibmcloud resource groups.

ibmcloud target -g <resource_group>

Example output

Targeted resource group default







 Step 2: Creating a project 

A Code Engine "project" is similar to a Cloud Foundry "space" in that it groups related workloads into a logical collection that is meaningful to the developer. You can group workloads into different projects based on whatever criteria that makes sense to you, for example, company organization structure, dependencies between the workloads, or development versus test versus production environments. Keep in mind that workloads within a single project share a private network and are isolated within the security boundary of the project. All workloads within a project can talk to each other freely without concern of being seen by workloads outside of the cluster. If workloads in different projects want to communicate with each other, then the communication must either use the internet or an internal IBM private network. For more information, see [Options for visibility for a Code Engine application](https://cloud.ibm.com/docs/codeengine?topic=codeengine-application-workloadsoptionsvisibility).

Create a project in Code Engine called sample.

ibmcloud ce project create --name sample

Example output

Creating project 'sample'...
ID for project 'sample' is 'abcdabcd-abcd-abcd-abcd-abcd12e3456f7'.
Waiting for project 'sample' to be active...
Now selecting project 'sample'.
OK

Notice that your project is also selected for context, so all subsequent application-related commands are within the scope of this new sample project.





 Step 3: Creating a directory and source code 



1. Create a directory on your local workstation that is named myapp and navigate into it. In this directory, save all the files that are required to build the image and to run your app.

mkdir myapp && cd myapp
2. Create a file called server.js and copy the following source code into it.
The following table summarizes the options that are used with the buildrun submit command in this example. For more information about the command and its options, see the [ibmcloud ce buildrun submit](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-buildrun-submit) command.



Table 5. Command description

 Option Description 

 --name The name of the build run. Use a name that is unique within the project. This value is required.<br><br><br><br> * The name must begin and end with a lowercase letter.<br> * The name must be 63 characters or fewer and can contain lowercase alphanumeric characters and hyphens (-).<br><br><br> 
 --source The path to the local source that contains your source code or the URL of the Git repository; for example, .. 



4. Use the buildrun get command to check the status of your build run.

ibmcloud ce buildrun get --name buildrun-local-dockerfile

Example output

Getting build run 'buildrun-local-dockerfile'...
For troubleshooting information visit: https://cloud.ibm.com/docs/codeengine?topic=codeengine-troubleshoot-build.
Run 'C:Program FilesIBMCloudbinibmcloud.exe ce buildrun events -n buildrun-local-dockerfile' to get the system events of the build run.
Run 'C:Program FilesIBMCloudbinibmcloud.exe ce buildrun logs -f -n buildrun-local-dockerfile' to follow the logs of the build run.
OK

Name: buildrun-local-dockerfile
ID: abcdefgh-abcd-abcd-abcd-1a2b3c4d5e6f
Project Name: myproject
Project ID: 01234567-abcd-abcd-abcd-abcdabcd1111
Age: 2d15h
This image is built from sender.go, which is available from the [Samples for IBM Cloud Code Engine GitHub repo](https://github.com/IBM/CodeEngine/tree/main/kafka). This sample sender app requires the password credentials that are stored in your kafka-subscription-secret, and it requires the BROKERS environment variable.
* Specify the --env-from-secret option to reference the full secret, kafka-subscription-secret, which contains the password credentials.
* Specify the --env option to add a literal environment variable, BROKERS, and provide the name of one of the brokers hosts listed in the details of the service credentials in the Event Streams service instance. However, if you want to specify more than one broker hostname, use the format --env BROKERS-broker1,broker2,broker3.
* (optional) Specify the --min-scale=1 option so that the app always has an instance that is running and does not scale to zero. Configuring the app to always have a running instance is useful when you view logs. If you are running in a production environment, consider the cost of keeping a running instance of your app or whether you want Code Engine to autoscale to zero. By default, the app scales to zero when not in use.

ibmcloud ce app create --name kafka-sender-app --image icr.io/codeengine/kafka-sender --env-from-secret kafka-subscription-secret --env BROKERS=broker-4-abcdabcdabcdabcd.kafka.svc07.us-south.eventstreams.cloud.ibm.com:9093 --min-scale 1



3. After you deploy this app, run the app get command to confirm that the app is in ready status.

ibmcloud ce app get -n kafka-sender-app



You created the kafka-sender-app app to produce Kafka messages for Code Engine event subscriptions, and you created the kafka-subscription-secret secret that contains the required credentials.
Run 'ibmcloud ce buildrun get -n helloworld-buildrun2' to check the build run status.
OK

The following table summarizes the options that are used with the buildrun submit command in this example. For more information about the command and its options, see the [ibmcloud ce buildrun submit](https://cloud.ibm.com/docs/codeengine?topic=codeengine-clicli-buildrun-submit) command.



Table 2. Command description

 Option Description 

 --name The name of the build run. Use a name that is unique within the project. This value is required.<br><br><br><br> * The name must begin and end with a lowercase letter.<br> * The name must be 63 characters or fewer and can contain lowercase alphanumeric characters and hyphens (-).<br><br><br> 
 --image The location of the image registry. The format of the location must be REGISTRY/NAMESPACE/REPOSITORY or REGISTRY/NAMESPACE/REPOSITORY:TAG where TAG is optional. If TAG is not specified, the default is latest. 
 --registry-secret The registry secret that is used to access the registry when you create the container image. Run the secret create --format registry command to create a registry secret. The registry secret is used to authenticate with a private registry. 
 --source The URL of the Git repository or the path to the local source that contains your source code; for example, https://github.com/IBM/CodeEngine. 
 --context-dir The directory in the repository that contains the buildpacks file or the Dockerfile. Specify this value if your buildpacks file or Dockerfile is contained in a subdirectory. 



2. Use the buildrun get command to check the status of your build run.

ibmcloud ce buildrun get --name helloworld-buildrun2

Example output

Getting build run 'helloworld-buildrun2'...