Skip to content

Commit 4408af3

Browse files
Merge pull request #97 from apivideo/ai-summary-updates
Update Summary endpoints
2 parents 681296d + c6e2ac3 commit 4408af3

14 files changed

+194
-87
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Changelog
22
All changes to this project will be documented in this file.
33

4+
## [1.4.7] - 2024-11-06
5+
- AI summary updates
6+
47
## [1.4.6] - 2024-11-04
58
- Analytics updates (ccv, views, ...)
69

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ $ BASE_URI="" API_KEY="..." vendor/bin/phpunit
383383
```
384384

385385

386-
## Have you gotten use from this API client?
386+
## Have you gotten use from this API client?
387387

388388
Please take a moment to leave a star on the client ⭐
389389

docs/Api/SummariesApi.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Method | Description | HTTP request
1515

1616

1717

18-
Generate a title, abstract, and key takeaways for a video.
18+
Generate an abstract and key takeaways for a video.
1919

2020
### Arguments
2121

@@ -40,7 +40,7 @@ Name | Type | Description | Notes
4040

4141

4242

43-
Update details for a summary. Note that this operation is only allowed for summary objects where `sourceStatus` is `missing`.
43+
Update details for a summary.
4444

4545
### Arguments
4646

docs/Model/SummaryCreationPayload.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
77
**videoId** | **string** | Create a summary of a video using the video ID. |
88
**origin** | **string** | Use this parameter to define how the API generates the summary. The only allowed value is `auto`, which means that the API generates a summary automatically. If you do not set this parameter, **the API will not generate a summary automatically**. In this case, `sourceStatus` will return `missing`, and you have to manually add a summary using the `PATCH /summaries/{summaryId}/source` endpoint operation. | [optional]
9+
**attributes** | **string[]** | Use this parameter to define the elements of a summary that you want to generate. If you do not define this parameter, the API generates a full summary with all attributes. | [optional]
910

1011
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

docs/Model/SummarySource.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**title** | **string** | A video title, based on the contents of the video. | [optional]
87
**abstract** | **string** | A short outline of the contents of the video. The length of an `abstract` depends on the amount of content in a video that can be transcribed. The API condenses the contents into minimum 20, maximum 300 words. | [optional]
98
**takeaways** | **string[]** | A list of 3 key points from the video, in chronological order. | [optional]
109

docs/Model/SummaryUpdatePayload.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**title** | **string** | A video title, based on the contents of the video. | [optional]
87
**abstract** | **string** | A short outline of the contents of the video. | [optional]
98
**takeaways** | **string[]** | A list of 3 key points from the video, in chronological order. | [optional]
109

docs/Model/VideoCreationPayload.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@ Name | Type | Description | Notes
1818
**language** | **string** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional]
1919
**transcript** | **bool** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional]
2020
**transcriptSummary** | **bool** | Use this parameter to enable summarization. We recommend using this parameter together with `transcript: true`. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. | [optional]
21+
**transcriptSummaryAttributes** | **string[]** | Use this parameter to define the elements of a summary that you want to generate. If you do not define this parameter, the API generates a full summary with all attributes. | [optional]
2122

2223
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

docs/Model/VideoUpdatePayload.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ Name | Type | Description | Notes
1515
**language** | **string** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional]
1616
**transcript** | **bool** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional]
1717
**transcriptSummary** | **bool** | Use this parameter to enable summarization. - When `true`, the API generates a summary for the video, based on the transcription. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to summarize the video. If you do not define a language, the API detects it based on the video. | [optional]
18+
**transcriptSummaryAttributes** | **string[]** | Use this parameter to define the elements of a summary that you want to generate. If you do not define this parameter, the API generates a full summary with all attributes. | [optional]
1819

1920
[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md)

src/BaseClient.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function __construct(string $baseUri, ?string $apiKey, ClientInterface $h
7878
$this->originSdkHeaderValue = "";
7979

8080
if ($apiKey) {
81-
$this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.6');
81+
$this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.7');
8282
}
8383
}
8484

@@ -111,7 +111,7 @@ public function request(Request $commandRequest, bool $skipAuthRequest = false):
111111
if($this->originSdkHeaderValue) {
112112
$request = $request->withHeader('AV-Origin-Sdk', $this->originSdkHeaderValue);
113113
}
114-
$request = $request->withHeader('AV-Origin-Client', 'php:1.4.6');
114+
$request = $request->withHeader('AV-Origin-Client', 'php:1.4.7');
115115

116116
return $this->sendRequest($request, $skipAuthRequest);
117117
}

src/Model/SummaryCreationPayload.php

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,41 @@ public static function getDefinition(): ModelDefinition
3232
'summary-creation-payload',
3333
[
3434
'videoId' => 'string',
35-
'origin' => 'string'
35+
'origin' => 'string',
36+
'attributes' => 'string[]'
3637
],
3738
[
3839
'videoId' => null,
39-
'origin' => null
40+
'origin' => null,
41+
'attributes' => null
4042
],
4143
[
4244
'videoId' => 'videoId',
43-
'origin' => 'origin'
45+
'origin' => 'origin',
46+
'attributes' => 'attributes'
4447
],
4548
[
4649
'videoId' => 'setVideoId',
47-
'origin' => 'setOrigin'
50+
'origin' => 'setOrigin',
51+
'attributes' => 'setAttributes'
4852
],
4953
[
5054
'videoId' => 'getVideoId',
51-
'origin' => 'getOrigin'
55+
'origin' => 'getOrigin',
56+
'attributes' => 'getAttributes'
5257
],
5358
[
5459
'videoId' => null,
55-
'origin' => null
60+
'origin' => null,
61+
'attributes' => null
5662
],
5763
null
5864
);
5965
}
6066

6167
const ORIGIN_AUTO = 'auto';
68+
const ATTRIBUTES__ABSTRACT = 'abstract';
69+
const ATTRIBUTES_TAKEAWAYS = 'takeaways';
6270

6371
/**
6472
* Gets allowable values of the enum
@@ -72,6 +80,19 @@ public function getOriginAllowableValues()
7280
];
7381
}
7482

83+
/**
84+
* Gets allowable values of the enum
85+
*
86+
* @return string[]
87+
*/
88+
public function getAttributesAllowableValues()
89+
{
90+
return [
91+
self::ATTRIBUTES__ABSTRACT,
92+
self::ATTRIBUTES_TAKEAWAYS,
93+
];
94+
}
95+
7596
/**
7697
* Associative array for storing property values
7798
*
@@ -89,6 +110,7 @@ public function __construct(array $data = null)
89110
{
90111
$this->container['videoId'] = $data['videoId'] ?? null;
91112
$this->container['origin'] = $data['origin'] ?? null;
113+
$this->container['attributes'] = $data['attributes'] ?? null;
92114
}
93115

94116
/**
@@ -185,6 +207,39 @@ public function setOrigin($origin)
185207
return $this;
186208
}
187209

210+
/**
211+
* Gets attributes
212+
*
213+
* @return string[]|null
214+
*/
215+
public function getAttributes()
216+
{
217+
return $this->container['attributes'];
218+
}
219+
220+
/**
221+
* Sets attributes
222+
*
223+
* @param string[]|null $attributes Use this parameter to define the elements of a summary that you want to generate. If you do not define this parameter, the API generates a full summary with all attributes.
224+
*
225+
* @return self
226+
*/
227+
public function setAttributes($attributes)
228+
{
229+
$allowedValues = $this->getAttributesAllowableValues();
230+
if (!is_null($attributes) && array_diff($attributes, $allowedValues)) {
231+
throw new \InvalidArgumentException(
232+
sprintf(
233+
"Invalid value for 'attributes', must be one of '%s'",
234+
implode("', '", $allowedValues)
235+
)
236+
);
237+
}
238+
$this->container['attributes'] = $attributes;
239+
240+
return $this;
241+
}
242+
188243
/**
189244
* Serializes the object to a value that can be serialized natively by json_encode().
190245
* @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php

0 commit comments

Comments
 (0)