Simple functions
Simple functions are available for all API endpoints. You can use them by importing them from wordcab
.
They are simple wrappers around the client object. You can use the client object directly if you need more control.
get_stats
Retrieve account stats such as spend and request volume, by timestamp or tag.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
min_created |
str
|
The minimum limit of the specified time range. The default is None. If None, the minimum limit will be automatically set to a month prior. |
None
|
max_created |
str
|
The maximum limit of the specified time range. The default is None. If None, the maximum limit will be automatically set to the current time. |
None
|
tags |
list of str
|
A list of tags to filter by. The default is None. If None, no tags will be used to filter the stats. |
None
|
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
Stats
|
The stats object containing the stats data. |
Source code in src/wordcab/api.py
start_summary
Start a summary job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_object |
(BaseSource, InMemorySource or WordcabTranscriptSource)
|
The source object to summarize. |
required |
display_name |
str
|
The display name of the summary. This is useful for retrieving the job later. |
required |
summary_type |
str
|
The type of summary to create. You can choose from "conversational", "narrative", or "no_speaker". More information can be found here: https://docs.wordcab.com/docs/summary-types |
required |
context |
str or list of str
|
The context elements to retrieve from the transcript. The default is None.
Context elements you can retrieve are: |
None
|
ephemeral_data |
bool
|
Whether to delete the data after the summary is created. The default is False. If False, the data will be kept on Wordcab's servers. You can delete the data at any time, check the documentation here: https://docs.wordcab.com/docs/enabling-ephemeral-data |
False
|
only_api |
bool
|
Whether to only use the API to create the summary. The default is True. |
True
|
pipelines |
str or list of str
|
The pipelines to use. The default is ["transcribe", "summarize"]. |
['transcribe', 'summarize']
|
source_lang |
str
|
The language of the source. If None, the language will be |
None
|
split_long_utterances |
bool
|
Whether to split long utterances into multiple shorter utterances. The default is False. |
False
|
summary_lens |
int or list of int
|
The length of the summary. The default is None. The length should be between 1 and 5. If a list of ints is provided, the summary will be created for each length. |
None
|
target_lang |
str
|
The language of the resulting summary. If None, the language will be |
None
|
tags |
str or list of str
|
The tags to add to the job. The default is None. If None, no tags will be added. |
None
|
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
SummarizeJob
|
The summarize job object. |
Source code in src/wordcab/api.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
start_extract
Start an extraction job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_object |
(BaseSource, InMemorySource or WordcabTranscriptSource)
|
The source object to use for the extraction job. |
required |
display_name |
str
|
The display name of the extraction job. This is useful for retrieving the job later. |
required |
ephemeral_data |
bool
|
Whether to delete the data after the job is complete. The default is False. If False, the data will be kept on WordCab's servers. You can delete the data at any time, check the documentation here: https://docs.wordcab.com/docs/enabling-ephemeral-data |
False
|
only_api |
bool
|
Whether to only use the API for the extraction job. The default is True. |
True
|
pipelines |
list of str
|
A list of pipelines to use for the extraction job. The default is ["questions_answers", "topic_segments", "emotions", "speaker_talk_ratios"]. You can use one or more of the available pipelines. |
['questions_answers', 'topic_segments', 'emotions', 'speaker_talk_ratios']
|
split_long_utterances |
bool
|
Whether to split long utterances into multiple shorter utterances. The default is False. |
False
|
tags |
str or list of str
|
The tags to add to the job. The default is None. If None, no tags will be added. |
None
|
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
ExtractJob
|
The extract job object. |
Source code in src/wordcab/api.py
list_jobs
Retrieve a list of jobs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size |
int
|
The number of jobs to retrieve per page. The default is 100. |
100
|
page_number |
int
|
The page number to retrieve. The default is None. If None, the first page will be retrieved. |
None
|
order_by |
str
|
The order to retrieve the jobs in. The default is "-time_started". |
'-time_started'
|
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
ListJobs
|
The list jobs object containing the list of jobs. The jobs can be SummarizeJob or ExtractJob objects. |
Source code in src/wordcab/api.py
list_summaries
Retrieve a list of summaries.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size |
int
|
The number of summaries to retrieve per page. The default is 100. |
100
|
page_number |
int
|
The page number to retrieve. The default is None. If None, the first page will be retrieved. |
None
|
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
ListSummaries
|
The list summaries object containing the list of summaries. |
Source code in src/wordcab/api.py
list_transcripts
Retrieve a list of transcripts.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size |
int
|
The number of transcripts to retrieve per page. The default is 100. |
100
|
page_number |
int
|
The page number to retrieve. The default is None. If None, the first page will be retrieved. |
None
|
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
ListTranscripts
|
The list transcripts object containing the list of transcripts. |
Source code in src/wordcab/api.py
retrieve_job
Retrieve a job by name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_name |
str
|
The name of the job to retrieve. |
required |
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
ExtractJob or SummarizeJob
|
The job object. The job can be an ExtractJob or SummarizeJob object. |
Source code in src/wordcab/api.py
retrieve_summary
Retrieve a summary by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
summary_id |
str
|
The id of the summary to retrieve. |
required |
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
BaseSummary
|
The summary object. |
Source code in src/wordcab/api.py
retrieve_transcript
Retrieve a transcript by id.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transcript_id |
str
|
The id of the transcript to retrieve. |
required |
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
BaseTranscript
|
The transcript object. |
Source code in src/wordcab/api.py
delete_job
Delete a job by name and all associated data (including the transcript).
Note that this will delete the transcript from WordCab's servers. If you want to keep the transcript, you should download it before deleting the job.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
job_name |
str
|
The name of the job to delete. |
required |
warning |
bool
|
Whether to show a warning before deleting the job. The default is True. |
True
|
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
Dict[str, str]
|
A dictionary containing the name of the deleted job. |
Source code in src/wordcab/api.py
change_speaker_labels
Change speaker labels in a transcript.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
transcript_id |
str
|
The id of the transcript to change the speaker labels of. |
required |
speaker_map |
Dict[str, str]
|
A dictionary mapping the old speaker labels to the new speaker labels. |
required |
api_key |
str
|
The API key to use. The default is None. If None, the API key will be automatically retrieved from the environment variable WORDCAB_API_KEY. |
None
|
Returns:
Type | Description |
---|---|
BaseTranscript
|
The transcript object with the changed speaker labels. |
Source code in src/wordcab/api.py
Created: 2023-09-25