page_type | languages | products | description | urlFragment | ||
---|---|---|---|---|---|---|
sample |
|
|
These samples will show you how to get up and running using the SDKs for various Cognitive Services. |
cognitive-services-node-sdk-samples |
These samples will show you how to get up and running using the SDKs for various Cognitive Services. They'll cover a few rudimentary use cases and hopefully express best practices for interacting with the data from these APIs.
Please note that this samples package references an all-in-one SDK which includes all Bing services. Individual packages exist for each service if you would prefer working with smaller assembly sizes. Both individual service packages as well as the all-in-one will have feature parity for a particular service.
This project framework provides examples for the following services:
- Using the Bing Entity Search SDK [individual package][complete package] for the Entity Search API
- Using the Bing Web Search SDK [individual package][complete package] for the Web Search API
- Using the Bing Video Search SDK [individual package][complete package] for the Video Search API
- Using the Bing News Search SDK [individual package][complete package] for the News Search API
- Using the Bing Image Search SDK [individual package][complete package] for the Image Search API
- Using the Bing Custom Search SDK [individual package][complete package] for the Custom Search API
- Using the Bing Visual Search SDK [individual package][complete package] for the Visual Search API
- Using the Bing Spell Check SDK [individual package][complete package] for the Spell Check API
- Using the Computer Vision SDK [individual package][complete package] for the Computer Vision API
- Using the Content Moderator SDK [individual package][complete package] for the Content Moderator API
- Using the Custom Vision Training SDK [individual package][complete package] for the Custom Vision Trianing API
- Using the Custom Vision Prediction SDK [individual package][complete package] for the Custom Vision Prediction API
-
If you don't already have it, get node.js. Install a version greater than 8.0.
-
Clone the repository.
git clone https://github.com/Azure-Samples/cognitive-services-node-sdk-samples.git
-
Install the dependencies.
cd cognitive-services-node-sdk-samples npm install
-
Get a cognitive services API key with which to authenticate the SDK's calls. Create a new Azure account, and try Cognitive Services for free.
-
Set the following environment variables using the information from the service principle that you created. You only need to set the environment variables for which you want to run the samples.
export AZURE_ENTITY_SEARCH_KEY={your service key} export AZURE_WEB_SEARCH_KEY={your service key} export AZURE_VIDEO_SEARCH_KEY={your service key} export AZURE_NEWS_SEARCH_KEY={your service key} export AZURE_IMAGE_SEARCH_KEY={your service key} export AZURE_CUSTOM_SEARCH_KEY={your service key} export AZURE_VISUAL_SEARCH_KEY={your service key} export AZURE_SPELL_CHECK_KEY={your service key} export AZURE_COMPUTER_VISION_KEY={your service key} export AZURE_CONTENT_MODERATOR_KEY={your service key} export AZURE_CUSTOM_VISION_TRAINING_KEY={your service key} export AZURE_CUSTOM_VISION_PREDICTION_KEY={your service key}
[AZURE.NOTE] On Windows, use
set
instead ofexport
. [AZURE.NOTE] For Custom Vision Service samples you need to set both keys. -
Run the sample.
node index.js
-
Navigate through the console app to play with the examples. If a sample ends prematurely and does not return results, please make sure the service-key being used is valid for that service.
To see the code of each example, simply look at the examples in the Samples folder. They are written to be isolated in scope so that you can see only what you're interested in.