Skip to content

Commit f55b18d

Browse files
docs(readme): update and remove refs to deprecated services
1 parent 397144f commit f55b18d

File tree

1 file changed

+42
-42
lines changed

1 file changed

+42
-42
lines changed

README.md

+42-42
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ The file downloaded will be called `ibm-credentials.env`. This is the name the S
9595
As long as you set that up correctly, you don't have to worry about setting any authentication options in your code. So, for example, if you created and downloaded the credential file for your Discovery instance, you just need to do the following:
9696

9797
```python
98-
discovery = DiscoveryV1(version='2019-04-30')
98+
assistant = AssistantV2(version='2024-08-25')
9999
```
100100

101101
And that's it!
@@ -122,7 +122,7 @@ export ASSISTANT_AUTH_TYPE="iam"
122122
The credentials will be loaded from the environment automatically
123123

124124
```python
125-
assistant = AssistantV1(version='2018-08-01')
125+
assistant = AssistantV2(version='2024-08-25')
126126
```
127127

128128
#### Manually
@@ -142,15 +142,15 @@ You supply either an IAM service **API key** or a **bearer token**:
142142
#### Supplying the API key
143143

144144
```python
145-
from ibm_watson import DiscoveryV1
145+
from ibm_watson import AssistantV2
146146
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
147147

148148
# In the constructor, letting the SDK manage the token
149149
authenticator = IAMAuthenticator('apikey',
150150
url='<iam_url>') # optional - the default value is https://iam.cloud.ibm.com/identity/token
151-
discovery = DiscoveryV1(version='2019-04-30',
151+
assistant = AssistantV2(version='2024-08-25',
152152
authenticator=authenticator)
153-
discovery.set_service_url('<url_as_per_region>')
153+
assistant.set_service_url('<url_as_per_region>')
154154
```
155155

156156
#### Generating bearer tokens using API key
@@ -166,36 +166,36 @@ token = iam_token_manager.get_token()
166166
##### Supplying the bearer token
167167

168168
```python
169-
from ibm_watson import DiscoveryV1
169+
from ibm_watson import AssistantV2
170170
from ibm_cloud_sdk_core.authenticators import BearerTokenAuthenticator
171171

172172
# in the constructor, assuming control of managing the token
173173
authenticator = BearerTokenAuthenticator('your bearer token')
174-
discovery = DiscoveryV1(version='2019-04-30',
174+
assistant = AssistantV2(version='2024-08-25',
175175
authenticator=authenticator)
176-
discovery.set_service_url('<url_as_per_region>')
176+
assistant.set_service_url('<url_as_per_region>')
177177
```
178178

179179
#### Username and password
180180

181181
```python
182-
from ibm_watson import DiscoveryV1
182+
from ibm_watson import AssistantV2
183183
from ibm_cloud_sdk_core.authenticators import BasicAuthenticator
184184

185185
authenticator = BasicAuthenticator('username', 'password')
186-
discovery = DiscoveryV1(version='2019-04-30', authenticator=authenticator)
187-
discovery.set_service_url('<url_as_per_region>')
186+
assistant = AssistantV2(version='2024-08-25', authenticator=authenticator)
187+
assistant.set_service_url('<url_as_per_region>')
188188
```
189189

190190
#### No Authentication
191191

192192
```python
193-
from ibm_watson import DiscoveryV1
193+
from ibm_watson import AssistantV2
194194
from ibm_cloud_sdk_core.authenticators import NoAuthAuthenticator
195195

196196
authenticator = NoAuthAuthenticator()
197-
discovery = DiscoveryV1(version='2019-04-30', authenticator=authenticator)
198-
discovery.set_service_url('<url_as_per_region>')
197+
assistant = AssistantV2(version='2024-08-25', authenticator=authenticator)
198+
assistant.set_service_url('<url_as_per_region>')
199199
```
200200

201201
### MCSP
@@ -221,17 +221,17 @@ Tested on Python 3.9, 3.10, and 3.11.
221221

222222
If you have issues with the APIs or have a question about the Watson services, see [Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-watson+python).
223223

224-
## Configuring the http client (Supported from v1.1.0)
224+
## Configuring the http client
225225

226226
To set client configs like timeout use the `set_http_config()` function and pass it a dictionary of configs. See this [documentation](https://requests.readthedocs.io/en/latest/api/) for more information about the options. All options shown except `method`, `url`, `headers`, `params`, `data`, and `auth` are configurable via `set_http_config()`. For example for a Assistant service instance
227227

228228
```python
229-
from ibm_watson import AssistantV1
229+
from ibm_watson import AssistantV2
230230
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
231231

232232
authenticator = IAMAuthenticator('your apikey')
233-
assistant = AssistantV1(
234-
version='2021-11-27',
233+
assistant = AssistantV2(
234+
version='2024-08-25',
235235
authenticator=authenticator)
236236
assistant.set_service_url('https://api.us-south.assistant.watson.cloud.ibm.com')
237237

@@ -248,12 +248,12 @@ To use the SDK with any proxies you may have they can be set as shown below. For
248248
See this example configuration:
249249

250250
```python
251-
from ibm_watson import AssistantV1
251+
from ibm_watson import AssistantV2
252252
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
253253

254254
authenticator = IAMAuthenticator('your apikey')
255-
assistant = AssistantV1(
256-
version='2021-11-27',
255+
assistant = AssistantV2(
256+
version='2024-08-25',
257257
authenticator=authenticator)
258258
assistant.set_service_url('https://api.us-south.assistant.watson.cloud.ibm.com')
259259

@@ -268,12 +268,12 @@ assistant.set_http_config({'proxies': {
268268
To send custom certificates as a security measure in your request, use the cert property of the HTTPS Agent.
269269

270270
```python
271-
from ibm_watson import AssistantV1
271+
from ibm_watson import AssistantV2
272272
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
273273

274274
authenticator = IAMAuthenticator('your apikey')
275-
assistant = AssistantV1(
276-
version='2021-11-27',
275+
assistant = AssistantV2(
276+
version='2024-08-25',
277277
authenticator=authenticator)
278278
assistant.set_service_url('https://api.us-south.assistant.watson.cloud.ibm.com')
279279

@@ -322,14 +322,14 @@ For example, to send a header called `Custom-Header` to a call in Watson Assista
322322
the headers parameter as:
323323

324324
```python
325-
from ibm_watson import AssistantV1
325+
from ibm_watson import AssistantV2
326326
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
327327

328328
authenticator = IAMAuthenticator('your apikey')
329-
assistant = AssistantV1(
330-
version='2018-07-10',
329+
assistant = AssistantV2(
330+
version='2024-08-25',
331331
authenticator=authenticator)
332-
assistant.set_service_url('https://gateway.watsonplatform.net/assistant/api')
332+
assistant.set_service_url('https://api.us-south.assistant.watson.cloud.ibm.com')
333333

334334
response = assistant.list_workspaces(headers={'Custom-Header': 'custom_value'}).get_result()
335335
```
@@ -339,14 +339,14 @@ response = assistant.list_workspaces(headers={'Custom-Header': 'custom_value'}).
339339
If you would like access to some HTTP response information along with the response model, you can set the `set_detailed_response()` to `True`. Since Python SDK `v2.0`, it is set to `True`
340340

341341
```python
342-
from ibm_watson import AssistantV1
342+
from ibm_watson import AssistantV2
343343
from ibm_cloud_sdk_core.authenticators import IAMAuthenticator
344344

345345
authenticator = IAMAuthenticator('your apikey')
346-
assistant = AssistantV1(
347-
version='2018-07-10',
346+
assistant = AssistantV2(
347+
version='2024-08-25',
348348
authenticator=authenticator)
349-
assistant.set_service_url('https://gateway.watsonplatform.net/assistant/api')
349+
assistant.set_service_url('https://api.us-south.assistant.watson.cloud.ibm.com')
350350

351351
assistant.set_detailed_response(True)
352352
response = assistant.list_workspaces(headers={'Custom-Header': 'custom_value'}).get_result()
@@ -372,20 +372,20 @@ Every SDK call returns a response with a transaction ID in the `X-Global-Transac
372372
### Suceess
373373

374374
```python
375-
from ibm_watson import AssistantV1
375+
from ibm_watson import AssistantV2
376376

377-
service = AssistantV1(authenticator={my_authenticator})
377+
service = AssistantV2(authenticator={my_authenticator})
378378
response_headers = service.my_service_call().get_headers()
379379
print(response_headers.get('X-Global-Transaction-Id'))
380380
```
381381

382382
### Failure
383383

384384
```python
385-
from ibm_watson import AssistantV1, ApiException
385+
from ibm_watson import AssistantV2, ApiException
386386

387387
try:
388-
service = AssistantV1(authenticator={my_authenticator})
388+
service = AssistantV2(authenticator={my_authenticator})
389389
service.my_service_call()
390390
except ApiException as e:
391391
print(e.global_transaction_id)
@@ -396,9 +396,9 @@ except ApiException as e:
396396
However, the transaction ID isn't available when the API doesn't return a response for some reason. In that case, you can set your own transaction ID in the request. For example, replace `<my-unique-transaction-id>` in the following example with a unique transaction ID.
397397

398398
```python
399-
from ibm_watson import AssistantV1
399+
from ibm_watson import AssistantV2
400400

401-
service = AssistantV1(authenticator={my_authenticator})
401+
service = AssistantV2(authenticator={my_authenticator})
402402
service.my_service_call(headers={'X-Global-Transaction-Id': '<my-unique-transaction-id>'})
403403
```
404404

@@ -436,7 +436,7 @@ If your service instance is of CP4D, below are two ways of initializing the assi
436436
The SDK will manage the token for the user
437437

438438
```python
439-
from ibm_watson import AssistantV1
439+
from ibm_watson import AssistantV2
440440
from ibm_cloud_sdk_core.authenticators import CloudPakForDataAuthenticator
441441

442442
authenticator = CloudPakForDataAuthenticator(
@@ -445,7 +445,7 @@ authenticator = CloudPakForDataAuthenticator(
445445
'<authentication url>', # should be of the form https://{icp_cluster_host}{instance-id}/api
446446
disable_ssl_verification=True) # Disable ssl verification for authenticator
447447

448-
assistant = AssistantV1(
448+
assistant = AssistantV2(
449449
version='<version>',
450450
authenticator=authenticator)
451451
assistant.set_service_url('<service url>') # should be of the form https://{icp_cluster_host}/{deployment}/assistant/{instance-id}/api
@@ -455,11 +455,11 @@ assistant.set_disable_ssl_verification(True) # MAKE SURE SSL VERIFICATION IS DIS
455455
### 2) Supplying the access token
456456

457457
```python
458-
from ibm_watson import AssistantV1
458+
from ibm_watson import AssistantV2
459459
from ibm_cloud_sdk_core.authenticators import BearerTokenAuthenticator
460460

461461
authenticator = BearerTokenAuthenticator('your managed access token')
462-
assistant = AssistantV1(version='<version>',
462+
assistant = AssistantV2(version='<version>',
463463
authenticator=authenticator)
464464
assistant.set_service_url('<service url>') # should be of the form https://{icp_cluster_host}/{deployment}/assistant/{instance-id}/api
465465
assistant.set_disable_ssl_verification(True) # MAKE SURE SSL VERIFICATION IS DISABLED

0 commit comments

Comments
 (0)