@fgv/ts-extras-transformers 5.1.0-30 → 5.1.0-31

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.
@@ -178,7 +178,7 @@
178
178
  },
179
179
  "kind": "Package",
180
180
  "canonicalReference": "@fgv/ts-extras-transformers!",
181
- "docComment": "/**\n * `@fgv/ts-extras-transformers` — Result-integration boundary over `@huggingface/transformers` (Node-side).\n *\n * A thin facade that wraps `@huggingface/transformers` calls in `Result<T>` from `@fgv/ts-utils`, mirroring the discipline established by `@fgv/ts-extras-webauthn`: one-line `captureAsyncResult` wrappers around upstream primitives with **no opinionated orchestration** above the boundary.\n *\n * **In scope:** `loadPipeline`, `classify`, `classifyAll`, `embed` — the surface needed by the B-3/B-4a local-classifier and embedding scenarios. `generate` is explicitly deferred until a concrete consumer use case surfaces (see `phase-b2-result.md`).\n *\n * **Explicitly NOT in scope:** - Pipeline cache / lifecycle management - Model registry or download management - GPU/CPU device selection policy - Quantization selection - Embedding-store integration - Classifier label allowlists - Request batching - Pipeline dispose semantics\n *\n * For any of the above, use `@huggingface/transformers` directly (with `captureAsyncResult` for your own Result wrapping).\n *\n * @packageDocumentation\n */\n",
181
+ "docComment": "/**\n * `@fgv/ts-extras-transformers` — Result-integration boundary over `@huggingface/transformers` (Node-side).\n *\n * A thin facade that wraps `@huggingface/transformers` calls in `Result<T>` from `@fgv/ts-utils`, mirroring the discipline established by `@fgv/ts-extras-webauthn`: one-line `captureAsyncResult` wrappers around upstream primitives with **no opinionated orchestration** above the boundary.\n *\n * **In scope:** `loadPipeline`, `classify`, `classifyAll`, `embed`, `summarize` — the task types exercised by real consumers so far. The general `generate` primitive is explicitly deferred until a concrete consumer use case surfaces (summarization is its own task-specific primitive).\n *\n * **Explicitly NOT in scope:** - Pipeline cache / lifecycle management - Model registry or download management - GPU/CPU device selection policy - Quantization selection - Embedding-store integration - Classifier label allowlists - Request batching - Pipeline dispose semantics\n *\n * For any of the above, use `@huggingface/transformers` directly (with `captureAsyncResult` for your own Result wrapping).\n *\n * @packageDocumentation\n */\n",
182
182
  "name": "@fgv/ts-extras-transformers",
183
183
  "preserveMemberOrder": false,
184
184
  "members": [
@@ -668,6 +668,121 @@
668
668
  }
669
669
  ],
670
670
  "name": "loadPipeline"
671
+ },
672
+ {
673
+ "kind": "Function",
674
+ "canonicalReference": "@fgv/ts-extras-transformers!summarize:function(1)",
675
+ "docComment": "/**\n * Result-integration wrapper that invokes a `SummarizationPipeline` on a single text input. Returns the upstream `SummarizationOutput` Result-wrapped (an array of `{ summary_text }` entries; one for a single-string input).\n *\n * Callers should retrieve the summarizer via `loadPipeline('summarization', modelId)` — e.g. `Xenova/distilbart-cnn-6-6` for a small, local-friendly model. This facade applies no opinionated orchestration (no length policy, no local-vs-cloud routing) — `options` are passed through verbatim and the caller owns any escalation decision.\n *\n * Returns `Promise<Result<SummarizationOutput>>`; upstream errors (inference failures, tokenisation errors) are captured as `Failure` with the original message.\n *\n * @param summarizer - A `SummarizationPipeline` obtained from `loadPipeline`.\n *\n * @param text - The text to summarize.\n *\n * @param options - Optional upstream summarization options (e.g. `min_length`, `max_length`, `max_new_tokens`). Passed through verbatim to the pipeline call.\n *\n * @see\n *\n * https://huggingface.co/docs/transformers.js\n *\n * @public\n */\n",
676
+ "excerptTokens": [
677
+ {
678
+ "kind": "Content",
679
+ "text": "export declare function summarize(summarizer: "
680
+ },
681
+ {
682
+ "kind": "Reference",
683
+ "text": "SummarizationPipeline",
684
+ "canonicalReference": "@huggingface/transformers!SummarizationPipeline:class"
685
+ },
686
+ {
687
+ "kind": "Content",
688
+ "text": ", text: "
689
+ },
690
+ {
691
+ "kind": "Content",
692
+ "text": "string"
693
+ },
694
+ {
695
+ "kind": "Content",
696
+ "text": ", options?: "
697
+ },
698
+ {
699
+ "kind": "Reference",
700
+ "text": "Parameters",
701
+ "canonicalReference": "!Parameters:type"
702
+ },
703
+ {
704
+ "kind": "Content",
705
+ "text": "<"
706
+ },
707
+ {
708
+ "kind": "Reference",
709
+ "text": "SummarizationPipeline",
710
+ "canonicalReference": "@huggingface/transformers!SummarizationPipeline:class"
711
+ },
712
+ {
713
+ "kind": "Content",
714
+ "text": ">[1]"
715
+ },
716
+ {
717
+ "kind": "Content",
718
+ "text": "): "
719
+ },
720
+ {
721
+ "kind": "Reference",
722
+ "text": "Promise",
723
+ "canonicalReference": "!Promise:interface"
724
+ },
725
+ {
726
+ "kind": "Content",
727
+ "text": "<"
728
+ },
729
+ {
730
+ "kind": "Reference",
731
+ "text": "Result",
732
+ "canonicalReference": "@fgv/ts-utils!Result:type"
733
+ },
734
+ {
735
+ "kind": "Content",
736
+ "text": "<"
737
+ },
738
+ {
739
+ "kind": "Reference",
740
+ "text": "SummarizationOutput",
741
+ "canonicalReference": "@huggingface/transformers!SummarizationOutput:type"
742
+ },
743
+ {
744
+ "kind": "Content",
745
+ "text": ">>"
746
+ },
747
+ {
748
+ "kind": "Content",
749
+ "text": ";"
750
+ }
751
+ ],
752
+ "fileUrlPath": "src/index.ts",
753
+ "returnTypeTokenRange": {
754
+ "startIndex": 10,
755
+ "endIndex": 16
756
+ },
757
+ "releaseTag": "Public",
758
+ "overloadIndex": 1,
759
+ "parameters": [
760
+ {
761
+ "parameterName": "summarizer",
762
+ "parameterTypeTokenRange": {
763
+ "startIndex": 1,
764
+ "endIndex": 2
765
+ },
766
+ "isOptional": false
767
+ },
768
+ {
769
+ "parameterName": "text",
770
+ "parameterTypeTokenRange": {
771
+ "startIndex": 3,
772
+ "endIndex": 4
773
+ },
774
+ "isOptional": false
775
+ },
776
+ {
777
+ "parameterName": "options",
778
+ "parameterTypeTokenRange": {
779
+ "startIndex": 5,
780
+ "endIndex": 9
781
+ },
782
+ "isOptional": true
783
+ }
784
+ ],
785
+ "name": "summarize"
671
786
  }
672
787
  ]
673
788
  }
@@ -10,6 +10,8 @@ import { pipeline } from '@huggingface/transformers';
10
10
  import { PipelineType } from '@huggingface/transformers';
11
11
  import { PretrainedModelOptions } from '@huggingface/transformers';
12
12
  import { Result } from '@fgv/ts-utils';
13
+ import { SummarizationOutput } from '@huggingface/transformers';
14
+ import { SummarizationPipeline } from '@huggingface/transformers';
13
15
  import { Tensor } from '@huggingface/transformers';
14
16
  import { TextClassificationOutput } from '@huggingface/transformers';
15
17
  import { TextClassificationPipeline } from '@huggingface/transformers';
@@ -34,6 +36,13 @@ export { PipelineType }
34
36
 
35
37
  export { PretrainedModelOptions }
36
38
 
39
+ export { SummarizationOutput }
40
+
41
+ export { SummarizationPipeline }
42
+
43
+ // @public
44
+ export function summarize(summarizer: SummarizationPipeline, text: string, options?: Parameters<SummarizationPipeline>[1]): Promise<Result<SummarizationOutput>>;
45
+
37
46
  export { Tensor }
38
47
 
39
48
  export { TextClassificationOutput }