Get transcript summaries of Web videos.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

34 lines
796 B

  1. import { SummarizerEventEmitter } from './common';
  2. import {
  3. CreateYouTubeSummarizerParams,
  4. YouTubeSummarizerEventEmitter,
  5. } from './video-types/youtube';
  6. export enum VideoType {
  7. YOUTUBE = 'youtube',
  8. }
  9. export interface CreateSummarizerParams extends CreateYouTubeSummarizerParams {
  10. type: VideoType;
  11. }
  12. export const createSummarizer = (params: CreateSummarizerParams): SummarizerEventEmitter => {
  13. const {
  14. type: videoType,
  15. openAiParams,
  16. } = params;
  17. switch (videoType as string) {
  18. case VideoType.YOUTUBE:
  19. return new YouTubeSummarizerEventEmitter({
  20. openAiParams,
  21. });
  22. default:
  23. break;
  24. }
  25. throw new TypeError(`Invalid video type: "${videoType}". Valid values are: ${JSON.stringify(Object.values(VideoType))}`);
  26. };
  27. export * from './common';