Skip to content

Commit 8c13f4f

Browse files
Ashlyn-BainAshlyn-Bain
Ashlyn-Bain
authored and
Ashlyn-Bain
committed
updating the files
1 parent 14ed752 commit 8c13f4f

26 files changed

+249
-0
lines changed

.DS_Store

6 KB
Binary file not shown.

docs/.DS_Store

0 Bytes
Binary file not shown.

docs/assets/.DS_Store

2 KB
Binary file not shown.

docs/assets/cos_url/1.png

274 KB
Loading

docs/assets/cos_url/10.png

127 KB
Loading

docs/assets/cos_url/11.png

708 KB
Loading

docs/assets/cos_url/12.png

112 KB
Loading

docs/assets/cos_url/13.png

264 KB
Loading

docs/assets/cos_url/14.png

126 KB
Loading

docs/assets/cos_url/15.png

160 KB
Loading

docs/assets/cos_url/16.png

159 KB
Loading

docs/assets/cos_url/17.png

121 KB
Loading

docs/assets/cos_url/18.png

160 KB
Loading

docs/assets/cos_url/2.png

242 KB
Loading

docs/assets/cos_url/3.png

560 KB
Loading

docs/assets/cos_url/4.5.png

257 KB
Loading

docs/assets/cos_url/4.png

343 KB
Loading

docs/assets/cos_url/5.png

260 KB
Loading

docs/assets/cos_url/6.png

262 KB
Loading

docs/assets/cos_url/7.png

356 KB
Loading

docs/assets/cos_url/8.png

235 KB
Loading

docs/assets/cos_url/9.png

80.5 KB
Loading

docs/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ The sections on this website are here to help you understand each component and
1212

1313
- The **[watsonx Assistant](./watsonx-assistant/index.md)** page will go over basic terminology that will be commonly used when using the product and include a walkthrough on creating simple actions.
1414

15+
- The **[Cloud Object Storage Video URL](./watsonx-assistant/video-url.md)** page will allow you to complete a walthrough of uploading an item to IBM Cloud Object Storage, generating a URL for that and then using the skills gained from the watsonx Assistant page to utilizie the URL in session variables.
16+
1517
- The **[Watson Discovery](./watson-discovery/WatsonDiscovery.md)** page will cover the basic components and concepts within the product and a walkthrough on creating projects and setting up your knowledge base.
1618

1719
- The **[Integrations](./integrations/integrations.md)** page includes a step-by-step walkthrough of how to integrate watsonx Assistant with both Watson Discovery and watsonx.ai.

docs/watsonx-assistant/index.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ Integrations connect the chatbot with external systems and platforms, expanding
3838

3939
Analytics monitor and analyze how users interact with the chatbot, providing insights into usage patterns, effectiveness of responses, and areas for improvement. This feedback is essential for optimizing the chatbot's performance and user satisfaction.
4040

41+
## Resources
42+
43+
- [IBM watsonx Assistant](https://www.ibm.com/products/watsonx-assistant?utm_content=SRCWW&p1=Search&p4=43700077724070556&p5=e&p9=58700008185854205&gclid=Cj0KCQjw9Km3BhDjARIsAGUb4nwJj7LtEgqgy4_uwSktoWQlqCcHyoF9btQM6zeVZeJ9zY2bhvuNscwaAhICEALw_wcB&gclsrc=aw.ds)
44+
45+
- [IBM watsonx Assistant Documentation](https://cloud.ibm.com/docs/watson-assistant?topic=watson-assistant-welcome-new-assistant)
46+
47+
- Intermediate Skill: [Video URL in RAG Scenario](./video-url)
48+
49+
4150
## Assistant Walkthrough
4251

4352
This is a walk-through tutorial on creating custom actions, utilizing session variables and previewing the assistant.

docs/watsonx-assistant/video-url.md

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
# Uploading Video Response in watsonx Assistant
2+
3+
4+
## Overview
5+
6+
This page will demonstrate how to upload a video to Cloud Object Storage (COS), generate a URL for the uploaded video, as well as how to use it within a RAG scenario in the watsonx Assistant UI.
7+
8+
### Resources
9+
- [Cloud Object Storage](https://www.ibm.com/products/cloud-object-storage?utm_content=SRCWW&p1=Search&p4=43700080002805342&p5=e&p9=58700008705498680&gclid=CjwKCAjw0aS3BhA3EiwAKaD2ZS65E_idgijcpWF9uDbPmvpjDAu0_gK94u5l6ALfAAs5D4F7YKJ2tBoCmVsQAvD_BwE&gclsrc=aw.ds)
10+
- [Cloud Object Storage Documentation](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-getting-started-cloud-object-storage)
11+
12+
13+
## High level steps:
14+
15+
1. Get access to COS
16+
- The Seller or CSM associated with your account should be able to direct you in how to obtain access
17+
18+
2. Uploaded video to Cloud Object Storage
19+
20+
3. Generate a pre-signed URL
21+
22+
4. Place generated URL within Knowledgebase Document
23+
- This step will vary based on what type of document you are uploading. For this walkthrough we will be using a Microsoft PowerPoint document
24+
- Please see the **[Watson Discovery](../watson-discovery/WatsonDiscovery.md)** documentation section for instructions on uploading those files
25+
26+
5. Update the Return parameter in the search extension within watsonx Assistnat
27+
- Please see the **[Integrations](../integrations/integrations.md)** documentation section for instructions on integrating watsonx Assistant with the knowledgebase
28+
29+
6. Create a Session Variable for the URL
30+
- Please see the **[watsonx Assistant](../watsonx-assistant/index.md)** walkthrough for more information on creating session variables
31+
32+
7. Create an iframe embedding with the Session Variable as Source
33+
34+
## COS Walthrough
35+
36+
### **Step 1: Cloud Object Storage Instance**
37+
38+
Once you have obtained your Cloud Object Storage Instance, you may access the instance through the Resource List in your IBM Cloud Account.
39+
Please select on the instance as shown in the screen capture below:
40+
41+
![test](../assets/cos_url/1.png)
42+
43+
### **Step 2: Create Bucket**
44+
45+
Once you have selected the instance, you must create a bucket. Please select the *Create Bucket +* button.
46+
47+
![](../assets/cos_url/2.png)
48+
49+
### **Step 3: Custom Bucket**
50+
51+
This step may vary based on what the Seller or CSM tied to your account tells you. For this walkthrough example we will be going with a Custom Bucket. Please select the *Create a Custom Bucket* option.
52+
53+
![](../assets/cos_url/3.png)
54+
55+
### **Step 4: Name Bucket**
56+
57+
Please add a name to the Cloud Object Storage Bucket within your instance. The specific configuration of your bucket may vary based on what the Seller or CSM tied to your account tells you. For this example we will leave the configurations as default. Please select *Create Bucket* at the botton right of the screen once named.
58+
59+
![](../assets/cos_url/4.png)
60+
61+
### **Step 5: Selecting Bucket**
62+
63+
Once you have created your bucket you will see it within your instance. Please select the custom bucket that was created in the brevious screen.
64+
65+
![](../assets/cos_url/4.5.png)
66+
67+
### **Step 6: Upload Files**
68+
69+
In this step, you will upload the files that you want to be stored in COS. Please drag and drop your files to the grey box area. In this walkthrough example we are using a watsonx Video.
70+
71+
![](../assets/cos_url/5.png)
72+
73+
### **Step 7: Endpoints**
74+
75+
#### Endpoint URL
76+
77+
Please select the *Endpoints* on the far left side of the screen. On this page, you will find the endpoint URLs which you will use in a later step of this example walkthrough.
78+
79+
![](../assets/cos_url/6.png)
80+
81+
### **Step 8: API Key**
82+
83+
Please scroll down to the bottom of the endpoint page and select the *Get Credentials* button on the *Get and API Key* option.
84+
85+
![](../assets/cos_url/7.png)
86+
87+
### **Step 9: Service Credentials**
88+
89+
Once you have entered the credential page, you should select *New Credential* in order to obtain keys that are vital for steps below.
90+
91+
![](../assets/cos_url/8.png)
92+
93+
### **Step 10: HMAC Credentials**
94+
95+
When creating the Service Credentials, it is important to **Include HMAC Credentials** as these are the important keys needed for generating the URL. Select *Add* once the toggle for HMAC credentials is selected.
96+
97+
![](../assets/cos_url/9.png)
98+
99+
### **Step 11: Obtaining Keys**
100+
101+
Once created, you will be able to see the credential in the **Service Credential** page and use the drop down to see the full creadentials.
102+
103+
![](../assets/cos_url/10.png)
104+
105+
## URL Walkthrough
106+
107+
### **Step 12: Generating Pre-Signed URL**
108+
109+
#### **Locate Documentation**
110+
111+
From this step you will be able to locate code that will allow you to generate a URL from the specified item in your COS bucket.
112+
113+
##### Resource
114+
- [Generating a pre-signed URL](https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-presign-url)
115+
116+
![](../assets/cos_url/11.png)
117+
118+
#### **Copy Code**
119+
120+
From the above site, you will have several options of creating a URL, in this example walkthrough we will be using python.
121+
122+
```{python}
123+
import ibm_boto3
124+
import os
125+
126+
bucket_name = '<bucekt name>'
127+
key_name = '<object key name>'
128+
http_method = 'get_object'
129+
expiration = 600 # time in seconds, default:600
130+
131+
access_key = '<COS_HMAC_ACCESS_KEY_ID>'
132+
secret_key = '<COS_HMAC_SECRET_ACCESS_KEY>'
133+
# Current list avaiable at https://control.cloud-object-storage.cloud.ibm.com/v2/endpoints
134+
cos_service_endpoint = 'https://s3.<region>.cloud-object-storage.appdomain.cloud'
135+
136+
cos = ibm_boto3.client("s3",
137+
aws_access_key_id=access_key,
138+
aws_secret_access_key=secret_key,
139+
endpoint_url=cos_service_endpoint
140+
)
141+
142+
signedUrl = cos.generate_presigned_url(http_method, Params={
143+
'Bucket': bucket_name, 'Key': key_name}, ExpiresIn=expiration)
144+
print("presigned download URL =>" + signedUrl)
145+
146+
```
147+
148+
Copy this code and save it in a python file to run.
149+
150+
Utilize the Service Credentials and Endpoint URL created/located in previous steps to fill in the specified variables. Please notes that key_name refers to the item that you wish to generate a URL for. The expiration date can be bypassed by utilizing a public bucket. More information within the documentation referenced above.
151+
152+
Run the python file. The output will be a URL.
153+
154+
*Output example: https://s3.us-south.cloud-object-storage.appdomain.cloud/BUCKETNAME/KEYNAME?AWSAccessKeyId=ACCESSKEYID* (link is expired)
155+
156+
## Metadata Walkthrough
157+
158+
### **Step 13: Locate Document File Properties**
159+
160+
Please open the document you wish to associate generated URL with. Once this is done select File in the corner. As specified in an earlier section, the file type may be different based on what you are doing within your organization. This example uses a Microsoft PowerPoint document.
161+
162+
![](../assets/cos_url/12.png)
163+
164+
### **Step 14: Paste into Properties**
165+
166+
Please open the properties of the desired file from the *File* section of the toolbar.
167+
168+
![](../assets/cos_url/13.png)
169+
170+
Paste the Generated URL in the subject of the properties panel for the document you wish to associate the generated URL with.
171+
172+
![](../assets/cos_url/14.png)
173+
174+
Once this step is complete you can upload this document to your knowledgebase. For instructions on that please refer to the **[Watson Discovery](./watson-discovery/WatsonDiscovery.md)** section of this documentation.
175+
176+
## Utilizing URL Walkthrough
177+
178+
### **Step 15: Return Alteration**
179+
180+
Within your search extension configuration in watsonx Assistant, please update the Return Parameter to include the extracted_metadata variable. This will allow for a session variable to pick up the URL which was pasted in the metadata of the document.
181+
182+
![](../assets/cos_url/15.png)
183+
184+
### **Step 16: Session Variable Asignment**
185+
186+
Please create a session variable for this URL. In this example the variable is called *'video_url'*. For information on creating a session variable please see the watsonx Assistant section of this documentation.
187+
188+
Assign the extracted_metadata subject to that session variable as shown below:
189+
190+
![](../assets/cos_url/16.png)
191+
192+
The Expression code is shown below. This code may change based on where the URL was put within the metadata and how the document was uploaded to the database.
193+
194+
```
195+
${search_results}.get(0).extracted_metadata.subject
196+
```
197+
198+
This assigns the generated URL to the created *'video_url'* session variable.
199+
200+
### **Step 17: Display URL**
201+
202+
In whichever way suits your business needs, please utilize the URL with an action in watsonx Assisant.
203+
204+
![](../assets/cos_url/17.png)
205+
206+
### **Step 18: iframe Embedding**
207+
208+
Ensure that the *'video_url'* session variable is set as the source of the iframe video embedding.
209+
210+
![](../assets/cos_url/18.png)
211+
212+
See JSON below:
213+
214+
```{JSON}
215+
{
216+
"generic": [
217+
{
218+
"title": "",
219+
"source": "${video_url}",
220+
"alt_text": "",
221+
"description": "",
222+
"response_type": "video",
223+
"channel_options": {
224+
"chat": {
225+
"dimensions": {
226+
"base_height": 180
227+
}
228+
}
229+
}
230+
}
231+
]
232+
}
233+
```
234+
235+
Please note that this example is a walkthrough and not meant to be a fully built out solution. This walkthrough demonstrates one of many ways to accomplish the task of utilizing a URL of an item hosted on IBM COS.
236+
237+
Some of these tasks can be automated through code.

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ nav:
5454
- generative-ai/watsonx.md
5555
- watsonx Assistant:
5656
- watsonx-assistant/index.md
57+
- watsonx-assistant/video-url.md
5758
- Watson Discovery:
5859
- watson-discovery/WatsonDiscovery.md
5960
- Assistant Integrations:

0 commit comments

Comments
 (0)