Intent Recognition
Intent Recognition recognizes intent throughout the input text.
intents
boolean Default: false
Try this feature out in our API Playground!
Intent Recognition accepts an input text, divides it into a list of segments comprised of sections of the text, and assigns a description of intent to each text segment.
For example, if the input text comes from a chatbot interface for a banking application, one segment of text may include the statement “I need to check my account balance.” Deepgram’s intent recognition system would recognize that the user’s intent is to inquire about their account balance and then assign a description of “Check balance”.
The intents that can be identified are not a fixed list; this TSLM powered feature is able to generate intents based on the context of the language content in the text. You may also choose to use the optional custom-intent
parameter to provide a custom intent you want detected if present within the provided text.
Enable Feature
To enable Intent Recognition, use the following parameter in the query string when you call Deepgram’s /read
endpoint:
intents=true
Basic Text Request
To analyze text from a file on your computer, run the following curl command in a terminal or your favorite API client.
Replace YOUR_DEEPGRAM_API_KEY
with your Deepgram API Key.
Basic URL Request
To analyze text from a hosted file, run the following curl command in a terminal or your favorite API client. (Try testing it out with the hosted file https://static.deepgram.com/examples/aura.txt)
Custom Intent Request
To tell the model to only return intents from your own custom list of intents, add custom_intent_mode=strict
and custom_intent=
followed by the list of intents. (Use the URL encoding%20
to represent a space between each word in the list.)
If you want to return your own custom list of intents in addition to Deegpram’s list of intents, set custom_intent_mode=extended
and add your custom list.
Read our Text Intelligence Getting Started guide, which will walk you through making a basic text request and a basic URL request with the Deepgram SDKs.
Query Parameters
Analyze Response
When the file is finished processing, you’ll receive a JSON response that has the following basic structure:
Use the API reference or the API Playground to view the detailed response.
The response object values for intents
are:
segments
: The list of segments of text identified by the model as containing notable intents.intent
: The name of the intent detected by the model. This will always be in the form of a verb.confidence_score
: a floating point from 0 to 1 representing the models confidence in this prediction.
API Error Responses
Unsupported Language
Status 400
If you request Intent Recognition with an unsupported language by specifying a language code such as intents=true&language=es
or intents=true&detect_language=true
where the detected language is unsupported, you will get the error message below.
Token Limit Exceeded
Status 400
If the request’s input length exceeded the 150k token rate limit per request, you will get the error message below.
Missing Query Parameter
Status 400
If the request sent contained only the feature parameter (intents
) but not the language
parameter, you will receive this error.