@far-world-labs/verblets 0.2.0 → 0.3.2
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 +86 -213
- package/dist/index.browser.js +74 -0
- package/dist/index.js +548 -0
- package/dist/shared-C6kPWghF.js +7806 -0
- package/package.json +32 -11
- package/.cursor/launch.json +0 -30
- package/.cursor/settings.json +0 -20
- package/.github/workflows/branch-protection.yml +0 -22
- package/.github/workflows/ci.yml +0 -165
- package/.husky/pre-commit +0 -4
- package/.prettierrc +0 -6
- package/.release-it.json +0 -12
- package/.vitest.config.examples.js +0 -12
- package/.vitest.config.js +0 -8
- package/.vscode/launch.json +0 -31
- package/AGENTS.md +0 -220
- package/DEVELOPING.md +0 -105
- package/docker-compose.yml +0 -7
- package/eslint.config.js +0 -80
- package/scripts/clear-redis.js +0 -74
- package/scripts/generate-chain/index.js +0 -111
- package/scripts/generate-lib/index.js +0 -68
- package/scripts/generate-test/index.js +0 -137
- package/scripts/generate-verblet/README.md +0 -17
- package/scripts/generate-verblet/index.js +0 -110
- package/scripts/run.sh +0 -15
- package/scripts/runner/index.js +0 -56
- package/scripts/simple-editor/README.md +0 -34
- package/scripts/simple-editor/index.js +0 -79
- package/scripts/summarize-files/index.js +0 -70
- package/src/chains/README.md +0 -30
- package/src/chains/anonymize/README.md +0 -21
- package/src/chains/anonymize/index.examples.js +0 -75
- package/src/chains/anonymize/index.js +0 -121
- package/src/chains/anonymize/index.spec.js +0 -78
- package/src/chains/bulk-central-tendency/index.examples.js +0 -138
- package/src/chains/bulk-central-tendency/index.js +0 -91
- package/src/chains/bulk-filter/README.md +0 -21
- package/src/chains/bulk-filter/index.examples.js +0 -22
- package/src/chains/bulk-filter/index.js +0 -58
- package/src/chains/bulk-filter/index.spec.js +0 -38
- package/src/chains/bulk-find/README.md +0 -16
- package/src/chains/bulk-find/index.examples.js +0 -20
- package/src/chains/bulk-find/index.js +0 -30
- package/src/chains/bulk-find/index.spec.js +0 -26
- package/src/chains/bulk-group/README.md +0 -23
- package/src/chains/bulk-group/index.examples.js +0 -18
- package/src/chains/bulk-group/index.js +0 -34
- package/src/chains/bulk-group/index.spec.js +0 -41
- package/src/chains/bulk-map/README.md +0 -43
- package/src/chains/bulk-map/index.examples.js +0 -17
- package/src/chains/bulk-map/index.js +0 -86
- package/src/chains/bulk-map/index.spec.js +0 -44
- package/src/chains/bulk-reduce/README.md +0 -12
- package/src/chains/bulk-reduce/index.examples.js +0 -15
- package/src/chains/bulk-reduce/index.js +0 -13
- package/src/chains/bulk-reduce/index.spec.js +0 -25
- package/src/chains/bulk-score/README.md +0 -16
- package/src/chains/bulk-score/bulk-score-result.json +0 -18
- package/src/chains/bulk-score/index.examples.js +0 -22
- package/src/chains/bulk-score/index.js +0 -133
- package/src/chains/bulk-score/index.spec.js +0 -30
- package/src/chains/category-samples/README.md +0 -61
- package/src/chains/category-samples/index.examples.js +0 -103
- package/src/chains/category-samples/index.js +0 -134
- package/src/chains/collect-terms/README.md +0 -12
- package/src/chains/collect-terms/index.examples.js +0 -16
- package/src/chains/collect-terms/index.js +0 -44
- package/src/chains/collect-terms/index.spec.js +0 -25
- package/src/chains/conversation/README.md +0 -26
- package/src/chains/conversation/index.examples.js +0 -398
- package/src/chains/conversation/index.js +0 -126
- package/src/chains/conversation/index.spec.js +0 -148
- package/src/chains/conversation/turn-policies.js +0 -93
- package/src/chains/conversation/turn-policies.md +0 -123
- package/src/chains/conversation/turn-policies.spec.js +0 -135
- package/src/chains/date/README.md +0 -12
- package/src/chains/date/index.examples.js +0 -47
- package/src/chains/date/index.js +0 -74
- package/src/chains/date/index.spec.js +0 -62
- package/src/chains/disambiguate/README.md +0 -22
- package/src/chains/disambiguate/disambiguate-meanings-result.json +0 -16
- package/src/chains/disambiguate/index.examples.js +0 -18
- package/src/chains/disambiguate/index.js +0 -92
- package/src/chains/disambiguate/index.spec.js +0 -25
- package/src/chains/dismantle/README.md +0 -67
- package/src/chains/dismantle/dismantle.examples.js +0 -27
- package/src/chains/dismantle/index.examples.js +0 -30
- package/src/chains/dismantle/index.js +0 -303
- package/src/chains/dismantle/index.spec.js +0 -32
- package/src/chains/expect/README.md +0 -171
- package/src/chains/expect/index.examples.js +0 -146
- package/src/chains/expect/index.js +0 -207
- package/src/chains/expect/index.spec.js +0 -324
- package/src/chains/filter-ambiguous/README.md +0 -11
- package/src/chains/filter-ambiguous/index.examples.js +0 -20
- package/src/chains/filter-ambiguous/index.js +0 -49
- package/src/chains/filter-ambiguous/index.spec.js +0 -31
- package/src/chains/glossary/README.md +0 -19
- package/src/chains/glossary/index.examples.js +0 -386
- package/src/chains/glossary/index.js +0 -75
- package/src/chains/glossary/index.spec.js +0 -19
- package/src/chains/intersections/README.md +0 -166
- package/src/chains/intersections/index.examples.js +0 -280
- package/src/chains/intersections/index.js +0 -218
- package/src/chains/intersections/intersection-result.json +0 -38
- package/src/chains/list/index.examples.js +0 -68
- package/src/chains/list/index.js +0 -214
- package/src/chains/list/index.spec.js +0 -67
- package/src/chains/list/list-result.json +0 -16
- package/src/chains/list/schema.json +0 -24
- package/src/chains/llm-logger/README.md +0 -366
- package/src/chains/llm-logger/index.js +0 -591
- package/src/chains/llm-logger/index.spec.js +0 -391
- package/src/chains/llm-logger/schema.json +0 -105
- package/src/chains/questions/index.examples.js +0 -69
- package/src/chains/questions/index.js +0 -135
- package/src/chains/questions/index.spec.js +0 -29
- package/src/chains/scan-js/index.js +0 -116
- package/src/chains/set-interval/README.md +0 -81
- package/src/chains/set-interval/index.examples.js +0 -64
- package/src/chains/set-interval/index.js +0 -152
- package/src/chains/set-interval/index.spec.js +0 -70
- package/src/chains/socratic/README.md +0 -17
- package/src/chains/socratic/index.js +0 -64
- package/src/chains/socratic/index.spec.js +0 -24
- package/src/chains/sort/index.examples.js +0 -36
- package/src/chains/sort/index.js +0 -163
- package/src/chains/sort/index.spec.js +0 -112
- package/src/chains/sort/sort-result.json +0 -16
- package/src/chains/summary-map/README.md +0 -41
- package/src/chains/summary-map/index.examples.js +0 -64
- package/src/chains/summary-map/index.js +0 -226
- package/src/chains/summary-map/index.spec.js +0 -153
- package/src/chains/test/index.js +0 -114
- package/src/chains/test-advice/index.js +0 -35
- package/src/chains/themes/README.md +0 -20
- package/src/chains/themes/index.examples.js +0 -17
- package/src/chains/themes/index.js +0 -28
- package/src/chains/themes/index.spec.js +0 -19
- package/src/chains/veiled-variants/index.examples.js +0 -18
- package/src/chains/veiled-variants/index.js +0 -107
- package/src/chains/veiled-variants/index.spec.js +0 -40
- package/src/constants/common.js +0 -13
- package/src/constants/messages.js +0 -3
- package/src/constants/models.js +0 -184
- package/src/index.js +0 -203
- package/src/json-schemas/README.md +0 -13
- package/src/json-schemas/cars-test.json +0 -11
- package/src/json-schemas/index.js +0 -12
- package/src/json-schemas/intent.json +0 -38
- package/src/json-schemas/schema-dot-org-photograph.json +0 -133
- package/src/json-schemas/schema-dot-org-place.json +0 -129
- package/src/lib/README.md +0 -26
- package/src/lib/any-signal/index.js +0 -28
- package/src/lib/assert/README.md +0 -84
- package/src/lib/assert/index.js +0 -50
- package/src/lib/bulk-filter/README.md +0 -22
- package/src/lib/bulk-filter/index.examples.js +0 -27
- package/src/lib/bulk-filter/index.js +0 -63
- package/src/lib/bulk-filter/index.spec.js +0 -38
- package/src/lib/bulk-find/README.md +0 -18
- package/src/lib/bulk-find/index.examples.js +0 -19
- package/src/lib/bulk-find/index.js +0 -30
- package/src/lib/bulk-find/index.spec.js +0 -41
- package/src/lib/chatgpt/index.js +0 -163
- package/src/lib/combinations/index.js +0 -30
- package/src/lib/combinations/index.spec.js +0 -23
- package/src/lib/editor/index.js +0 -31
- package/src/lib/functional/index.js +0 -28
- package/src/lib/logger-service/index.js +0 -32
- package/src/lib/parse-js-parts/index.js +0 -321
- package/src/lib/parse-js-parts/index.spec.js +0 -156
- package/src/lib/parse-llm-list/README.md +0 -39
- package/src/lib/parse-llm-list/index.js +0 -54
- package/src/lib/parse-llm-list/index.spec.js +0 -59
- package/src/lib/path-aliases/index.js +0 -37
- package/src/lib/path-aliases/index.spec.js +0 -64
- package/src/lib/pave/index.js +0 -34
- package/src/lib/pave/index.spec.js +0 -76
- package/src/lib/prompt-cache/index.js +0 -50
- package/src/lib/retry/index.js +0 -66
- package/src/lib/retry/index.spec.js +0 -86
- package/src/lib/ring-buffer/README.md +0 -82
- package/src/lib/ring-buffer/index.js +0 -235
- package/src/lib/ring-buffer/index.spec.js +0 -388
- package/src/lib/search-best-first/city-walk.spec.js +0 -37
- package/src/lib/search-best-first/index.js +0 -97
- package/src/lib/search-best-first/index.spec.js +0 -35
- package/src/lib/search-js-files/code-features-property-definitions.json +0 -123
- package/src/lib/search-js-files/index.examples.js +0 -22
- package/src/lib/search-js-files/index.js +0 -155
- package/src/lib/search-js-files/index.spec.js +0 -34
- package/src/lib/search-js-files/scan-file.js +0 -242
- package/src/lib/shorten-text/index.js +0 -25
- package/src/lib/shorten-text/index.spec.js +0 -68
- package/src/lib/strip-numeric/index.js +0 -5
- package/src/lib/strip-response/index.js +0 -30
- package/src/lib/template-replace/index.js +0 -23
- package/src/lib/template-replace/index.spec.js +0 -60
- package/src/lib/timed-abort-controller/index.js +0 -41
- package/src/lib/to-bool/index.js +0 -8
- package/src/lib/to-date/index.js +0 -11
- package/src/lib/to-enum/index.js +0 -14
- package/src/lib/to-number/index.js +0 -12
- package/src/lib/to-number-with-units/index.js +0 -51
- package/src/lib/transcribe/index.js +0 -78
- package/src/prompts/README.md +0 -17
- package/src/prompts/as-enum.js +0 -5
- package/src/prompts/as-json-schema.js +0 -9
- package/src/prompts/as-object-with-schema.js +0 -26
- package/src/prompts/as-schema-org-text.js +0 -25
- package/src/prompts/as-schema-org-type.js +0 -1
- package/src/prompts/blog-post.js +0 -7
- package/src/prompts/code-features.js +0 -24
- package/src/prompts/constants.js +0 -101
- package/src/prompts/features-json-schema.js +0 -27
- package/src/prompts/generate-collection.js +0 -26
- package/src/prompts/generate-list.js +0 -48
- package/src/prompts/generate-questions.js +0 -19
- package/src/prompts/index.js +0 -20
- package/src/prompts/intent.js +0 -60
- package/src/prompts/output-succinct-names.js +0 -3
- package/src/prompts/select-from-threshold.js +0 -17
- package/src/prompts/sort.js +0 -31
- package/src/prompts/style.js +0 -38
- package/src/prompts/summarize.js +0 -13
- package/src/prompts/token-budget.js +0 -3
- package/src/prompts/wrap-list.js +0 -11
- package/src/prompts/wrap-variable.js +0 -36
- package/src/services/llm-model/global-overrides.spec.js +0 -432
- package/src/services/llm-model/index.js +0 -308
- package/src/services/llm-model/model.js +0 -21
- package/src/services/llm-model/negotiate.spec.js +0 -447
- package/src/services/redis/index.js +0 -147
- package/src/test/setup.js +0 -20
- package/src/verblets/README.md +0 -26
- package/src/verblets/auto/index.examples.js +0 -31
- package/src/verblets/auto/index.js +0 -28
- package/src/verblets/auto/index.spec.js +0 -32
- package/src/verblets/bool/README.md +0 -36
- package/src/verblets/bool/index.examples.js +0 -80
- package/src/verblets/bool/index.js +0 -25
- package/src/verblets/bool/index.schema.json +0 -14
- package/src/verblets/bool/index.spec.js +0 -33
- package/src/verblets/central-tendency/README.md +0 -166
- package/src/verblets/central-tendency/central-tendency-result.json +0 -24
- package/src/verblets/central-tendency/index.examples.js +0 -196
- package/src/verblets/central-tendency/index.js +0 -171
- package/src/verblets/central-tendency/index.spec.js +0 -148
- package/src/verblets/conversation-turn/README.md +0 -33
- package/src/verblets/conversation-turn/index.examples.js +0 -218
- package/src/verblets/conversation-turn/index.js +0 -68
- package/src/verblets/conversation-turn/index.spec.js +0 -77
- package/src/verblets/conversation-turn-multi/README.md +0 -31
- package/src/verblets/conversation-turn-multi/index.examples.js +0 -160
- package/src/verblets/conversation-turn-multi/index.js +0 -104
- package/src/verblets/conversation-turn-multi/index.spec.js +0 -63
- package/src/verblets/enum/index.examples.js +0 -30
- package/src/verblets/enum/index.js +0 -18
- package/src/verblets/enum/index.spec.js +0 -35
- package/src/verblets/expect/README.md +0 -64
- package/src/verblets/expect/index.examples.js +0 -109
- package/src/verblets/expect/index.js +0 -75
- package/src/verblets/expect/index.spec.js +0 -127
- package/src/verblets/intent/index.examples.js +0 -139
- package/src/verblets/intent/index.js +0 -60
- package/src/verblets/intent/index.spec.js +0 -31
- package/src/verblets/intersection/README.md +0 -16
- package/src/verblets/intersection/index.examples.js +0 -89
- package/src/verblets/intersection/index.js +0 -125
- package/src/verblets/intersection/index.spec.js +0 -60
- package/src/verblets/intersection/intersection-result.json +0 -16
- package/src/verblets/list-expand/README.md +0 -10
- package/src/verblets/list-expand/index.examples.js +0 -14
- package/src/verblets/list-expand/index.js +0 -104
- package/src/verblets/list-expand/index.spec.js +0 -18
- package/src/verblets/list-expand/list-expand-result.json +0 -16
- package/src/verblets/list-filter/README.md +0 -22
- package/src/verblets/list-filter/index.examples.js +0 -26
- package/src/verblets/list-filter/index.js +0 -18
- package/src/verblets/list-filter/index.spec.js +0 -19
- package/src/verblets/list-find/README.md +0 -11
- package/src/verblets/list-find/index.examples.js +0 -15
- package/src/verblets/list-find/index.js +0 -17
- package/src/verblets/list-find/index.spec.js +0 -19
- package/src/verblets/list-group/README.md +0 -16
- package/src/verblets/list-group/index.examples.js +0 -16
- package/src/verblets/list-group/index.js +0 -112
- package/src/verblets/list-group/index.spec.js +0 -35
- package/src/verblets/list-group/list-group-result.json +0 -16
- package/src/verblets/list-map/README.md +0 -11
- package/src/verblets/list-map/index.examples.js +0 -15
- package/src/verblets/list-map/index.js +0 -26
- package/src/verblets/list-map/index.spec.js +0 -17
- package/src/verblets/list-reduce/README.md +0 -10
- package/src/verblets/list-reduce/index.examples.js +0 -14
- package/src/verblets/list-reduce/index.js +0 -21
- package/src/verblets/list-reduce/index.spec.js +0 -27
- package/src/verblets/list-reduce/index.spec.jsx +0 -27
- package/src/verblets/name/README.md +0 -15
- package/src/verblets/name/index.examples.js +0 -28
- package/src/verblets/name/index.js +0 -19
- package/src/verblets/name/index.spec.js +0 -33
- package/src/verblets/name-similar-to/README.md +0 -26
- package/src/verblets/name-similar-to/index.examples.js +0 -18
- package/src/verblets/name-similar-to/index.js +0 -20
- package/src/verblets/name-similar-to/index.spec.js +0 -13
- package/src/verblets/number/index.examples.js +0 -199
- package/src/verblets/number/index.js +0 -25
- package/src/verblets/number/index.spec.js +0 -33
- package/src/verblets/number-with-units/index.examples.js +0 -38
- package/src/verblets/number-with-units/index.js +0 -84
- package/src/verblets/number-with-units/index.spec.js +0 -46
- package/src/verblets/number-with-units/number-with-units-result.json +0 -23
- package/src/verblets/people-list/README.md +0 -28
- package/src/verblets/people-list/index.examples.js +0 -184
- package/src/verblets/people-list/index.js +0 -44
- package/src/verblets/people-list/index.spec.js +0 -49
- package/src/verblets/schema-org/index.examples.js +0 -51
- package/src/verblets/schema-org/index.js +0 -37
- package/src/verblets/schema-org/index.spec.js +0 -39
- package/src/verblets/sentiment/README.md +0 -10
- package/src/verblets/sentiment/index.examples.js +0 -20
- package/src/verblets/sentiment/index.js +0 -9
- package/src/verblets/sentiment/index.spec.js +0 -20
- package/src/verblets/to-object/README.md +0 -38
- package/src/verblets/to-object/index.examples.js +0 -29
- package/src/verblets/to-object/index.js +0 -131
- package/src/verblets/to-object/index.spec.js +0 -71
package/README.md
CHANGED
|
@@ -1,253 +1,126 @@
|
|
|
1
1
|
# Verblets
|
|
2
2
|
|
|
3
|
-
Verblets is a library of AI-powered
|
|
3
|
+
Verblets /ˈvaɪb.ləts/ is a utility library of AI-powered functions for creating new kinds of applications. Verblets are composable and reusable while constraining outputs to ensure software reliability. Many of the API interfaces are familiar to developers but support intelligent operations in ways classical analogues do not, sometimes via complex algorithms that have surprising results.
|
|
4
|
+
|
|
5
|
+
Instead of mimicking humans in order to automate tasks, an AI standard library *extends* people in *new* ways via intelligent software applications that are built on those utilities. Top-down AI approaches to automate people lead to forgetful, error-prone NPC-like replicas that can't be shaped the way software can. By contrast, AI-based software tools lead to new roles and new ways of working together for us humans.
|
|
6
|
+
|
|
7
|
+
Why the name? Verblets are *verbally* based: they're LLM-powered; and you can think of functions as verbs.
|
|
4
8
|
|
|
5
9
|
## Repository Guide
|
|
6
10
|
|
|
7
11
|
### Quick Links
|
|
8
12
|
|
|
9
|
-
- [Chains](./src/chains/) -
|
|
10
|
-
- [Verblets](./src/verblets/) - Core AI utility functions
|
|
13
|
+
- [Chains](./src/chains/) - Prompt chains and algorithms based on LLMs
|
|
14
|
+
- [Verblets](./src/verblets/) - Core AI utility functions. At most a single LLM call, no prompt chains.
|
|
11
15
|
- [Library Helpers](./src/lib/) - Utility functions and wrappers
|
|
12
16
|
- [Prompts](./src/prompts/) - Reusable prompt templates
|
|
13
17
|
- [JSON Schemas](./src/json-schemas/) - Data validation schemas
|
|
14
18
|
|
|
15
|
-
##
|
|
19
|
+
## Utilities
|
|
16
20
|
|
|
17
21
|
### Primitives
|
|
18
22
|
|
|
19
23
|
Primitive verblets extract basic data types from natural language with high reliability. They constrain LLM outputs to prevent hallucination while handling the complexity of human expression.
|
|
20
24
|
|
|
21
|
-
- [bool](./src/verblets/bool) -
|
|
22
|
-
- [
|
|
23
|
-
- [
|
|
24
|
-
- [number
|
|
25
|
-
- [
|
|
25
|
+
- [bool](./src/verblets/bool) - Interpret yes/no, true/false, and conditional statements
|
|
26
|
+
- [date](./src/chains/date) - Parse dates from relative expressions, natural language, standard formats, and longer descriptions
|
|
27
|
+
- [enum](./src/verblets/enum) - Convert free-form input to exactly one of several predefined options
|
|
28
|
+
- [number](./src/verblets/number) - Convert a block of text to a single number
|
|
29
|
+
- [number-with-units](./src/verblets/number-with-units) - Parse measurements and convert between unit systems
|
|
30
|
+
|
|
31
|
+
### Math
|
|
32
|
+
|
|
33
|
+
Math chains transform values using conceptual reasoning and subjective judgments beyond simple calculations.
|
|
34
|
+
|
|
35
|
+
- [scale](./src/chains/scale) - Convert qualitative descriptions to numeric values. Uses a specification generator to maintain consistency across invocations.
|
|
26
36
|
|
|
27
37
|
### Lists
|
|
28
38
|
|
|
29
|
-
List operations transform, filter, and organize collections
|
|
30
|
-
|
|
31
|
-
- [
|
|
32
|
-
- [
|
|
33
|
-
- [
|
|
34
|
-
- [
|
|
35
|
-
- [
|
|
36
|
-
- [
|
|
37
|
-
- [
|
|
38
|
-
- [
|
|
39
|
-
- [
|
|
40
|
-
- [list
|
|
41
|
-
- [list-
|
|
42
|
-
- [
|
|
43
|
-
- [
|
|
44
|
-
- [
|
|
45
|
-
- [sort](./src/chains/sort) -
|
|
46
|
-
- [
|
|
39
|
+
List operations transform, filter, and organize collections. They handle both individual items and batch processing for datasets larger than a context window. Many list operations support bulk operation with built-in retry. Many have alternative single invocation versions in the verblets directory. Many utilities have list support via specification-generators that maintain continuity, or prompt fragments that adapt single-invcation behavior to list processing.
|
|
40
|
+
|
|
41
|
+
- [central-tendency](./src/chains/central-tendency) - Find the most representative examples from a collection
|
|
42
|
+
- [detect-patterns](./src/chains/detect-patterns) - Identify repeating structures, sequences, or relationships in data
|
|
43
|
+
- [detect-threshold](./src/chains/detect-threshold) - Find meaningful breakpoints in numeric values, for use in metrics and alerting
|
|
44
|
+
- [entities](./src/chains/entities) - Extract names, places, organizations, and custom entity types
|
|
45
|
+
- [filter](./src/chains/filter) - Keep items matching natural language criteria through parallel batch processing
|
|
46
|
+
- [find](./src/chains/find) - Return the single best match using parallel evaluation with early stopping
|
|
47
|
+
- [glossary](./src/chains/glossary) - Extract key terms and generate definitions from their usage
|
|
48
|
+
- [group](./src/chains/group) - Cluster items by first discovering categories then assigning members
|
|
49
|
+
- [intersections](./src/chains/intersections) - Find overlapping concepts between all item pairs
|
|
50
|
+
- [list](./src/chains/list) - Extract lists from prose, tables, or generate from descriptions
|
|
51
|
+
- [list-expand](./src/verblets/list-expand) - Add similar items matching the pattern of existing ones
|
|
52
|
+
- [map](./src/chains/map) - Transform each item using consistent rules applied in parallel batches
|
|
53
|
+
- [reduce](./src/chains/reduce) - Combine items sequentially, building up a result across batches
|
|
54
|
+
- [score](./src/chains/score) - Rate items on multiple criteria using weighted evaluation
|
|
55
|
+
- [sort](./src/chains/sort) - Order by complex criteria using tournament-style comparisons
|
|
56
|
+
- [tags](./src/chains/tags) - Apply vocabulary-based tags to categorize items
|
|
47
57
|
|
|
48
58
|
### Content
|
|
49
59
|
|
|
50
|
-
Content utilities generate, transform, and analyze text while maintaining structure and meaning. They
|
|
51
|
-
|
|
52
|
-
- [anonymize](./src/chains/anonymize) -
|
|
53
|
-
- [
|
|
54
|
-
- [
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
- [
|
|
58
|
-
- [
|
|
59
|
-
- [
|
|
60
|
-
- [
|
|
61
|
-
- [
|
|
62
|
-
- [
|
|
63
|
-
- [
|
|
64
|
-
- [
|
|
65
|
-
- [
|
|
66
|
-
- [
|
|
60
|
+
Content utilities generate, transform, and analyze text while maintaining structure and meaning. They handle creative tasks, system analysis, and privacy-aware text processing.
|
|
61
|
+
|
|
62
|
+
- [anonymize](./src/chains/anonymize) - Replace names, dates, and identifying details with placeholders
|
|
63
|
+
- [category-samples](./src/chains/category-samples) - Create examples ranging from typical to edge cases
|
|
64
|
+
- [collect-terms](./src/chains/collect-terms) - Find domain-specific or complex vocabulary
|
|
65
|
+
- [commonalities](./src/verblets/commonalities) - Identify what items share conceptually, not just literally
|
|
66
|
+
- [conversation](./src/chains/conversation) - Manage multi-turn dialogues with memory and context tracking
|
|
67
|
+
- [disambiguate](./src/chains/disambiguate) - Determine which meaning of ambiguous terms fits the context
|
|
68
|
+
- [dismantle](./src/chains/dismantle) - Break down systems into parts, subparts, and their connections
|
|
69
|
+
- [document-shrink](./src/chains/document-shrink) - Remove less relevant sections while keeping query-related content
|
|
70
|
+
- [fill-missing](./src/verblets/fill-missing) - Predict likely content for redacted or corrupted sections
|
|
71
|
+
- [filter-ambiguous](./src/chains/filter-ambiguous) - Flag items that need human clarification
|
|
72
|
+
- [join](./src/chains/join) - Connect text fragments by adding transitions and maintaining flow
|
|
73
|
+
- [name](./src/verblets/name) - Parse names handling titles, suffixes, and cultural variations
|
|
74
|
+
- [name-similar-to](./src/verblets/name-similar-to) - Generate names following example patterns
|
|
75
|
+
- [people](./src/chains/people) - Build artificial person profiles with consistent demographics and traits. Useful as LLM roles.
|
|
76
|
+
- [pop-reference](./src/chains/pop-reference) - Match concepts to movies, songs, memes, or cultural touchstones
|
|
77
|
+
- [questions](./src/chains/questions) - Generate follow-up questions that branch from initial inquiry
|
|
78
|
+
- [relations](./src/chains/relations) - Extract relationship tuples from text
|
|
79
|
+
- [schema-org](./src/verblets/schema-org) - Convert unstructured data to schema.org JSON-LD format
|
|
80
|
+
- [socratic](./src/chains/socratic) - Ask questions that reveal hidden assumptions and logic gaps
|
|
81
|
+
- [split](./src/chains/split) - Find topic boundaries in continuous text
|
|
82
|
+
- [summary-map](./src/chains/summary-map) - Build layered summaries for navigating large documents
|
|
83
|
+
- [tag-vocabulary](./src/chains/tag-vocabulary) - Generate and refine tag vocabularies through iterative analysis
|
|
84
|
+
- [themes](./src/chains/themes) - Surface recurring ideas through multi-pass extraction and merging
|
|
85
|
+
- [timeline](./src/chains/timeline) - Order events chronologically from scattered mentions
|
|
86
|
+
- [to-object](./src/chains/to-object) - Extract key-value pairs from natural language descriptions
|
|
87
|
+
- [truncate](./src/chains/truncate) - Remove trailing content after a semantic boundary
|
|
88
|
+
- [veiled-variants](./src/chains/veiled-variants) - Reword queries to avoid triggering content filters
|
|
89
|
+
|
|
67
90
|
|
|
68
91
|
### Utility Operations
|
|
69
92
|
|
|
70
|
-
Utility operations
|
|
93
|
+
Utility operations are uncategorized functionality like automatic tool selection, intent parsing, and context compression.
|
|
71
94
|
|
|
72
|
-
- [
|
|
73
|
-
- [
|
|
74
|
-
- [expect
|
|
75
|
-
- [
|
|
76
|
-
- [
|
|
77
|
-
- [
|
|
78
|
-
- [
|
|
95
|
+
- [ai-arch-expect](./src/chains/ai-arch-expect) - Validate AI architecture constraints and patterns
|
|
96
|
+
- [auto](./src/verblets/auto) - Match task descriptions to available tools using function calling
|
|
97
|
+
- [expect](./src/verblets/expect) - Check if conditions are met and explain why if not
|
|
98
|
+
- [expect chain](./src/chains/expect) - Validate complex data relationships with detailed failure analysis
|
|
99
|
+
- [intent](./src/verblets/intent) - Extract action and parameters from natural language commands
|
|
100
|
+
- [llm-logger](./src/chains/llm-logger) - Summarize log patterns and detect anomalies across time windows
|
|
101
|
+
- [sentiment](./src/verblets/sentiment) - Classify as positive, negative, or neutral with nuance detection
|
|
102
|
+
- [set-interval](./src/chains/set-interval) - Schedule tasks using natural language time descriptions
|
|
79
103
|
|
|
80
104
|
### Codebase
|
|
81
105
|
|
|
82
|
-
Codebase utilities analyze, test, and improve code quality using AI reasoning.
|
|
106
|
+
Codebase utilities analyze, test, and improve code quality using AI reasoning.
|
|
83
107
|
|
|
84
|
-
- [scan-js](./src/chains/scan-js) -
|
|
85
|
-
- [test](./src/chains/test) -
|
|
86
|
-
- [test-advice](./src/chains/test-advice) -
|
|
108
|
+
- [scan-js](./src/chains/scan-js) - Examine JavaScript for patterns, anti-patterns, and potential issues
|
|
109
|
+
- [test](./src/chains/test) - Generate test cases covering happy paths, edge cases, and error conditions
|
|
110
|
+
- [test-advice](./src/chains/test-advice) - Identify untested code paths and suggest test scenarios
|
|
87
111
|
|
|
88
112
|
## Library Helpers
|
|
89
113
|
|
|
90
|
-
|
|
91
|
-
- [prompt-cache](./src/lib/prompt-cache) - cache prompts and responses
|
|
92
|
-
- [retry](./src/lib/retry) - retry asynchronous calls
|
|
93
|
-
- [search-best-first](./src/lib/search-best-first) - best-first search algorithm
|
|
94
|
-
- [search-js-files](./src/lib/search-js-files) - scan JavaScript sources
|
|
95
|
-
- [combinations](./src/lib/combinations) - generate array combinations
|
|
96
|
-
- [shorten-text](./src/lib/shorten-text) - shorten text using a model
|
|
97
|
-
- [strip-numeric](./src/lib/strip-numeric) - remove non-digit characters
|
|
98
|
-
- [strip-response](./src/lib/strip-response) - clean up model responses
|
|
99
|
-
- [to-bool](./src/lib/to-bool) - parse text to boolean
|
|
100
|
-
- [to-enum](./src/lib/to-enum) - parse text to enum values
|
|
101
|
-
- [to-number](./src/lib/to-number) - parse text to numbers
|
|
102
|
-
- [to-number-with-units](./src/lib/to-number-with-units) - parse numbers with units
|
|
103
|
-
- [to-date](./src/lib/to-date) - parse text to JavaScript Date objects
|
|
104
|
-
- [transcribe](./src/lib/transcribe) - microphone transcription via Whisper
|
|
105
|
-
|
|
106
|
-
## Example: Intelligent Customer Support System
|
|
107
|
-
|
|
108
|
-
This example shows how verblets enable building systems that understand context, make nuanced decisions, and adapt to complex real-world scenarios - capabilities that would be nearly impossible with traditional programming approaches.
|
|
109
|
-
|
|
110
|
-
```javascript
|
|
111
|
-
import bulkMap from './src/chains/bulk-map/index.js';
|
|
112
|
-
import list from './src/chains/list/index.js';
|
|
113
|
-
import {
|
|
114
|
-
anonymize,
|
|
115
|
-
bool,
|
|
116
|
-
enum,
|
|
117
|
-
intent,
|
|
118
|
-
listFilter,
|
|
119
|
-
questions,
|
|
120
|
-
sort,
|
|
121
|
-
toObject,
|
|
122
|
-
sentiment,
|
|
123
|
-
bulkScore
|
|
124
|
-
} from 'verblets';
|
|
125
|
-
|
|
126
|
-
// Intelligent customer support system that handles complex, contextual requests
|
|
127
|
-
async function handleCustomerRequest(message, history, catalog) {
|
|
128
|
-
const customerIntent = await intent({
|
|
129
|
-
text: message,
|
|
130
|
-
operations: [
|
|
131
|
-
{ name: 'refund-request', parameters: { reason: 'string', orderNumber: 'string?' } },
|
|
132
|
-
{ name: 'product-inquiry', parameters: { productType: 'string', feature: 'string?' } },
|
|
133
|
-
{ name: 'technical-support', parameters: { issue: 'string', urgency: 'string' } },
|
|
134
|
-
{ name: 'complaint', parameters: { category: 'string', severity: 'string' } }
|
|
135
|
-
]
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
const emotion = await sentiment(message);
|
|
139
|
-
const urgent = await bool(`Is this urgent? ${message}`);
|
|
140
|
-
|
|
141
|
-
const strategy = await enum(message, {
|
|
142
|
-
immediate_escalation: 'Customer is very upset, escalate to human agent',
|
|
143
|
-
detailed_help: 'Customer needs comprehensive assistance',
|
|
144
|
-
quick_resolution: 'Simple issue that can be resolved quickly',
|
|
145
|
-
educational: 'Customer needs to understand how something works'
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
const followUpQuestions = await questions(
|
|
149
|
-
`Customer says: "${message}". What should we ask to help them better?`
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
const candidates = await listFilter(
|
|
153
|
-
catalog,
|
|
154
|
-
`Products that might solve: ${
|
|
155
|
-
customerIntent.parameters.issue || customerIntent.parameters.productType
|
|
156
|
-
}`
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
const scores = await bulkScore(candidates, 'resolution likelihood');
|
|
160
|
-
const prioritized = await sort(candidates, `by likelihood score ${scores.join(', ')}`);
|
|
161
|
-
|
|
162
|
-
const bulletPoints = await bulkMap(
|
|
163
|
-
prioritized.map(p => p.name),
|
|
164
|
-
'Write a friendly one-line apology referencing <list>.'
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
const sampleReplies = await list('3 reassuring follow-up messages for this customer');
|
|
168
|
-
|
|
169
|
-
const caseSummary = await anonymize(
|
|
170
|
-
`Customer ${customerIntent.intent.operation}: ${message}.
|
|
171
|
-
History: ${history}. Resolution: ${prioritized[0]}`
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
const response = await toObject(
|
|
175
|
-
`
|
|
176
|
-
Customer needs ${customerIntent.intent.operation} help.
|
|
177
|
-
They are ${emotion} and ${urgent ? 'urgent' : 'not urgent'}.
|
|
178
|
-
Best approach: ${strategy}.
|
|
179
|
-
Top solution: ${prioritized[0]?.name}
|
|
180
|
-
`,
|
|
181
|
-
{
|
|
182
|
-
type: 'object',
|
|
183
|
-
properties: {
|
|
184
|
-
intent: { type: 'string' },
|
|
185
|
-
urgency: { type: 'string' },
|
|
186
|
-
emotion: { type: 'string' },
|
|
187
|
-
strategy: { type: 'string' },
|
|
188
|
-
recommendedSolution: { type: 'string' },
|
|
189
|
-
followUpQuestions: { type: 'array' }
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
);
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
return {
|
|
196
|
-
...response,
|
|
197
|
-
followUpQuestions: followUpQuestions.slice(0, 3),
|
|
198
|
-
anonymizedCase: caseSummary,
|
|
199
|
-
bulletPoints,
|
|
200
|
-
sampleReplies
|
|
201
|
-
};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// Usage: Handle a complex customer scenario
|
|
205
|
-
const result = await handleCustomerRequest(
|
|
206
|
-
"I'm really frustrated! I ordered your premium headphones 2 weeks ago for my daughter's birthday tomorrow and they still haven't arrived. The tracking says 'processing' but I paid for 2-day shipping. This is completely unacceptable and I want my money back immediately!",
|
|
207
|
-
'Previous orders: 3 successful deliveries, 1 late delivery complaint resolved',
|
|
208
|
-
[
|
|
209
|
-
{
|
|
210
|
-
name: 'Premium Wireless Headphones',
|
|
211
|
-
category: 'audio',
|
|
212
|
-
features: ['noise-canceling', 'wireless']
|
|
213
|
-
},
|
|
214
|
-
{ name: 'Express Shipping Upgrade', category: 'service', features: ['priority', 'tracking'] },
|
|
215
|
-
{ name: 'Gift Card', category: 'compensation', features: ['flexible', 'immediate'] }
|
|
216
|
-
]
|
|
217
|
-
);
|
|
218
|
-
|
|
219
|
-
/* Returns something like:
|
|
220
|
-
{
|
|
221
|
-
intent: "refund-request",
|
|
222
|
-
urgency: "high",
|
|
223
|
-
emotion: "frustrated",
|
|
224
|
-
strategy: "immediate_escalation",
|
|
225
|
-
recommendedSolution: "Express Shipping Upgrade",
|
|
226
|
-
followUpQuestions: [
|
|
227
|
-
"What's your order number so I can track this immediately?",
|
|
228
|
-
"Would you like us to expedite a replacement for tomorrow delivery?",
|
|
229
|
-
"How can we make this right for your daughter's birthday?"
|
|
230
|
-
],
|
|
231
|
-
anonymizedCase: "Customer refund-request: Customer frustrated about delayed premium headphones order for child's birthday..."
|
|
232
|
-
bulletPoints: ["Apologies for the delay on Premium Wireless Headphones", ...],
|
|
233
|
-
sampleReplies: ["We're monitoring shipping updates...", ...]
|
|
234
|
-
}
|
|
235
|
-
*/
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
This system demonstrates capabilities that would require thousands of lines of traditional code and extensive machine learning expertise:
|
|
239
|
-
|
|
240
|
-
- **Contextual understanding** of customer emotions and intent
|
|
241
|
-
- **Dynamic decision making** based on multiple factors
|
|
242
|
-
- **Adaptive questioning** that changes based on the situation
|
|
243
|
-
- **Intelligent prioritization** of solutions
|
|
244
|
-
- **Privacy-aware data handling** for compliance
|
|
245
|
-
- **Structured output** that integrates with existing systems
|
|
114
|
+
Helpers support higher-level operations. They make no LLM calls and are often synchronous.
|
|
246
115
|
|
|
116
|
+
- [chatgpt](./src/lib/chatgpt) - OpenAI ChatGPT wrapper
|
|
117
|
+
- [prompt-cache](./src/lib/prompt-cache) - Cache prompts and responses
|
|
118
|
+
- [retry](./src/lib/retry) - Retry asynchronous calls
|
|
119
|
+
- [ring-buffer](./src/lib/ring-buffer) - Circular buffer implementation for running LLMs on streams of data
|
|
247
120
|
|
|
248
121
|
## Contributing
|
|
249
122
|
|
|
250
|
-
Help us explore what's possible when we
|
|
123
|
+
Help us explore what's possible when we extend software primitives with language model intelligence.
|
|
251
124
|
|
|
252
125
|
## License
|
|
253
126
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { ag as a } from "./shared-C6kPWghF.js";
|
|
2
|
+
import { E as r, a3 as i, f as n, F as o, l as c, a as m, G as l, H as p, e as u, I as g, k as d, g as f, a as h, m as b, o as y, J as v, K as x, L as T, p as S, i as k, a4 as B, a5 as P, q as j, M as C, t as E, N as M, u as O, v as V, w as q, a6 as w, x as z, O as A, y as F, z as G, a7 as I, a8 as L, A as R, P as U, Q as W, n as D, h as H, R as J, a8 as K, S as N, ab as Q, ae as X, T as Y, r as Z, U as _, ac as $, ad as aa, j as sa, V as ea, af as ta, B as ra, a9 as ia, s as na, aa as oa, W as ca, C as ma, X as la, Y as pa, Z as ua, D as ga, _ as da, $ as fa, a0 as ha, a1 as ba, a2 as ya } from "./shared-C6kPWghF.js";
|
|
3
|
+
a();
|
|
4
|
+
export {
|
|
5
|
+
r as anonymize,
|
|
6
|
+
i as auto,
|
|
7
|
+
n as bool,
|
|
8
|
+
o as categorySamples,
|
|
9
|
+
c as centralTendency,
|
|
10
|
+
m as chatGPT,
|
|
11
|
+
l as collectTerms,
|
|
12
|
+
p as commonalities,
|
|
13
|
+
u as constants,
|
|
14
|
+
g as conversation,
|
|
15
|
+
d as createScale,
|
|
16
|
+
f as date,
|
|
17
|
+
h as default,
|
|
18
|
+
b as detectPatterns,
|
|
19
|
+
y as detectThreshold,
|
|
20
|
+
v as disambiguate,
|
|
21
|
+
x as dismantle,
|
|
22
|
+
T as documentShrink,
|
|
23
|
+
S as entities,
|
|
24
|
+
k as enums,
|
|
25
|
+
B as expect,
|
|
26
|
+
P as expectChain,
|
|
27
|
+
j as extractBlocks,
|
|
28
|
+
C as fillMissing,
|
|
29
|
+
E as filter,
|
|
30
|
+
M as filterAmbiguous,
|
|
31
|
+
O as find,
|
|
32
|
+
V as glossary,
|
|
33
|
+
q as group,
|
|
34
|
+
w as intent,
|
|
35
|
+
z as intersections,
|
|
36
|
+
A as join,
|
|
37
|
+
F as list,
|
|
38
|
+
G as listExpand,
|
|
39
|
+
I as llmLogger,
|
|
40
|
+
L as makePrompt,
|
|
41
|
+
R as map,
|
|
42
|
+
U as name,
|
|
43
|
+
W as nameSimilarTo,
|
|
44
|
+
D as number,
|
|
45
|
+
H as numberWithUnits,
|
|
46
|
+
J as people,
|
|
47
|
+
K as phailForge,
|
|
48
|
+
N as popReference,
|
|
49
|
+
Q as promptCache,
|
|
50
|
+
X as prompts,
|
|
51
|
+
Y as questions,
|
|
52
|
+
Z as reduce,
|
|
53
|
+
_ as relations,
|
|
54
|
+
$ as retry,
|
|
55
|
+
aa as ringBuffer,
|
|
56
|
+
sa as scale,
|
|
57
|
+
ea as schemaOrg,
|
|
58
|
+
ta as schemas,
|
|
59
|
+
ra as score,
|
|
60
|
+
ia as sentiment,
|
|
61
|
+
na as services,
|
|
62
|
+
oa as setInterval,
|
|
63
|
+
ca as socratic,
|
|
64
|
+
ma as sort,
|
|
65
|
+
la as split,
|
|
66
|
+
pa as summaryMap,
|
|
67
|
+
ua as tagVocabulary,
|
|
68
|
+
ga as tags,
|
|
69
|
+
da as themes,
|
|
70
|
+
fa as timeline,
|
|
71
|
+
ha as toObject,
|
|
72
|
+
ba as truncate,
|
|
73
|
+
ya as veiledVariants
|
|
74
|
+
};
|