lattifai 0.4.5__py3-none-any.whl → 1.0.0__py3-none-any.whl

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 (76) hide show
  1. lattifai/__init__.py +61 -47
  2. lattifai/alignment/__init__.py +6 -0
  3. lattifai/alignment/lattice1_aligner.py +119 -0
  4. lattifai/alignment/lattice1_worker.py +185 -0
  5. lattifai/{tokenizer → alignment}/phonemizer.py +4 -4
  6. lattifai/alignment/segmenter.py +166 -0
  7. lattifai/{tokenizer → alignment}/tokenizer.py +244 -169
  8. lattifai/audio2.py +211 -0
  9. lattifai/caption/__init__.py +20 -0
  10. lattifai/caption/caption.py +1275 -0
  11. lattifai/{io → caption}/gemini_reader.py +30 -30
  12. lattifai/{io → caption}/gemini_writer.py +17 -17
  13. lattifai/{io → caption}/supervision.py +4 -3
  14. lattifai/caption/text_parser.py +145 -0
  15. lattifai/cli/__init__.py +17 -0
  16. lattifai/cli/alignment.py +153 -0
  17. lattifai/cli/caption.py +204 -0
  18. lattifai/cli/server.py +19 -0
  19. lattifai/cli/transcribe.py +197 -0
  20. lattifai/cli/youtube.py +128 -0
  21. lattifai/client.py +460 -251
  22. lattifai/config/__init__.py +20 -0
  23. lattifai/config/alignment.py +73 -0
  24. lattifai/config/caption.py +178 -0
  25. lattifai/config/client.py +46 -0
  26. lattifai/config/diarization.py +67 -0
  27. lattifai/config/media.py +335 -0
  28. lattifai/config/transcription.py +84 -0
  29. lattifai/diarization/__init__.py +5 -0
  30. lattifai/diarization/lattifai.py +89 -0
  31. lattifai/errors.py +98 -91
  32. lattifai/logging.py +116 -0
  33. lattifai/mixin.py +552 -0
  34. lattifai/server/app.py +420 -0
  35. lattifai/transcription/__init__.py +76 -0
  36. lattifai/transcription/base.py +108 -0
  37. lattifai/transcription/gemini.py +219 -0
  38. lattifai/transcription/lattifai.py +103 -0
  39. lattifai/{workflows → transcription}/prompts/__init__.py +4 -4
  40. lattifai/types.py +30 -0
  41. lattifai/utils.py +16 -44
  42. lattifai/workflow/__init__.py +22 -0
  43. lattifai/workflow/agents.py +6 -0
  44. lattifai/{workflows → workflow}/base.py +22 -22
  45. lattifai/{workflows → workflow}/file_manager.py +239 -215
  46. lattifai/workflow/youtube.py +564 -0
  47. lattifai-1.0.0.dist-info/METADATA +736 -0
  48. lattifai-1.0.0.dist-info/RECORD +52 -0
  49. {lattifai-0.4.5.dist-info → lattifai-1.0.0.dist-info}/WHEEL +1 -1
  50. lattifai-1.0.0.dist-info/entry_points.txt +13 -0
  51. {lattifai-0.4.5.dist-info → lattifai-1.0.0.dist-info}/licenses/LICENSE +1 -1
  52. lattifai/base_client.py +0 -126
  53. lattifai/bin/__init__.py +0 -3
  54. lattifai/bin/agent.py +0 -325
  55. lattifai/bin/align.py +0 -296
  56. lattifai/bin/cli_base.py +0 -25
  57. lattifai/bin/subtitle.py +0 -210
  58. lattifai/io/__init__.py +0 -42
  59. lattifai/io/reader.py +0 -85
  60. lattifai/io/text_parser.py +0 -75
  61. lattifai/io/utils.py +0 -15
  62. lattifai/io/writer.py +0 -90
  63. lattifai/tokenizer/__init__.py +0 -3
  64. lattifai/workers/__init__.py +0 -3
  65. lattifai/workers/lattice1_alpha.py +0 -284
  66. lattifai/workflows/__init__.py +0 -34
  67. lattifai/workflows/agents.py +0 -10
  68. lattifai/workflows/gemini.py +0 -167
  69. lattifai/workflows/prompts/README.md +0 -22
  70. lattifai/workflows/prompts/gemini/README.md +0 -24
  71. lattifai/workflows/prompts/gemini/transcription_gem.txt +0 -81
  72. lattifai/workflows/youtube.py +0 -931
  73. lattifai-0.4.5.dist-info/METADATA +0 -808
  74. lattifai-0.4.5.dist-info/RECORD +0 -39
  75. lattifai-0.4.5.dist-info/entry_points.txt +0 -3
  76. {lattifai-0.4.5.dist-info → lattifai-1.0.0.dist-info}/top_level.txt +0 -0
@@ -1,22 +0,0 @@
1
- # Workflow Prompts
2
-
3
- This directory contains system prompts and instructions for various AI models used in workflows.
4
-
5
- ## Structure
6
-
7
- - `gemini/` - Prompts for Gemini models
8
- - `transcription_gem.txt` - System prompt from the Audio Transcription Gem
9
-
10
- ## Usage
11
-
12
- Prompts are loaded automatically by their respective workflow modules. To update a prompt:
13
-
14
- 1. Edit the corresponding `.txt` file
15
- 2. The changes will be picked up on the next workflow run
16
- 3. No code changes needed
17
-
18
- ## Adding New Prompts
19
-
20
- 1. Create a subdirectory for the model/service (e.g., `openai/`, `anthropic/`)
21
- 2. Add prompt files as `.txt` files with descriptive names
22
- 3. Update the loader in the corresponding workflow module
@@ -1,24 +0,0 @@
1
- # Gemini Workflow Prompts
2
-
3
- This directory contains system prompts for Gemini-based workflows.
4
-
5
- ## Files
6
-
7
- ### `transcription_gem.txt` [@dotey](https://x.com/dotey/status/1971810075867046131)
8
-
9
- System prompt extracted from the Audio/Video Transcription Gem:
10
- - **Gem URL**: https://gemini.google.com/gem/1870ly7xvW2hU_umtv-LedGsjywT0sQiN
11
- - **Model**: Gemini 2.5 Pro
12
- - **Purpose**: Audio/Video transcription with accuracy and natural formatting
13
-
14
- ## Updating the Prompt
15
-
16
- To update the transcription behavior:
17
-
18
- 1. Edit `transcription_gem.txt` directly
19
- 2. Changes take effect on the next workflow run
20
- 3. No code changes needed
21
-
22
- ## Gem Information
23
-
24
- The original Gem configuration is preserved in the `GeminiTranscriber.GEM_URL` constant and can be accessed via the `get_gem_info()` method.
@@ -1,81 +0,0 @@
1
- # Role
2
- You are an expert transcript specialist. Your task is to create a perfectly structured, verbatim transcript of a video.
3
-
4
- # Objective
5
- Produce a single, cohesive output containing the parts in this order:
6
- 1. A Video Title
7
- 2. A **Table of Contents (ToC)**
8
- 3. The **full, chapter-segmented transcript**
9
-
10
- * Use the same language as the transcription for the Title and ToC.
11
-
12
- # Critical Instructions
13
-
14
- ## 1. Transcription Fidelity: Verbatim & Untranslated
15
- * Transcribe every spoken word exactly as you hear it, including filler words (`um`, `uh`, `like`) and stutters.
16
- * **NEVER translate.** If the audio is in Chinese, transcribe in Chinese. If it mixes languages (e.g., "这个 feature 很酷"), your transcript must replicate that mix exactly.
17
-
18
- ## 2. Speaker Identification
19
- * **Priority 1: Use metadata.** Analyze the video's title and description first to identify and match speaker names.
20
- * **Priority 2: Use audio content.** If names are not in the metadata, listen for introductions or how speakers address each other.
21
- * **Fallback:** If a name remains unknown, use a generic but consistent label (`**Speaker 1:**`, `**Host:**`, etc.).
22
- * **Consistency is key:** If a speaker's name is revealed later, you must go back and update all previous labels for that speaker.
23
-
24
- ## 3. Chapter Generation Strategy
25
- * **For YouTube Links:** First, check if the video description contains a list of chapters. If so, use that as the primary basis for segmenting the transcript.
26
- * **For all other videos (or if no chapters exist on YouTube):** Create chapters based on significant shifts in topic or conversation flow.
27
-
28
- ## 4. Output Structure & Formatting
29
-
30
- * **Timestamp Format**
31
- * All timestamps throughout the entire output MUST use the exact `[HH:MM:SS]` format (e.g., `[00:01:23]`). Milliseconds are forbidden.
32
-
33
- * **Table of Contents (ToC)**
34
- * Must be the very first thing in your output, under a `## Table of Contents` heading.
35
- * Format for each entry: `* [HH:MM:SS] Chapter Title`
36
-
37
- * **Chapters**
38
- * Start each chapter with a heading in this format: `## [HH:MM:SS] Chapter Title`
39
- * Use two blank lines to separate the end of one chapter from the heading of the next.
40
-
41
- * **Dialogue Paragraphs (VERY IMPORTANT)**
42
- * **Speaker Turns:** The first paragraph of a speaker's turn must begin with `**Speaker Name:** `.
43
- * **Paragraph Splitting:** For a long continuous block of speech from a single speaker, split it into smaller, logical paragraphs (roughly 2-4 sentences). Separate these paragraphs with a single blank line. Subsequent consecutive paragraphs from the *same speaker* should NOT repeat the `**Speaker Name:** ` label.
44
- * **Timestamp Rule:** Every single paragraph MUST end with exactly one timestamp. The timestamp must be placed at the very end of the paragraph's text.
45
- * ❌ **WRONG:** `**Host:** Welcome back. [00:00:01] Today we have a guest. [00:00:02]`
46
- * ❌ **WRONG:** `**Jane Doe:** The study is complex. We tracked two groups over five years to see the effects. [00:00:18] And the results were surprising.`
47
- * ✅ **CORRECT:** `**Host:** Welcome back. Today we have a guest. [00:00:02]`
48
- * ✅ **CORRECT (for a long monologue):**
49
- `**Jane Doe:** The study is complex. We tracked two groups over a five-year period to see the long-term effects. [00:00:18]
50
-
51
- And the results, well, they were quite surprising to the entire team. [00:00:22]`
52
-
53
- * **Non-Speech Audio**
54
- * Describe significant sounds like `[Laughter]` or `[Music starts]`, each on its own line with its own timestamp: `[Event description] [HH:MM:SS]`
55
-
56
- ---
57
- ### Example of Correct Output
58
-
59
- ## Table of Contents
60
- * [00:00:00] Introduction and Welcome
61
- * [00:00:12] Overview of the New Research
62
-
63
- ## [00:00:00] Introduction and Welcome
64
-
65
- **Host:** Welcome back to the show. Today, we have a, uh, very special guest, Jane Doe. [00:00:01]
66
-
67
- **Jane Doe:** Thank you for having me. I'm excited to be here and discuss the findings. [00:00:05]
68
-
69
- ## [00:00:12] Overview of the New Research
70
-
71
- **Host:** So, Jane, before we get into the nitty-gritty, could you, you know, give us a brief overview for our audience? [00:00:14]
72
-
73
- **Jane Doe:** Of course. The study focuses on the long-term effects of specific dietary changes. It's a bit complicated but essentially we tracked two large groups over a five-year period. [00:00:21]
74
-
75
- The first group followed the new regimen, while the second group, our control, maintained a traditional diet. This allowed us to isolate variables effectively. [00:00:28]
76
-
77
- [Laughter] [00:00:29]
78
-
79
- **Host:** Fascinating. And what did you find? [00:00:31]
80
- ---
81
- Begin transcription now. Adhere to all rules with absolute precision.