@steipete/summarize 0.2.0 → 0.3.0
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.
- package/CHANGELOG.md +24 -1
- package/README.md +34 -6
- package/dist/cli.cjs +4941 -790
- package/dist/cli.cjs.map +4 -4
- package/dist/esm/content/link-preview/client.js +6 -0
- package/dist/esm/content/link-preview/client.js.map +1 -1
- package/dist/esm/content/link-preview/transcript/index.js +6 -0
- package/dist/esm/content/link-preview/transcript/index.js.map +1 -1
- package/dist/esm/content/link-preview/transcript/providers/youtube/yt-dlp.js +213 -0
- package/dist/esm/content/link-preview/transcript/providers/youtube/yt-dlp.js.map +1 -0
- package/dist/esm/content/link-preview/transcript/providers/youtube.js +40 -2
- package/dist/esm/content/link-preview/transcript/providers/youtube.js.map +1 -1
- package/dist/esm/flags.js +2 -0
- package/dist/esm/flags.js.map +1 -1
- package/dist/esm/llm/generate-text.js +51 -14
- package/dist/esm/llm/generate-text.js.map +1 -1
- package/dist/esm/llm/html-to-markdown.js +3 -2
- package/dist/esm/llm/html-to-markdown.js.map +1 -1
- package/dist/esm/run.js +40 -9
- package/dist/esm/run.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/types/content/link-preview/client.d.ts +3 -0
- package/dist/types/content/link-preview/content/types.d.ts +1 -1
- package/dist/types/content/link-preview/deps.d.ts +3 -0
- package/dist/types/content/link-preview/transcript/providers/youtube/yt-dlp.d.ts +15 -0
- package/dist/types/content/link-preview/transcript/types.d.ts +4 -0
- package/dist/types/flags.d.ts +1 -1
- package/dist/types/llm/generate-text.d.ts +8 -2
- package/dist/types/llm/html-to-markdown.d.ts +4 -1
- package/dist/types/version.d.ts +1 -1
- package/docs/youtube.md +5 -2
- package/package.json +5 -1
|
@@ -4,13 +4,17 @@ export type LlmApiKeys = {
|
|
|
4
4
|
openaiApiKey: string | null;
|
|
5
5
|
googleApiKey: string | null;
|
|
6
6
|
anthropicApiKey: string | null;
|
|
7
|
+
openrouterApiKey: string | null;
|
|
8
|
+
};
|
|
9
|
+
export type OpenRouterOptions = {
|
|
10
|
+
providers: string[] | null;
|
|
7
11
|
};
|
|
8
12
|
export type LlmTokenUsage = {
|
|
9
13
|
promptTokens: number | null;
|
|
10
14
|
completionTokens: number | null;
|
|
11
15
|
totalTokens: number | null;
|
|
12
16
|
};
|
|
13
|
-
export declare function generateTextWithModelId({ modelId, apiKeys, system, prompt, temperature, maxOutputTokens, timeoutMs, fetchImpl, }: {
|
|
17
|
+
export declare function generateTextWithModelId({ modelId, apiKeys, system, prompt, temperature, maxOutputTokens, timeoutMs, fetchImpl, openrouter, }: {
|
|
14
18
|
modelId: string;
|
|
15
19
|
apiKeys: LlmApiKeys;
|
|
16
20
|
system?: string;
|
|
@@ -19,13 +23,14 @@ export declare function generateTextWithModelId({ modelId, apiKeys, system, prom
|
|
|
19
23
|
maxOutputTokens?: number;
|
|
20
24
|
timeoutMs: number;
|
|
21
25
|
fetchImpl: typeof fetch;
|
|
26
|
+
openrouter?: OpenRouterOptions;
|
|
22
27
|
}): Promise<{
|
|
23
28
|
text: string;
|
|
24
29
|
canonicalModelId: string;
|
|
25
30
|
provider: 'xai' | 'openai' | 'google' | 'anthropic';
|
|
26
31
|
usage: LlmTokenUsage | null;
|
|
27
32
|
}>;
|
|
28
|
-
export declare function streamTextWithModelId({ modelId, apiKeys, system, prompt, temperature, maxOutputTokens, timeoutMs, fetchImpl, }: {
|
|
33
|
+
export declare function streamTextWithModelId({ modelId, apiKeys, system, prompt, temperature, maxOutputTokens, timeoutMs, fetchImpl, openrouter, }: {
|
|
29
34
|
modelId: string;
|
|
30
35
|
apiKeys: LlmApiKeys;
|
|
31
36
|
system?: string;
|
|
@@ -34,6 +39,7 @@ export declare function streamTextWithModelId({ modelId, apiKeys, system, prompt
|
|
|
34
39
|
maxOutputTokens?: number;
|
|
35
40
|
timeoutMs: number;
|
|
36
41
|
fetchImpl: typeof fetch;
|
|
42
|
+
openrouter?: OpenRouterOptions;
|
|
37
43
|
}): Promise<{
|
|
38
44
|
textStream: AsyncIterable<string>;
|
|
39
45
|
canonicalModelId: string;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import type { ConvertHtmlToMarkdown } from '../content/link-preview/deps.js';
|
|
2
2
|
import type { LlmTokenUsage } from './generate-text.js';
|
|
3
|
-
|
|
3
|
+
import { type OpenRouterOptions } from './generate-text.js';
|
|
4
|
+
export declare function createHtmlToMarkdownConverter({ modelId, xaiApiKey, googleApiKey, openaiApiKey, anthropicApiKey, openrouterApiKey, openrouter, fetchImpl, onUsage, }: {
|
|
4
5
|
modelId: string;
|
|
5
6
|
xaiApiKey: string | null;
|
|
6
7
|
googleApiKey: string | null;
|
|
7
8
|
openaiApiKey: string | null;
|
|
8
9
|
fetchImpl: typeof fetch;
|
|
9
10
|
anthropicApiKey: string | null;
|
|
11
|
+
openrouterApiKey: string | null;
|
|
12
|
+
openrouter?: OpenRouterOptions;
|
|
10
13
|
onUsage?: (usage: {
|
|
11
14
|
model: string;
|
|
12
15
|
provider: 'xai' | 'openai' | 'google' | 'anthropic';
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const FALLBACK_VERSION = "0.
|
|
1
|
+
export declare const FALLBACK_VERSION = "0.3.0";
|
|
2
2
|
export declare function resolvePackageVersion(importMetaUrl?: string): string;
|
package/docs/youtube.md
CHANGED
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
YouTube URLs use transcript-first extraction.
|
|
4
4
|
|
|
5
|
-
## `--youtube auto|web|apify`
|
|
5
|
+
## `--youtube auto|web|apify|yt-dlp`
|
|
6
6
|
|
|
7
|
-
- `auto` (default): try `youtubei` → `captionTracks` → Apify (if token exists)
|
|
7
|
+
- `auto` (default): try `youtubei` → `captionTracks` → Apify (if token exists) → `yt-dlp` (if configured)
|
|
8
8
|
- `web`: try `youtubei` → `captionTracks` only
|
|
9
9
|
- `apify`: Apify only
|
|
10
|
+
- `yt-dlp`: download audio + transcribe (OpenAI Whisper preferred; FAL fallback)
|
|
10
11
|
|
|
11
12
|
## `youtubei` vs `captionTracks`
|
|
12
13
|
|
|
@@ -24,6 +25,8 @@ YouTube URLs use transcript-first extraction.
|
|
|
24
25
|
- If no transcript is available, we still extract `ytInitialPlayerResponse.videoDetails.shortDescription` so YouTube links can still summarize meaningfully.
|
|
25
26
|
- Apify is an optional fallback (needs `APIFY_API_TOKEN`).
|
|
26
27
|
- By default, we use the actor id `faVsWy9VTSNVIhWpR` (Pinto Studio’s “Youtube Transcript Scraper”).
|
|
28
|
+
- `yt-dlp` requires `YT_DLP_PATH` and either `OPENAI_API_KEY` (preferred) or `FAL_KEY`.
|
|
29
|
+
- If OpenAI transcription fails and `FAL_KEY` is set, we fall back to FAL automatically.
|
|
27
30
|
|
|
28
31
|
## Example
|
|
29
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steipete/summarize",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Link → clean text → summary.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,7 +30,11 @@
|
|
|
30
30
|
"README.md",
|
|
31
31
|
"LICENSE"
|
|
32
32
|
],
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": ">=22"
|
|
35
|
+
},
|
|
33
36
|
"dependencies": {
|
|
37
|
+
"@fal-ai/client": "^1.2.1",
|
|
34
38
|
"cheerio": "^1.1.2",
|
|
35
39
|
"es-toolkit": "^1.43.0",
|
|
36
40
|
"gpt-tokenizer": "^3.4.0",
|