1 year ago
#305679
Hoa Vu
IBM Watson Discovery: Reusing data from a collection on Python
We need to reuse a Watson Discovery collection in another project programmatically. I inspect the request on the web version and seeing that it sends an object having "dataset_id"
:
{
"dataset_id": "xxxxxxxx-xxxx-xxx-xxxx-xxxxxxxxx",
"name": "PDFs",
"language": "en",
"projectType": "document_retrieval"
}
to https://us-south.discovery.watson.cloud.ibm.com/v2/api/instances/crn%3Av1%3Abluemix%3Apublic%3Adiscovery%3Aus-south%3Aa%{instance_id or something like that}1%3A%3A/v2/projects/{project_id}/collections
I tried to push the same data object using a modified create_collection but Discovery only creates a collection ignoring the dataset_id. Here's the output calling the modified create_collection:
url: /v2/projects/{project_id}/collections
result: {'name': 'PDFs', 'collection_id': 'xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxx', 'description': '', 'created': '2022-03-18T03:16:54.565Z', 'language': 'en', 'enrichments': []}
My question is whether it's possible to reuse collections programmatically? Am I missing something? What should I do in this case?
We need to do this in order to evaluate the discovery project' performance.
python
ibm-cloud
ibm-watson
watson-discovery
0 Answers
Your Answer