search-web-api 1.0.76 → 1.0.77
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/README.md +0 -3
- package/bun.lock +644 -0
- package/package.json +5 -2
- package/src/search/__tests__/public-searxng.test.ts +37 -17
- package/src/sources/academic/arxiv.ts +3 -0
- package/src/sources/academic/core.ts +3 -0
- package/src/sources/academic/crossref.ts +3 -0
- package/src/sources/academic/doaj.ts +3 -0
- package/src/sources/academic/google_scholar.ts +3 -0
- package/src/sources/academic/openalex.ts +3 -0
- package/src/sources/academic/pubmed.ts +3 -0
- package/src/sources/academic/semantic_scholar.ts +3 -0
- package/src/sources/academic/wikidata.ts +3 -0
- package/src/sources/general/baidu.ts +3 -0
- package/src/sources/general/bing.ts +3 -0
- package/src/sources/general/brave.ts +3 -0
- package/src/sources/general/duckduckgo.ts +3 -0
- package/src/sources/general/google.ts +3 -0
- package/src/sources/general/mojeek.ts +3 -0
- package/src/sources/general/qwant.ts +3 -0
- package/src/sources/general/startpage.ts +3 -0
- package/src/sources/general/yahoo.ts +3 -0
- package/src/sources/general/yandex.ts +3 -0
- package/src/sources/images/bing_images.ts +3 -0
- package/src/sources/images/deviantart.ts +3 -0
- package/src/sources/images/flickr.ts +3 -0
- package/src/sources/images/google_images.ts +3 -0
- package/src/sources/images/imgur.ts +3 -0
- package/src/sources/images/openclipart.ts +3 -0
- package/src/sources/images/pixabay.ts +3 -0
- package/src/sources/images/unsplash.ts +3 -0
- package/src/sources/images/wallhaven.ts +3 -0
- package/src/sources/it/crates.ts +3 -0
- package/src/sources/it/dockerhub.ts +3 -0
- package/src/sources/it/github.ts +3 -0
- package/src/sources/it/gitlab.ts +3 -0
- package/src/sources/it/npm.ts +3 -0
- package/src/sources/it/packagist.ts +3 -0
- package/src/sources/it/pypi.ts +3 -0
- package/src/sources/it/rubygems.ts +3 -0
- package/src/sources/it/stackoverflow.ts +3 -0
- package/src/sources/maps/apple_maps.ts +3 -0
- package/src/sources/maps/openstreetmap.ts +3 -0
- package/src/sources/maps/photon.ts +3 -0
- package/src/sources/news/bing_news.ts +3 -0
- package/src/sources/news/google_news.ts +3 -0
- package/src/sources/news/hackernews.ts +3 -0
- package/src/sources/news/yahoo_news.ts +3 -0
- package/src/sources/shopping/ebay.ts +3 -0
- package/src/sources/social/mastodon.ts +3 -0
- package/src/sources/social/medium.ts +3 -0
- package/src/sources/social/reddit.ts +3 -0
- package/src/sources/social/soundcloud.ts +3 -0
- package/src/sources/social/twitter.ts +3 -0
- package/src/sources/specialized/annas_archive.ts +3 -0
- package/src/sources/specialized/archive.ts +3 -0
- package/src/sources/specialized/genius.ts +3 -0
- package/src/sources/specialized/goodreads.ts +3 -0
- package/src/sources/specialized/imdb.ts +3 -0
- package/src/sources/specialized/openlibrary.ts +3 -0
- package/src/sources/specialized/wikipedia.ts +3 -0
- package/src/sources/specialized/wttr.ts +3 -0
- package/src/sources/torrents/1337x.ts +3 -0
- package/src/sources/torrents/eztv.ts +3 -0
- package/src/sources/torrents/kickass.ts +3 -0
- package/src/sources/torrents/nyaa.ts +3 -0
- package/src/sources/torrents/solidtorrents.ts +3 -0
- package/src/sources/torrents/thepiratebay.ts +3 -0
- package/src/sources/torrents/yts.ts +3 -0
- package/src/sources/videos/bing_videos.ts +3 -0
- package/src/sources/videos/dailymotion.ts +3 -0
- package/src/sources/videos/invidious.ts +3 -0
- package/src/sources/videos/peertube.ts +3 -0
- package/src/sources/videos/vimeo.ts +3 -0
- package/src/sources/videos/youtube.ts +3 -0
- package/src/suggest-next-words/autocomplete-ai.ts +41 -38
- package/src/types/search-engine-interface.ts +2 -2
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Engine adapter that queries YouTube video search via public Invidious instances, with fallback across multiple instances.
|
|
3
|
+
*/
|
|
1
4
|
import { EngineFunction } from "../../types/search-engine-interface.js";
|
|
2
5
|
|
|
3
6
|
// Multiple Invidious instances for fallback
|
|
@@ -1,38 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* @
|
|
17
|
-
* @param {string}
|
|
18
|
-
* @
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
.
|
|
38
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Local next-word prediction using the DistilGPT-2 model via Hugging Face Transformers.js.
|
|
3
|
+
*/
|
|
4
|
+
import { pipeline, type TextGenerationSingle } from "@huggingface/transformers";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Generates the next words for a given prompt using a text generation model.
|
|
8
|
+
*
|
|
9
|
+
* The DistilGPT2 model is a distilled, smaller version of OpenAI's GPT-2, featuring
|
|
10
|
+
* around 82 million parameters (~80MB), and available in Hugging Face Transformers
|
|
11
|
+
* for efficient next word (next-token) prediction tasks in English text. It is
|
|
12
|
+
* well-suited for sequence generation and can be used as a next word prediction
|
|
13
|
+
* model with code similar to GPT2, but offers faster and lighter inference compared
|
|
14
|
+
* GPT-2 (124M parameter) model, preserving most capabilities but running
|
|
15
|
+
* significantly faster and requiring less memory.
|
|
16
|
+
* @see https://huggingface.co/Xenova/distilgpt2
|
|
17
|
+
* @param {string} prompt - The input prompt to complete.
|
|
18
|
+
* @param {Object} [options] - Generation options.
|
|
19
|
+
* @param {number} [options.maxTokens=16] - Maximum number of new tokens to generate.
|
|
20
|
+
* @param {string} [options.model='Xenova/distilgpt2'] - The model identifier to use.
|
|
21
|
+
* @returns {Promise<string>} - The generated text completions.
|
|
22
|
+
*/
|
|
23
|
+
export async function predictNextWordsWithSmallLocalModel(
|
|
24
|
+
prompt: string,
|
|
25
|
+
{ model = "Xenova/distilgpt2", maxTokens = 16, modelParams = {} } = {}
|
|
26
|
+
): Promise<string> {
|
|
27
|
+
if (!prompt) throw new Error("Prompt is required");
|
|
28
|
+
return (
|
|
29
|
+
await (
|
|
30
|
+
await pipeline("text-generation", model, {
|
|
31
|
+
dtype: "fp16",
|
|
32
|
+
device: "cpu",
|
|
33
|
+
...modelParams,
|
|
34
|
+
})
|
|
35
|
+
)(prompt, { max_new_tokens: maxTokens })
|
|
36
|
+
)
|
|
37
|
+
.map((res) => (res as TextGenerationSingle).generated_text)
|
|
38
|
+
.join(" ")
|
|
39
|
+
.replace(prompt, "")
|
|
40
|
+
.trim();
|
|
41
|
+
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* import `EngineFunction` and `EngineResult` from here.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import { EngineResult, Engine, EngineFunction } from "./search-result-types.js";
|
|
8
|
+
import type { EngineResult, Engine, EngineFunction } from "./search-result-types.js";
|
|
9
9
|
|
|
10
|
-
export { EngineResult, Engine, EngineFunction };
|
|
10
|
+
export type { EngineResult, Engine, EngineFunction };
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Extract the actual data from a grab-url response.
|