assemblyai 2.0.0-beta → 2.0.1-beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (79) hide show
  1. package/README.md +148 -48
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.esm.js +218 -123
  4. package/dist/index.js +225 -123
  5. package/dist/services/base.d.ts +0 -2
  6. package/dist/services/index.d.ts +7 -9
  7. package/dist/services/lemur/index.d.ts +6 -6
  8. package/dist/services/realtime/factory.d.ts +10 -0
  9. package/dist/services/realtime/index.d.ts +2 -16
  10. package/dist/services/realtime/service.d.ts +22 -0
  11. package/dist/services/transcripts/index.d.ts +37 -20
  12. package/dist/types/asyncapi.generated.d.ts +87 -0
  13. package/dist/types/index.d.ts +3 -4
  14. package/dist/types/openapi.generated.d.ts +685 -0
  15. package/dist/types/realtime/index.d.ts +30 -11
  16. package/dist/types/services/abstractions.d.ts +8 -36
  17. package/dist/types/services/index.d.ts +2 -5
  18. package/dist/types/transcripts/index.d.ts +5 -0
  19. package/dist/utils/axios.d.ts +3 -0
  20. package/dist/utils/errors/realtime.d.ts +1 -4
  21. package/package.json +8 -5
  22. package/src/index.ts +3 -0
  23. package/src/services/base.ts +1 -3
  24. package/src/services/files/index.ts +4 -4
  25. package/src/services/index.ts +18 -35
  26. package/src/services/lemur/index.ts +20 -16
  27. package/src/services/realtime/factory.ts +32 -0
  28. package/src/services/realtime/index.ts +2 -106
  29. package/src/services/realtime/service.ts +184 -0
  30. package/src/services/transcripts/index.ts +85 -63
  31. package/src/types/asyncapi.generated.ts +124 -0
  32. package/src/types/index.ts +3 -4
  33. package/src/types/openapi.generated.ts +834 -0
  34. package/src/types/realtime/index.ts +53 -13
  35. package/src/types/services/abstractions.ts +8 -40
  36. package/src/types/services/index.ts +2 -6
  37. package/src/types/transcripts/index.ts +5 -0
  38. package/src/utils/axios.ts +19 -0
  39. package/src/utils/errors/realtime.ts +5 -18
  40. package/dist/services/transcripts/redactions.d.ts +0 -14
  41. package/dist/services/transcripts/subtitles.d.ts +0 -12
  42. package/dist/types/core/index.d.ts +0 -2
  43. package/dist/types/core/params.d.ts +0 -2
  44. package/dist/types/core/segments.d.ts +0 -28
  45. package/dist/types/core/transcript.d.ts +0 -113
  46. package/dist/types/lemur/index.d.ts +0 -79
  47. package/dist/types/models/auto_chapter.d.ts +0 -8
  48. package/dist/types/models/auto_highlights.d.ts +0 -11
  49. package/dist/types/models/content_safety.d.ts +0 -25
  50. package/dist/types/models/entity_detection.d.ts +0 -7
  51. package/dist/types/models/index.d.ts +0 -8
  52. package/dist/types/models/pii.d.ts +0 -3
  53. package/dist/types/models/sentiment_analysis.d.ts +0 -9
  54. package/dist/types/models/shared.d.ts +0 -3
  55. package/dist/types/models/summarization.d.ts +0 -3
  56. package/dist/types/models/topic_detection.d.ts +0 -17
  57. package/dist/types/shared/index.d.ts +0 -2
  58. package/dist/types/shared/pagination.d.ts +0 -7
  59. package/dist/types/shared/timestamp.d.ts +0 -5
  60. package/src/services/transcripts/redactions.ts +0 -27
  61. package/src/services/transcripts/subtitles.ts +0 -26
  62. package/src/types/core/index.ts +0 -2
  63. package/src/types/core/params.ts +0 -3
  64. package/src/types/core/segments.ts +0 -29
  65. package/src/types/core/transcript.ts +0 -159
  66. package/src/types/lemur/index.ts +0 -97
  67. package/src/types/models/auto_chapter.ts +0 -9
  68. package/src/types/models/auto_highlights.ts +0 -14
  69. package/src/types/models/content_safety.ts +0 -34
  70. package/src/types/models/entity_detection.ts +0 -8
  71. package/src/types/models/index.ts +0 -8
  72. package/src/types/models/pii.ts +0 -32
  73. package/src/types/models/sentiment_analysis.ts +0 -11
  74. package/src/types/models/shared.ts +0 -4
  75. package/src/types/models/summarization.ts +0 -10
  76. package/src/types/models/topic_detection.ts +0 -21
  77. package/src/types/shared/index.ts +0 -2
  78. package/src/types/shared/pagination.ts +0 -8
  79. package/src/types/shared/timestamp.ts +0 -6
@@ -1,42 +1,59 @@
1
1
  import BaseService from "@/services/base";
2
- import TranscriptSubtitleService from "./subtitles";
3
- import { ParagraphsBody, SentencesBody, Transcript, TranscriptList, TranscriptParams, TranscriptPollingSettings, Createable, Deletable, Listable, Retrieveable } from "@/types";
4
- import TranscriptRedactionService from "./redactions";
2
+ import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, CreateTranscriptParameters, CreateTranscriptOptions, Createable, Deletable, Listable, Retrieveable, SubtitleFormat, RedactedAudioResponse } from "@/types";
5
3
  import { AxiosInstance } from "axios";
6
4
  import FileService from "../files";
7
- export default class TranscriptService extends BaseService implements Createable<Transcript, TranscriptParams, TranscriptPollingSettings>, Retrieveable<Transcript>, Deletable<Transcript>, Listable<TranscriptList> {
5
+ export default class TranscriptService extends BaseService implements Createable<Transcript, CreateTranscriptParameters, CreateTranscriptOptions>, Retrieveable<Transcript>, Deletable<Transcript>, Listable<TranscriptList> {
8
6
  private files;
7
+ constructor(client: AxiosInstance, files: FileService);
9
8
  /**
10
- * The subtitles service.
9
+ * Create a transcript.
10
+ * @param params The parameters to create a transcript.
11
+ * @param options The options used for creating the new transcript.
12
+ * @returns A promise that resolves to the newly created transcript.
11
13
  */
12
- subtitles: TranscriptSubtitleService;
14
+ create(params: CreateTranscriptParameters, options?: CreateTranscriptOptions): Promise<Transcript>;
15
+ private poll;
13
16
  /**
14
- * The redactions service.
17
+ * Retrieve a transcript.
18
+ * @param id The identifier of the transcript.
19
+ * @returns A promise that resolves to the transcript.
15
20
  */
16
- redactions: TranscriptRedactionService;
17
- constructor(client: AxiosInstance, files: FileService);
18
- create(params: TranscriptParams, settings?: TranscriptPollingSettings | null): Promise<Transcript>;
19
- private poll;
20
- retrieve(id: string): Promise<Transcript>;
21
- list(nextUrl?: string): Promise<TranscriptList>;
22
- delete(id: string): Promise<Transcript>;
21
+ get(id: string): Promise<Transcript>;
22
+ /**
23
+ * Retrieves a paged list of transcript listings.
24
+ * @param nextUrl The URL to retrieve the transcript list from. If not provided, the first page will be retrieved.
25
+ * @returns
26
+ */
27
+ list(nextUrl?: string | null): Promise<TranscriptList>;
23
28
  /**
24
- * Retrieve all segments of a transcript.
29
+ * Delete a transcript
25
30
  * @param id The identifier of the transcript.
26
- * @param type The type of segment to retrieve.
27
- * @return A promise that resolves to the retrieved resource.
31
+ * @returns A promise that resolves to the transcript.
28
32
  */
29
- private segments;
33
+ delete(id: string): Promise<Transcript>;
30
34
  /**
31
35
  * Retrieve all sentences of a transcript.
32
36
  * @param id The identifier of the transcript.
33
37
  * @return A promise that resolves to the sentences.
34
38
  */
35
- sentences(id: string): Promise<SentencesBody>;
39
+ sentences(id: string): Promise<SentencesResponse>;
36
40
  /**
37
41
  * Retrieve all paragraphs of a transcript.
38
42
  * @param id The identifier of the transcript.
39
43
  * @return A promise that resolves to the paragraphs.
40
44
  */
41
- paragraphs(id: string): Promise<ParagraphsBody>;
45
+ paragraphs(id: string): Promise<ParagraphsResponse>;
46
+ /**
47
+ * Retrieve subtitles of a transcript.
48
+ * @param id The identifier of the transcript.
49
+ * @param format The format of the subtitles.
50
+ * @return A promise that resolves to the subtitles text.
51
+ */
52
+ subtitles(id: string, format?: SubtitleFormat): Promise<string>;
53
+ /**
54
+ * Retrieve redactions of a transcript.
55
+ * @param id The identifier of the transcript.
56
+ * @return A promise that resolves to the subtitles text.
57
+ */
58
+ redactions(id: string): Promise<RedactedAudioResponse>;
42
59
  }
@@ -0,0 +1,87 @@
1
+ export type AudioData = {
2
+ /** @description Raw audio data, base64 encoded. This can be the raw data recorded directly from a microphone or read from an audio file. */
3
+ audio_data: string;
4
+ };
5
+ export type FinalTranscript = RealtimeBaseTranscript & {
6
+ /**
7
+ * @description Describes the type of message.
8
+ * @constant
9
+ */
10
+ message_type: "FinalTranscript";
11
+ /** @description Whether the text has been punctuated and cased. */
12
+ punctuated: boolean;
13
+ /** @description Whether the text has been formatted (e.g. Dollar -> $) */
14
+ text_formatted: boolean;
15
+ };
16
+ /** @enum {string} */
17
+ export type MessageType = "SessionBegins" | "PartialTranscript" | "FinalTranscript" | "SessionTerminated";
18
+ export type PartialTranscript = RealtimeBaseTranscript & {
19
+ /**
20
+ * @description Describes the type of message.
21
+ * @constant
22
+ */
23
+ message_type: "PartialTranscript";
24
+ };
25
+ export type RealtimeBaseMessage = {
26
+ /** @description Describes the type of the message. */
27
+ message_type: MessageType;
28
+ };
29
+ export type RealtimeBaseTranscript = {
30
+ /** @description End time of audio sample relative to session start, in milliseconds. */
31
+ audio_end: number;
32
+ /** @description Start time of audio sample relative to session start, in milliseconds. */
33
+ audio_start: number;
34
+ /**
35
+ * Format: double
36
+ * @description The confidence score of the entire transcription, between 0 and 1.
37
+ */
38
+ confidence: number;
39
+ /** @description The timestamp for the partial transcript. */
40
+ created: Date;
41
+ /** @description The partial transcript for your audio. */
42
+ text: string;
43
+ /** @description An array of objects, with the information for each word in the transcription text. Includes the start/end time (in milliseconds) of the word, the confidence score of the word, and the text (i.e. the word itself). */
44
+ words: Word[];
45
+ };
46
+ export type RealtimeError = {
47
+ error: string;
48
+ };
49
+ export type RealtimeMessage = SessionBegins | PartialTranscript | FinalTranscript | SessionTerminated | RealtimeError;
50
+ export type RealtimeTranscript = PartialTranscript | FinalTranscript;
51
+ /** @enum {string} */
52
+ export type RealtimeTranscriptType = "PartialTranscript" | "FinalTranscript";
53
+ export type SessionBegins = RealtimeBaseMessage & {
54
+ /** @description Timestamp when this session will expire. */
55
+ expires_at: Date;
56
+ /**
57
+ * @description Describes the type of the message.
58
+ * @constant
59
+ */
60
+ message_type: "SessionBegins";
61
+ /** @description Unique identifier for the established session. */
62
+ session_id: string;
63
+ };
64
+ export type SessionTerminated = RealtimeBaseMessage & {
65
+ /**
66
+ * @description Describes the type of the message.
67
+ * @constant
68
+ */
69
+ message_type: "SessionTerminated";
70
+ };
71
+ export type TerminateSession = RealtimeBaseMessage & {
72
+ /** @description A boolean value to communicate that you wish to end your real-time session forever. */
73
+ terminate_session: boolean;
74
+ };
75
+ export type Word = {
76
+ /**
77
+ * Format: double
78
+ * @description Confidence score of the word
79
+ */
80
+ confidence: number;
81
+ /** @description End time of the word in milliseconds */
82
+ end: number;
83
+ /** @description Start time of the word in milliseconds */
84
+ start: number;
85
+ /** @description The word itself */
86
+ text: string;
87
+ };
@@ -1,6 +1,5 @@
1
- export type * from "./core";
2
- export type * from "./lemur";
3
- export type * from "./models";
1
+ export type * from "./transcripts";
4
2
  export type * from "./realtime";
5
3
  export type * from "./services";
6
- export type * from "./shared";
4
+ export type * from "./asyncapi.generated";
5
+ export type * from "./openapi.generated";