Instructions to use botezx/flagtldr with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Grok
How to use botezx/flagtldr with Grok:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Download extension/test/parser.test.cjs from botezx/flagtldr: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/botezx/flagtldr/resolve/main/extension/test/parser.test.cjs
- Command line
-
hf download hf://botezx/flagtldr/extension/test/parser.test.cjs
-
curl -L -o parser.test.cjs https://huggingface.co/botezx/flagtldr/resolve/main/extension/test/parser.test.cjs
1.44 kB
| const test = require("node:test"); | |
| const assert = require("node:assert"); | |
| const parser = require("../src/lib/tweet-parser.js"); | |
| const prompt = require("../src/lib/prompt.js"); | |
| const { makeTweetDetail } = require("../fixtures/make-tweetdetail.cjs"); | |
| test("extractPosts finds every tweet with author and text", () => { | |
| const posts = parser.extractPosts(makeTweetDetail()); | |
| assert.strictEqual(posts.length, 6); | |
| const p = posts.find((x) => x.id === "102"); | |
| assert.strictEqual(p.author.handle, "hr_praktyk"); | |
| assert.strictEqual(p.inReplyToId, "100"); | |
| assert.match(p.text, /rotacja/); | |
| }); | |
| test("extractPosts unwraps TweetWithVisibilityResults", () => { | |
| const payload = { tweet_results: { result: { __typename: "TweetWithVisibilityResults", tweet: makeTweetDetail().data.threaded_conversation_with_injections_v2.instructions[0].entries[0].content.itemContent.tweet_results.result } } }; | |
| assert.strictEqual(parser.extractPosts(payload)[0].id, "100"); | |
| }); | |
| test("buildThread + buildSummaryPrompt order replies by likes", () => { | |
| const thread = parser.buildThread(parser.extractPosts(makeTweetDetail()), "100"); | |
| assert.strictEqual(thread.replies.length, 5); | |
| const text = prompt.buildSummaryPrompt(thread); | |
| assert.match(text, /TEZA/); | |
| assert.ok(text.indexOf("@ekonomistka") < text.indexOf("@troll123")); | |
| const handoff = prompt.buildHandoffText("", text); | |
| assert.ok(handoff.startsWith(prompt.DEFAULT_SYSTEM_PROMPT)); | |
| }); | |