Shows how to generate text from video content using open-ended analysis.
This example assumes using TwelveLabs; is in scope and apiKey contains your TwelveLabs API key.
1 2 3 4 5 6 7 8 910111213141516171819202122232425
usingvarclient=newTwelveLabsClient(apiKey);// Retrieve an indexed video to analyze.varindexes=awaitclient.SubpackageIndexes.ListAsync(xApiKey:apiKey);varindexId=indexes.Data?.FirstOrDefault()?.Id??thrownewAssertInconclusiveException("No indexes found. Create an index and upload videos first.");varassets=awaitclient.SubpackageIndexesSubpackageIndexesIndexedAssets.ListAsync(indexId:indexId,xApiKey:apiKey);varvideoId=assets.Data?.FirstOrDefault()?.Id??thrownewAssertInconclusiveException("No indexed assets found in the index.");// Generate a summary of the video using open-ended analysis with streaming disabled.varresponse=awaitclient.AnalyzeAsync(xApiKey:apiKey,videoId:videoId,prompt:"Provide a brief summary of this video, including the main topic and key points.",stream:false);// The non-streaming response contains the generated text and token usage.varresult=response.NonStreamAnalyzeResponse;Console.WriteLine($"Generated text: {result!.Data}");Console.WriteLine($"Finish reason: {result.FinishReason}");