Simple functions#
Simple functions are available for all API endpoints. You can use them by importing them from wordcab.
>>> from wordcab import get_stats
>>> stats = get_stats()
>>> stats
Stats(...)
They are simple wrappers around the client object. You can use the client object directly if you need more control.
get_stats#
- wordcab.get_stats(min_created=None, max_created=None, tags=None, api_key=None)#
Retrieve account stats such as spend and request volume, by timestamp or tag.
- Parameters:
min_created (str, optional) – 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.
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.
tags (list of str, optional) – A list of tags to filter by. The default is None. If None, no tags will be used to filter the stats.
api_key (str, optional) – 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.
- Returns:
The stats object containing the stats data.
- Return type:
start_summary#
- wordcab.start_summary(source_object, display_name, summary_type, context=None, ephemeral_data=False, only_api=True, pipelines=['transcribe', 'summarize'], source_lang=None, split_long_utterances=False, summary_lens=None, target_lang=None, tags=None, api_key=None)#
Start a summary job.
- Parameters:
source_object (BaseSource, InMemorySource or WordcabTranscriptSource) – The source object to summarize.
display_name (str) – The display name of the summary. This is useful for retrieving the job later.
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
context (str or list of str, optional) – The context elements to retrieve from the transcript. The default is None. Context elements you can retrieve are: issue, purpose, keywords, next_steps, and discussion_points. You can retrieve one or more of these elements.
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
only_api (bool) – Whether to only use the API to create the summary. The default is True.
pipelines (str or list of str) – The pipelines to use. The default is [“transcribe”, “summarize”].
source_lang (str, optional) – The language of the source. If None, the language will be en (English) by default.
split_long_utterances (bool) – Whether to split long utterances into multiple shorter utterances. The default is False.
summary_lens (int or list of int, optional) – 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.
target_lang (str, optional) – The language of the resulting summary. If None, the language will be en (English) by default.
tags (str or list of str, optional) – The tags to add to the job. The default is None. If None, no tags will be added.
api_key (str, optional) – 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.
- Returns:
The summarize job object.
- Return type:
start_extract#
- wordcab.start_extract(source_object, display_name, ephemeral_data=False, only_api=True, pipelines=['questions_answers', 'topic_segments', 'emotions', 'speaker_talk_ratios'], split_long_utterances=False, tags=None, api_key=None)#
Start an extraction job.
- Parameters:
source_object (BaseSource, InMemorySource or WordcabTranscriptSource) – The source object to use for the extraction job.
display_name (str) – The display name of the extraction job. This is useful for retrieving the job later.
ephemeral_data (bool, optional) – 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
only_api (bool, optional) – Whether to only use the API for the extraction job. The default is True.
pipelines (list of str, optional) – 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.
split_long_utterances (bool) – Whether to split long utterances into multiple shorter utterances. The default is False.
tags (str or list of str, optional) – The tags to add to the job. The default is None. If None, no tags will be added.
api_key (str, optional) – 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.
- Returns:
The extract job object.
- Return type:
list_jobs#
- wordcab.list_jobs(page_size=100, page_number=None, order_by='-time_started', api_key=None)#
Retrieve a list of jobs.
- Parameters:
page_size (int) – The number of jobs to retrieve per page. The default is 100.
page_number (int, optional) – The page number to retrieve. The default is None. If None, the first page will be retrieved.
order_by (str) – The order to retrieve the jobs in. The default is “-time_started”.
api_key (str, optional) – 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.
- Returns:
The list jobs object containing the list of jobs. The jobs can be SummarizeJob or ExtractJob objects.
- Return type:
list_summaries#
- wordcab.list_summaries(page_size=100, page_number=None, api_key=None)#
Retrieve a list of summaries.
- Parameters:
page_size (int) – The number of summaries to retrieve per page. The default is 100.
page_number (int, optional) – The page number to retrieve. The default is None. If None, the first page will be retrieved.
api_key (str, optional) – 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.
- Returns:
The list summaries object containing the list of summaries.
- Return type:
list_transcripts#
- wordcab.list_transcripts(page_size=100, page_number=None, api_key=None)#
Retrieve a list of transcripts.
- Parameters:
page_size (int) – The number of transcripts to retrieve per page. The default is 100.
page_number (int, optional) – The page number to retrieve. The default is None. If None, the first page will be retrieved.
api_key (str, optional) – 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.
- Returns:
The list transcripts object containing the list of transcripts.
- Return type:
retrieve_job#
- wordcab.retrieve_job(job_name, api_key=None)#
Retrieve a job by name.
- Parameters:
job_name (str) – The name of the job to retrieve.
api_key (str, optional) – 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.
- Returns:
The job object. The job can be an ExtractJob or SummarizeJob object.
- Return type:
retrieve_summary#
- wordcab.retrieve_summary(summary_id, api_key=None)#
Retrieve a summary by id.
- Parameters:
summary_id (str) – The id of the summary to retrieve.
api_key (str, optional) – 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.
- Returns:
The summary object.
- Return type:
retrieve_transcript#
- wordcab.retrieve_transcript(transcript_id, api_key=None)#
Retrieve a transcript by id.
- Parameters:
transcript_id (str) – The id of the transcript to retrieve.
api_key (str, optional) – 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.
- Returns:
The transcript object.
- Return type:
delete_job#
- wordcab.delete_job(job_name, warning=True, api_key=None)#
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:
job_name (str) – The name of the job to delete.
warning (bool) – Whether to show a warning before deleting the job. The default is True.
api_key (str, optional) – 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.
- Returns:
A dictionary containing the name of the deleted job.
- Return type:
Dict[str, str]
change_speaker_labels#
- wordcab.change_speaker_labels(transcript_id, speaker_map, api_key=None)#
Change speaker labels in a transcript.
- Parameters:
transcript_id (str) – The id of the transcript to change the speaker labels of.
speaker_map (Dict[str, str]) – A dictionary mapping the old speaker labels to the new speaker labels.
api_key (str, optional) – 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.
- Returns:
The transcript object with the changed speaker labels.
- Return type: