Answer engine
Synthesize answers from videos in the index
Setup
Create an API key
First create an API key using the instructions in API keys
Create an index
Next, create an index. For this tutorial, we will use an index with the name ‘test_index’
Add some videos
Next, add some videos to the index. Now we are ready to get started with getting answers!
Answer a question
Answer modes
Specific videos
Instead of using all the videos in the index, you can also specify the video_ids variable to limit the videos used in synthesizing the answer.
Retrieval Augmented Generation (RAG)
AskVideos also supports RAG to synthesize answers from the video.
Using embeddings to find the relevant parts of the video before generating tokens helps to reduce cost and provide more accurate answers. In addition, if the text in the index exceeds the input token limit, RAG can help overcome this limitation by selecting only the most relevant parts for the context.
In order to specify RAG mode, simply update the mode variable as follows.
If you need to limit the videos to perform RAG over, you can also specify the video_ids variable as follows.
System prompt
The system prompt is customizable and can unlock powerful capabilities in the answer engine. Here are some examples of useful system prompts.
In order to utilize a custom system prompt with the query, do the following:
Next steps
In addition to answering questions, the AskVideos API can also find specific moments in the videos.