analyze_video, which answers a natural-language question about a video using the Pegasus video understanding model, and embed_text, which generates a multimodal embedding with the Marengo model that lives in the same latent space as TwelveLabs video, audio and image embeddings (useful for searching a video corpus by text).
Prerequisites
You need to install thetwelvelabs library and an API key which can be obtained from the TwelveLabs dashboard.
TWELVELABS_API_KEY environment variable.
Example
The following agent will use TwelveLabs to answer a question about a video and to generate a text embedding.cookbook/91_tools/twelvelabs_tools.py
Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
api_key | Optional[str] | None | The TwelveLabs API key. Read from the TWELVELABS_API_KEY environment variable if not provided. |
analyze_model | str | pegasus1.5 | The Pegasus model used for analyze_video. |
embed_model | str | marengo3.0 | The Marengo model used for embed_text. |
max_tokens | int | 2048 | Maximum number of tokens for analyze_video responses. |
enable_analyze_video | bool | True | Enable the analyze_video functionality. |
enable_embed_text | bool | True | Enable the embed_text functionality. |
all | bool | False | Enable all functionality. |
Toolkit Functions
| Function | Description |
|---|---|
analyze_video | Analyze a video and answer a natural-language question about it using the Pegasus model. |
embed_text | Generate a multimodal (Marengo) embedding for a piece of text, which can be used to search a video corpus by text. |