Skip to content

Commit 259660f

Browse files
authored
Update customize-language-model-with-api.md
1 parent 00d0b58 commit 259660f

File tree

1 file changed

+192
-2
lines changed

1 file changed

+192
-2
lines changed

articles/media-services/video-indexer/customize-language-model-with-api.md

Lines changed: 192 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ You can use the Video Indexer APIs to create and edit custom Language models in
2323

2424
## Create a Language model
2525

26-
The [create a languate model](https://api-portal.videoindexer.ai/docs/services/Operations/operations/Create-Language-Model?) API creates a new custom Language model in the specified account. You can upload files for the Language model in this call. Alternatively, you can create the Language model here and upload files for the model later by updating the Language model.
26+
The [create a language model](https://api-portal.videoindexer.ai/docs/services/Operations/operations/Create-Language-Model?) API creates a new custom Language model in the specified account. You can upload files for the Language model in this call. Alternatively, you can create the Language model here and upload files for the model later by updating the Language model.
2727

2828
> [!NOTE]
2929
> You must still train the model with its enabled files for the model to learn the contents of its files. Directions on training a language are in the next section.
@@ -33,19 +33,85 @@ To upload files to be added to the Language model, you must upload files in the
3333
1. Key will be the file name and value will be the txt file
3434
2. Key will be the file name and value will be a URL to txt file
3535

36+
### Response
37+
38+
The response provides metadata on the newly created Language model along with metadata on each of the model's files following the format of the example JSON output.
39+
40+
```json
41+
{
42+
"id": "dfae5745-6f1d-4edd-b224-42e1ab57a891",
43+
"name": "TestModel",
44+
"language": "En-US",
45+
"state": "None",
46+
"languageModelId": "00000000-0000-0000-0000-000000000000",
47+
"files": [
48+
{
49+
"id": "25be7c0e-b6a6-4f48-b981-497e920a0bc9",
50+
"name": "hellofile",
51+
"enable": true,
52+
"creator": "John Doe",
53+
"creationTime": "2018-04-28T11:55:34.6733333"
54+
},
55+
{
56+
"id": "33025f5b-2354-485e-a50c-4e6b76345ca7",
57+
"name": "worldfile",
58+
"enable": true,
59+
"creator": "John Doe",
60+
"creationTime": "2018-04-28T11:55:34.86"
61+
}
62+
]
63+
}
64+
65+
```
66+
3667
## Train a Language model
3768

3869
The [train a language model](https://api-portal.videoindexer.ai/docs/services/operations/operations/Train-Language-Model?&pattern=train) API trains a custom Language model in the specified account with the contents in the files that were uploaded to and enabled in the language model.
3970

4071
> [!NOTE]
4172
> You must first create the Language model and upload its files. You can upload files either when creating the language model or by updating the Language model.
4273
43-
A response from the API, returns **id**. You should use the **id** value of the language model for the **linguisticModelId** parameter when [uploading a video to index](https://api-portal.videoindexer.ai/docs/services/operations/operations/Upload-video?) and for the **languageModelId** parameter when [reindexing a video](https://api-portal.videoindexer.ai/docs/services/operations/operations/Re-index-video?).
74+
### Response
75+
76+
The response provides metadata on the newly trained Language model along with metadata on each of the model's files following the format of the example JSON output.
77+
78+
```json
79+
{
80+
"id": "41464adf-e432-42b1-8e09-f52905d7e29d",
81+
"name": "TestModel",
82+
"language": "En-US",
83+
"state": "Waiting",
84+
"languageModelId": "531e5745-681d-4e1d-b124-12e5ab57a891",
85+
"files": [
86+
{
87+
"id": "84fcf1ac-1952-48f3-b372-18f768eedf83",
88+
"name": "RenamedFile",
89+
"enable": false,
90+
"creator": "John Doe",
91+
"creationTime": "2018-04-27T20:10:10.5233333"
92+
},
93+
{
94+
"id": "9ac35b4b-1381-49c4-9fe4-8234bfdd0f50",
95+
"name": "hellofile",
96+
"enable": true,
97+
"creator": "John Doe",
98+
"creationTime": "2018-04-27T20:10:10.68"
99+
}
100+
]
101+
}
102+
```
103+
104+
You should use the returned **id** value of the language model for the **linguisticModelId** parameter when [uploading a video to index](https://api-portal.videoindexer.ai/docs/services/operations/operations/Upload-video?) and for the **languageModelId** parameter when [reindexing a video](https://api-portal.videoindexer.ai/docs/services/operations/operations/Re-index-video?).
105+
44106

45107
## Delete a Language model
46108

47109
The [delete a language model](https://api-portal.videoindexer.ai/docs/services/operations/operations/Delete-Language-Model?&pattern=delete) API deletes a custom Language model from the specified account. Any video that was using the deleted Language model will keep the same index until you re-index the video. If you re-index the video, you can assign a new Language model to the video. Otherwise, Video Indexer will use its default model to re-index the video.
48110

111+
### Response
112+
113+
There is no returned content when the Language model is deleted successfully.
114+
49115
## Update a Language model
50116

51117
The [update a language model](https://api-portal.videoindexer.ai/docs/services/operations/operations/Update-Language-Model?&pattern=update) API updates a custom Language person model in the specified account.
@@ -58,32 +124,152 @@ To upload files to be added to the Language model, you must upload files in the
58124
1. Key will be the file name and value will be the txt file
59125
2. Key will be the file name and value will be a URL to txt file
60126

127+
128+
### Response
129+
130+
The response provides metadata on the newly trained Language model along with metadata on each of the model's files following the format of the example JSON output.
131+
132+
```json
133+
{
134+
"id": "41464adf-e432-42b1-8e09-f52905d7e29d",
135+
"name": "TestModel",
136+
"language": "En-US",
137+
"state": "Waiting",
138+
"languageModelId": "531e5745-681d-4e1d-b124-12e5ab57a891",
139+
"files": [
140+
{
141+
"id": "84fcf1ac-1952-48f3-b372-18f768eedf83",
142+
"name": "RenamedFile",
143+
"enable": true,
144+
"creator": "John Doe",
145+
"creationTime": "2018-04-27T20:10:10.5233333"
146+
},
147+
{
148+
"id": "9ac35b4b-1381-49c4-9fe4-8234bfdd0f50",
149+
"name": "hellofile",
150+
"enable": true,
151+
"creator": "John Doe",
152+
"creationTime": "2018-04-27T20:10:10.68"
153+
}
154+
]
155+
}
156+
```
157+
61158
Use the **id** of the files returned in the response to download the contents of the file.
62159

63160
## Update a file from a Language model
64161

65162
The [update a file](https://api-portal.videoindexer.ai/docs/services/operations/operations/Update-Language-Model-file?&pattern=update) allows you to update the name and **enable** state of a file in a custom Language model in the specified account.
66163

164+
### Response
165+
166+
The response provides metadata on the file that you updated following the format of the example JSON output below.
167+
168+
```json
169+
{
170+
"id": "84fcf1ac-1952-48f3-b372-18f768eedf83",
171+
"name": "RenamedFile",
172+
"enable": false,
173+
"creator": "John Doe",
174+
"creationTime": "2018-04-27T20:10:10.5233333"
175+
}
176+
```
67177
Use the **id** of the file returned in the response to download the contents of the file.
68178

69179
## Get a specific Language model
70180

71181
The [get](https://api-portal.videoindexer.ai/docs/services/operations/operations/Get-Language-Model?&pattern=get) API returns information on the specified Language model in the specified account such as language and the files that are in the Language model.
72182

183+
### Response
184+
185+
The response provides metadata on the specified Language model along with metadata on each of the model's files following the format of the example JSON output below.
186+
187+
```json
188+
{
189+
"id": "dfae5745-6f1d-4edd-b224-42e1ab57a891",
190+
"name": "TestModel",
191+
"language": "En-US",
192+
"state": "None",
193+
"languageModelId": "00000000-0000-0000-0000-000000000000",
194+
"files": [
195+
{
196+
"id": "25be7c0e-b6a6-4f48-b981-497e920a0bc9",
197+
"name": "hellofile",
198+
"enable": true,
199+
"creator": "John Doe",
200+
"creationTime": "2018-04-28T11:55:34.6733333"
201+
},
202+
{
203+
"id": "33025f5b-2354-485e-a50c-4e6b76345ca7",
204+
"name": "worldfile",
205+
"enable": true,
206+
"creator": "John Doe",
207+
"creationTime": "2018-04-28T11:55:34.86"
208+
}
209+
]
210+
}
211+
```
212+
73213
Use the **id** of the file returned in the response to download the contents of the file.
74214

75215
## Get all the Language models
76216

77217
The [get all](https://api-portal.videoindexer.ai/docs/services/operations/operations/Get-Language-Models?&pattern=get) API returns all of the custom Language models in the specified account in a list.
78218

219+
### Response
220+
221+
The response provides a list of all of the Language models in your account and each of their metadata and files following the format of the example JSON output below.
222+
223+
```json
224+
[
225+
{
226+
"id": "dfae5745-6f1d-4edd-b224-42e1ab57a891",
227+
"name": "TestModel",
228+
"language": "En-US",
229+
"state": "None",
230+
"languageModelId": "00000000-0000-0000-0000-000000000000",
231+
"files": [
232+
{
233+
"id": "25be7c0e-b6a6-4f48-b981-497e920a0bc9",
234+
"name": "hellofile",
235+
"enable": true,
236+
"creator": "John Doe",
237+
"creationTime": "2018-04-28T11:55:34.6733333"
238+
},
239+
{
240+
"id": "33025f5b-2354-485e-a50c-4e6b76345ca7",
241+
"name": "worldfile",
242+
"enable": true,
243+
"creator": "John Doe",
244+
"creationTime": "2018-04-28T11:55:34.86"
245+
}
246+
]
247+
},
248+
{
249+
"id": "dfae5745-6f1d-4edd-b224-42e1ab57a892",
250+
"name": "AnotherTestModel",
251+
"language": "En-US",
252+
"state": "None",
253+
"languageModelId": "00000000-0000-0000-0000-000000000001",
254+
"files": []
255+
}
256+
]
257+
```
258+
79259
## Delete a file from a Language model
80260

81261
The [delete](https://api-portal.videoindexer.ai/docs/services/operations/operations/Delete-Language-Model-File?&pattern=delete) API deletes the specified file from the specified Language model in the specified account.
82262

263+
### Response
264+
265+
There is no returned content when the file is deleted from the Language model successfully.
266+
83267
## Get metadata on a file from a Language model
84268

85269
The [get metadata of a file](https://api-portal.videoindexer.ai/docs/services/operations/operations/Get-Language-Model-File-Data?&pattern=get%20language%20model) API returns the contents of and metadata on the specified file from the chosen Language model in the your account.
86270

271+
### Response
272+
87273
The response provides the contents and metadata of the file in JSON format, similar to this:
88274

89275
```json
@@ -104,6 +290,10 @@ The response provides the contents and metadata of the file in JSON format, simi
104290

105291
The [download a file](https://api-portal.videoindexer.ai/docs/services/operations/operations/Download-Language-Model-File-Content?) API downloads a text file containing the contents of the specified file from the specified Language model in the specified account. This text file should match the contents of the text file that was originally uploaded.
106292

293+
### Response
294+
295+
The response will be the download of a text file with the contents of the file in the JSON format.
296+
107297
## Next steps
108298

109299
[Customize Language model using website](customize-language-model-with-website.md)

0 commit comments

Comments
 (0)