Analyze videos
The TwelveLabs Node.js SDK provides methods to analyze videos to generate text from their content.
Open-ended analysis
Description: This method analyzes a video and generates text based on its content.
Note
This method is rate-limited. For details, see the Rate limits page.
Function signature and example:
Parameters
The AnalyzeRequest class contains the following properties:
The ResponseFormat class contains the following properties:
Return value
Returns a Promise that resolves to a NonStreamAnalyzeResponse object containing the generated text.
The NonStreamAnalyzeResponse interface contains the following properties:
The TokenUsage interface contains the following properties:
The maximum length of the response is 4,096 tokens.
API Reference
Open-ended analysis page.
Related guide
Open-ended analysis with streaming responses
Description: This method analyzes a video and generates text based on its content.
Note
This method is rate-limited. For details, see the Rate limits page.
Function signature and example:
Parameters
The AnalyzeStreamRequest class contains the following properties:
The ResponseFormat class contains the following properties:
Return value
Returns a promise that resolves to a Stream<TwelvelabsApi.StreamAnalyzeResponse> object that can be iterated over to receive streaming text chunks.
The StreamAnalyzeResponse can be either a StreamAnalyzeResponse.StreamStart, a StreamAnalyzeResponse.TextGeneration, or a StreamAnalyzeResponse.StreamEnd.
The StreamAnalyzeResponse.StreamStart interface contains the following properties:
The StreamAnalyzeResponse.TextGeneration interface contains the following properties:
The StreamAnalyzeResponse.StreamEnd interface contains the following properties:
The StreamStartResponseMetadata interface contains the following properties:
The StreamEndResponseMetadata interface contains the following properties:
The TokenUsage interface contains the following properties:
The maximum length of the response is 4,096 tokens.
API Reference
Open-ended analysis page.
Related guide
Error codes
This section lists the most common error messages you may encounter while analyzing videos.
token_limit_exceeded- Your request could not be processed due to exceeding maximum token limit. Please try with another request or another video with shorter duration.
index_not_supported_for_generate- You can only summarize videos uploaded to an index with an engine from the Pegasus family enabled.