A repo containing the basics for setting up one of the watson developer cloud SDKs with a Q&A use case
Shows the comparison on what the Watson Discovery Service can add to your data to make the search experience return more relevant results
When this button is clicked, it will begin the process of creating a deployment toolchain based on the master branch of the repo into Bluemix and you will have to modify the application name to the name of the host you want to put it at. The default will get mapped to {organization/user}-{repo_name}-{timestamp}.
The running demo of this knowledge-base-search
is at https://knowledge-base-search.mybluemix.net
After creating the toolchain, you must either run the deployment script as part of the Continuous Delivery which will create the services for you, or refer to the Services section below to create them manually.
The deployment script found in the "Create Toolchain" should automatically create a NLU service if it doesn't exist, but an instance of Discovery will require additional configuration even when the deployment script creates it. See the section below about creating collections and configurations in Discovery. To do the manual creation of these required services, follow these steps:
- Make a copy of
.env.example
at.env
and fill with your service credentials by setting up new services on bluemix - Discovery
- Natural Language Understanding
You may use the Watson Discovery Tooling UI to complete these next steps.
Or if you prefer using python scripts aided by markdown-formatted explanation (known as Jupyter Notebooks), you can use the steps found in notebooks/Setup_Discovery.ipynb
of this repo. The notebook
section can be run locally by doing pip install -r server/requirements/dev.txt
followed by jupyter notebook
which will prompt you to open your browser to follow the steps in the interactive code guide. Each script can be run independently as each step is located in the notebooks/scripts
directory.
- Create 2 collections in the Watson Discovery Service. Make sure to store the names in the
.env
file and add them to the environment variables in your deployment configuration. By default, they are set to:DISCOVERY_REGULAR_COLLECTION_NAME=knowledge_base_regular DISCOVERY_ENRICHED_COLLECTION_NAME=knowledge_base_enriched
- Upload sample documents to the collections you created by dragging and dropping files from the
data/sample
directory into each collection created in the Watson Discovery Tooling UI
Once the toolchain is created, the services are created, the Discovery Service is configured, and the data is uploaded, you can either make a commit to your repo to trigger a new build or manually run the deployment in the toolchain created above.
View your running app at the host defined by the application name defined in your toolchain setup above (which by default will be https://{organization/user}-{repo_name}-{timestamp}.mybluemix.net
)
Client side is built with React
- Run
npm install --prefix client/knowledge_base_search
to install the necessary dependencies. - Run
npm start --prefix client/knowledge_base_search
- visit http://locahost:3000/ - To run statically through your server, run
npm run build --prefix client/knowledge_base_search
to produce static assets - Linter run with
npm run lint --prefix client/knowledge_base_search
- Unit tests run with
npm run test-unit --prefix client/knowledge_base_search
- Integration tests run with
npm run test-integration --prefix client/knowledge_base_search
(NOTE:npm run build --prefix client/knowledge_base_search
must be run first) - Run all tests with
npm test --prefix client/knowledge_base_search
- Install python version 2.7
- Install virtual_env
- Activate
virtualenv
virtualenv .
in project root directorysource bin/activate
in project root directory- Install dependencies
pip install -r server/python/requirements/dev.txt
- Start server
python server/python/server.py
- Visit http://localhost:5000/
- Linter run with
flake8
- Tests run with
pytest
Sample web applications that include this package may be configured to track deployments to IBM Bluemix and other Cloud Foundry platforms. The following information is sent to a Deployment Tracker service on each deployment:
- Python package version
- Python repository URL
- Application Name (
application_name
) - Application GUID (
application_id
) - Application instance index number (
instance_index
) - Space ID (
space_id
) - Application Version (
application_version
) - Application URIs (
application_uris
) - Labels of bound services
- Number of instances for each bound service and associated plan information
This data is collected from the setup.py
file in the sample application and the VCAP_APPLICATION
and VCAP_SERVICES
environment variables in IBM Bluemix and other Cloud Foundry platforms. This data is used by IBM to track metrics around deployments of sample applications to IBM Bluemix to measure the usefulness of our examples, so that we can continuously improve the content we offer to you. Only deployments of sample applications that include code to ping the Deployment Tracker service will be tracked.