From cba319ab9e1eb5f8a82c9a074240823e15ef7d7f Mon Sep 17 00:00:00 2001 From: Anthony Campolo <12433465+ajcwebdev@users.noreply.github.com> Date: Tue, 1 Oct 2024 18:03:31 -0500 Subject: [PATCH] create remaining server curl examples --- docs/examples.md | 59 ++++---- docs/server.md | 370 +++++++++++++++++++++++++++++++++++++---------- 2 files changed, 325 insertions(+), 104 deletions(-) diff --git a/docs/examples.md b/docs/examples.md index 6da8a57..b02c500 100644 --- a/docs/examples.md +++ b/docs/examples.md @@ -17,11 +17,12 @@ - [OctoAI's Models](#octoais-models) - [Llama.cpp](#llamacpp) - [Transcription Options](#transcription-options) + - [Whisper.cpp](#whispercpp) - [Deepgram](#deepgram) - [Assembly](#assembly) - - [Whisper.cpp](#whispercpp) -- [Docker Compose](#docker-compose) -- [Alternative JavaScript Runtimes](#alternative-javascript-runtimes) +- [Prompt Options](#prompt-options) +- [Alternative Runtimes](#alternative-runtimes) + - [Docker Compose](#docker-compose) - [Deno](#deno) - [Bun](#bun) - [Makeshift Test Suite](#makeshift-test-suite) @@ -232,26 +233,6 @@ npm run as -- --video "https://www.youtube.com/watch?v=MORMZXEaONk" --llama ## Transcription Options -Create a `.env` file and set API key as demonstrated in `.env.example` for `DEEPGRAM_API_KEY` or `ASSEMBLY_API_KEY`. - -### Deepgram - -```bash -npm run as -- --video "https://www.youtube.com/watch?v=MORMZXEaONk" --deepgram -``` - -### Assembly - -```bash -npm run as -- --video "https://www.youtube.com/watch?v=MORMZXEaONk" --assembly -``` - -Include speaker labels and number of speakers: - -```bash -npm run as -- --video "https://ajc.pics/audio/fsjam-short.mp3" --assembly --speakerLabels -``` - ### Whisper.cpp If neither the `--deepgram` or `--assembly` option is included for transcription, `autoshow` will default to running the largest Whisper.cpp model. To configure the size of the Whisper model, use the `--model` option and select one of the following: @@ -279,15 +260,27 @@ Run `whisper.cpp` in a Docker container with `--whisperDocker`: npm run as -- --video "https://www.youtube.com/watch?v=MORMZXEaONk" --whisperDocker base ``` -## Docker Compose +### Deepgram -This will run both `whisper.cpp` and the AutoShow Commander CLI in their own Docker containers. +Create a `.env` file and set API key as demonstrated in `.env.example` for `DEEPGRAM_API_KEY`. ```bash -docker-compose run autoshow --video "https://www.youtube.com/watch?v=MORMZXEaONk" --whisperDocker base +npm run as -- --video "https://www.youtube.com/watch?v=MORMZXEaONk" --deepgram ``` -Currently working on the `llama.cpp` Docker integration so the entire project can be encapsulated in one local Docker Compose file. +### Assembly + +Create a `.env` file and set API key as demonstrated in `.env.example` for `ASSEMBLY_API_KEY`. + +```bash +npm run as -- --video "https://www.youtube.com/watch?v=MORMZXEaONk" --assembly +``` + +Include speaker labels and number of speakers: + +```bash +npm run as -- --video "https://ajc.pics/audio/fsjam-short.mp3" --assembly --speakerLabels +``` ## Prompt Options @@ -345,7 +338,17 @@ Include all prompt options: npm run as -- --video "https://www.youtube.com/watch?v=MORMZXEaONk" --prompt titles summary longChapters takeaways questions ``` -## Alternative JavaScript Runtimes +## Alternative Runtimes + +### Docker Compose + +This will run both `whisper.cpp` and the AutoShow Commander CLI in their own Docker containers. + +```bash +docker-compose run autoshow --video "https://www.youtube.com/watch?v=MORMZXEaONk" --whisperDocker base +``` + +Currently working on the `llama.cpp` Docker integration so the entire project can be encapsulated in one local Docker Compose file. ### Bun diff --git a/docs/server.md b/docs/server.md index 574f92e..01aa36a 100644 --- a/docs/server.md +++ b/docs/server.md @@ -3,7 +3,7 @@ This is currently a very simple proof-of-concept that only implements the most basic Autoshow command for [processing a single video file from a YouTube URL](/docs/examples.md#process-single-video-or-audio-file): ```bash -npm run autoshow -- --video "https://www.youtube.com/watch?v=jKB0EltG9Jo" +npm run autoshow -- --video "https://www.youtube.com/watch?v=MORMZXEaONk" ``` See the [server section of the roadmap](/docs/readmap.md#server) for more information about future development on the server implementation. @@ -25,119 +25,337 @@ Version 20 enters its maintenance period in October 2024 and end-of-life in Apri -## Video Endpoint +## Process Endpoints + +### Video Endpoint Once the server is running, send a `POST` request to `http://localhost:3000/video` containing a JSON object with the YouTube URL: ```bash -curl -X POST http://localhost:3000/video \ - -H "Content-Type: application/json" \ - -d '{ - "youtubeUrl": "https://www.youtube.com/watch?v=jKB0EltG9Jo" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk" +}' http://localhost:3000/video ``` -Configure `model`. + + +Use LLM. ```bash -curl -X POST http://localhost:3000/video \ - -H "Content-Type: application/json" \ - -d '{ - "youtubeUrl": "https://www.youtube.com/watch?v=jKB0EltG9Jo", - "whisperModel": "tiny" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/video ``` -Use LLM. +### Playlist Endpoint + +```bash +curl --json '{ + "playlistUrl": "https://www.youtube.com/playlist?list=PLCVnrVv4KhXPz0SoAVu8Rc1emAdGPbSbr" +}' http://localhost:3000/playlist +``` + +```bash +curl --json '{ + "playlistUrl": "https://www.youtube.com/playlist?list=PLCVnrVv4KhXPz0SoAVu8Rc1emAdGPbSbr", + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/playlist +``` + +### URLs Endpoint + +```bash +curl --json '{ + "filePath": "content/example-urls.md" +}' http://localhost:3000/urls +``` + +```bash +curl --json '{ + "filePath": "content/example-urls.md", + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/urls +``` + +```bash +curl --json '{ + "filePath": "content/example-urls.md", + "prompts": ["titles", "mediumChapters"], + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/urls +``` + +### File Endpoint + +```bash +curl --json '{ + "filePath": "content/audio.mp3" +}' http://localhost:3000/file +``` + +```bash +curl --json '{ + "filePath": "content/audio.mp3", + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/file +``` + +```bash +curl --json '{ + "filePath": "content/audio.mp3", + "prompts": ["titles"], + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/file +``` + +### RSS Endpoint + +```bash +curl --json '{ + "rssUrl": "https://feeds.transistor.fm/fsjam-podcast/" +}' http://localhost:3000/rss +``` + +```bash +curl --json '{ + "rssUrl": "https://feeds.transistor.fm/fsjam-podcast/", + "whisperModel": "tiny", + "llm": "llama", + "order": "newest", + "skip": 0 +}' http://localhost:3000/rss +``` + +```bash +curl --json '{ + "rssUrl": "https://feeds.transistor.fm/fsjam-podcast/", + "order": "newest", + "skip": 94, + "whisperModel": "tiny" +}' http://localhost:3000/rss +``` + +```bash +curl --json '{ + "rssUrl": "https://feeds.transistor.fm/fsjam-podcast/", + "order": "oldest", + "skip": 94, + "whisperModel": "tiny" +}' http://localhost:3000/rss +``` + +## Language Model (LLM) Options + +### ChatGPT + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "chatgpt" +}' http://localhost:3000/video +``` ```bash -curl -X POST http://localhost:3000/video \ - -H "Content-Type: application/json" \ - -d '{ - "youtubeUrl": "https://www.youtube.com/watch?v=jKB0EltG9Jo", - "whisperModel": "tiny", - "llm": "llama" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "chatgpt", + "llmModel": "GPT_4o_MINI" +}' http://localhost:3000/video ``` -## Playlist Endpoint +### Claude ```bash -curl -X POST http://localhost:3000/playlist \ - -H "Content-Type: application/json" \ - -d '{ - "playlistUrl": "https://www.youtube.com/playlist?list=PLCVnrVv4KhXMh4DQBigyvHSRTf2CSj129" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "claude" +}' http://localhost:3000/video ``` ```bash -curl -X POST http://localhost:3000/playlist \ - -H "Content-Type: application/json" \ - -d '{ - "playlistUrl": "https://www.youtube.com/playlist?list=PLCVnrVv4KhXMh4DQBigyvHSRTf2CSj129", - "whisperModel": "tiny", - "llm": "llama" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "claude", + "llmModel": "CLAUDE_3_SONNET" +}' http://localhost:3000/video ``` -## URLs Endpoint +### Gemini ```bash -curl -X POST http://localhost:3000/urls \ - -H "Content-Type: application/json" \ - -d '{ - "filePath": "content/urls.md" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "gemini" +}' http://localhost:3000/video ``` ```bash -curl -X POST http://localhost:3000/urls \ - -H "Content-Type: application/json" \ - -d '{ - "filePath": "content/urls.md", - "whisperModel": "tiny", - "llm": "llama" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "gemini", + "llmModel": "GEMINI_1_5_FLASH" +}' http://localhost:3000/video ``` -## File Endpoint +### Cohere ```bash -curl -X POST http://localhost:3000/file \ - -H "Content-Type: application/json" \ - -d '{ - "filePath": "content/audio.mp3" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "cohere" +}' http://localhost:3000/video ``` ```bash -curl -X POST http://localhost:3000/file \ - -H "Content-Type: application/json" \ - -d '{ - "filePath": "content/audio.mp3", - "whisperModel": "tiny", - "llm": "llama" - }' +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "cohere", + "llmModel": "COMMAND_R_PLUS" +}' http://localhost:3000/video ``` -## RSS Endpoint +### Mistral + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "mistral" +}' http://localhost:3000/video +``` + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "mistral", + "llmModel": "MIXTRAL_8x7b" +}' http://localhost:3000/video +``` + +### Octo + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "octo" +}' http://localhost:3000/video +``` + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "llm": "octo", + "llmModel": "LLAMA_3_1_8B" +}' http://localhost:3000/video +``` + +## Transcription Options + +### Whisper.cpp + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "whisperModel": "tiny" +}' http://localhost:3000/video +``` + +### Deepgram + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "transcriptionService": "deepgram" +}' http://localhost:3000/video +``` + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "transcriptionService": "deepgram", + "llm": "llama" +}' http://localhost:3000/video +``` + +### Assembly + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "transcriptionService": "assembly" +}' http://localhost:3000/video +``` + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "transcriptionService": "assembly", + "llm": "llama" +}' http://localhost:3000/video +``` + +```bash +curl --json '{ + "youtubeUrl": "https://ajc.pics/audio/fsjam-short.mp3", + "transcriptionService": "assembly", + "speakerLabels": true +}' http://localhost:3000/video +``` + +```bash +curl --json '{ + "youtubeUrl": "https://ajc.pics/audio/fsjam-short.mp3", + "transcriptionService": "assembly", + "speakerLabels": true, + "llm": "llama" +}' http://localhost:3000/video +``` + +## Prompt Options + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "prompts": ["titles", "mediumChapters"] +}' http://localhost:3000/video +``` + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "prompts": ["titles", "summary", "shortChapters", "takeaways", "questions"] +}' http://localhost:3000/video +``` + +```bash +curl --json '{ + "youtubeUrl": "https://www.youtube.com/watch?v=MORMZXEaONk", + "prompts": ["titles", "summary", "shortChapters", "takeaways", "questions"], + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/video +``` ```bash -curl -X POST http://localhost:3000/rss \ - -H "Content-Type: application/json" \ - -d '{ - "rssUrl": "https://feeds.transistor.fm/fsjam-podcast/" - }' +curl --json '{ + "playlistUrl": "https://www.youtube.com/playlist?list=PLCVnrVv4KhXPz0SoAVu8Rc1emAdGPbSbr", + "prompts": ["titles", "mediumChapters"], + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/playlist ``` ```bash -curl -X POST http://localhost:3000/rss \ - -H "Content-Type: application/json" \ - -d '{ - "rssUrl": "https://feeds.transistor.fm/fsjam-podcast/", - "whisperModel": "tiny", - "llm": "llama", - "order": "newest", - "skip": 0 - }' +curl --json '{ + "playlistUrl": "https://www.youtube.com/playlist?list=PLCVnrVv4KhXPz0SoAVu8Rc1emAdGPbSbr", + "prompts": ["titles", "mediumChapters"], + "whisperModel": "tiny", + "llm": "llama" +}' http://localhost:3000/playlist ``` \ No newline at end of file