semantic-primitives 0.1.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/LICENSE +201 -0
- package/README.md +449 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25016 -0
- package/dist/llm/client.d.ts +82 -0
- package/dist/llm/client.d.ts.map +1 -0
- package/dist/llm/index.d.ts +11 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/providers/anthropic.d.ts +13 -0
- package/dist/llm/providers/anthropic.d.ts.map +1 -0
- package/dist/llm/providers/google.d.ts +13 -0
- package/dist/llm/providers/google.d.ts.map +1 -0
- package/dist/llm/providers/index.d.ts +7 -0
- package/dist/llm/providers/index.d.ts.map +1 -0
- package/dist/llm/providers/openai.d.ts +13 -0
- package/dist/llm/providers/openai.d.ts.map +1 -0
- package/dist/llm/types.d.ts +91 -0
- package/dist/llm/types.d.ts.map +1 -0
- package/dist/primitives/bigint/bigint.d.ts +197 -0
- package/dist/primitives/bigint/bigint.d.ts.map +1 -0
- package/dist/primitives/bigint/index.d.ts +7 -0
- package/dist/primitives/bigint/index.d.ts.map +1 -0
- package/dist/primitives/bigint/prompts.d.ts +37 -0
- package/dist/primitives/bigint/prompts.d.ts.map +1 -0
- package/dist/primitives/boolean/boolean.d.ts +194 -0
- package/dist/primitives/boolean/boolean.d.ts.map +1 -0
- package/dist/primitives/boolean/evals/from.evals.d.ts +7 -0
- package/dist/primitives/boolean/evals/from.evals.d.ts.map +1 -0
- package/dist/primitives/boolean/evals/index.d.ts +5 -0
- package/dist/primitives/boolean/evals/index.d.ts.map +1 -0
- package/dist/primitives/boolean/index.d.ts +6 -0
- package/dist/primitives/boolean/index.d.ts.map +1 -0
- package/dist/primitives/boolean/prompts.d.ts +29 -0
- package/dist/primitives/boolean/prompts.d.ts.map +1 -0
- package/dist/primitives/index.d.ts +14 -0
- package/dist/primitives/index.d.ts.map +1 -0
- package/dist/primitives/null/index.d.ts +6 -0
- package/dist/primitives/null/index.d.ts.map +1 -0
- package/dist/primitives/null/null.d.ts +181 -0
- package/dist/primitives/null/null.d.ts.map +1 -0
- package/dist/primitives/null/prompts.d.ts +39 -0
- package/dist/primitives/null/prompts.d.ts.map +1 -0
- package/dist/primitives/number/index.d.ts +6 -0
- package/dist/primitives/number/index.d.ts.map +1 -0
- package/dist/primitives/number/number.d.ts +154 -0
- package/dist/primitives/number/number.d.ts.map +1 -0
- package/dist/primitives/number/number.prompts.d.ts +53 -0
- package/dist/primitives/number/number.prompts.d.ts.map +1 -0
- package/dist/primitives/string/evals/classify.evals.d.ts +7 -0
- package/dist/primitives/string/evals/classify.evals.d.ts.map +1 -0
- package/dist/primitives/string/evals/index.d.ts +6 -0
- package/dist/primitives/string/evals/index.d.ts.map +1 -0
- package/dist/primitives/string/evals/semanticallyEquals.evals.d.ts +7 -0
- package/dist/primitives/string/evals/semanticallyEquals.evals.d.ts.map +1 -0
- package/dist/primitives/string/index.d.ts +206 -0
- package/dist/primitives/string/index.d.ts.map +1 -0
- package/dist/primitives/string/string.prompts.d.ts +45 -0
- package/dist/primitives/string/string.prompts.d.ts.map +1 -0
- package/dist/primitives/symbol/index.d.ts +6 -0
- package/dist/primitives/symbol/index.d.ts.map +1 -0
- package/dist/primitives/symbol/symbol.d.ts +176 -0
- package/dist/primitives/symbol/symbol.d.ts.map +1 -0
- package/dist/primitives/symbol/symbol.prompts.d.ts +53 -0
- package/dist/primitives/symbol/symbol.prompts.d.ts.map +1 -0
- package/dist/primitives/undefined/index.d.ts +5 -0
- package/dist/primitives/undefined/index.d.ts.map +1 -0
- package/dist/primitives/undefined/prompts.d.ts +40 -0
- package/dist/primitives/undefined/prompts.d.ts.map +1 -0
- package/dist/primitives/undefined/undefined.d.ts +216 -0
- package/dist/primitives/undefined/undefined.d.ts.map +1 -0
- package/dist/primitives/void/index.d.ts +5 -0
- package/dist/primitives/void/index.d.ts.map +1 -0
- package/dist/primitives/void/prompts.d.ts +37 -0
- package/dist/primitives/void/prompts.d.ts.map +1 -0
- package/dist/primitives/void/void.d.ts +172 -0
- package/dist/primitives/void/void.d.ts.map +1 -0
- package/dist/shared/base-classes.d.ts +331 -0
- package/dist/shared/base-classes.d.ts.map +1 -0
- package/dist/shared/eval-types.d.ts +82 -0
- package/dist/shared/eval-types.d.ts.map +1 -0
- package/dist/shared/index.d.ts +25 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/interfaces.d.ts +799 -0
- package/dist/shared/interfaces.d.ts.map +1 -0
- package/dist/shared/types.d.ts +335 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/types/array/array.d.ts +250 -0
- package/dist/types/array/array.d.ts.map +1 -0
- package/dist/types/array/index.d.ts +6 -0
- package/dist/types/array/index.d.ts.map +1 -0
- package/dist/types/array/prompts.d.ts +63 -0
- package/dist/types/array/prompts.d.ts.map +1 -0
- package/dist/types/blob-file/blob.d.ts +188 -0
- package/dist/types/blob-file/blob.d.ts.map +1 -0
- package/dist/types/blob-file/file.d.ts +144 -0
- package/dist/types/blob-file/file.d.ts.map +1 -0
- package/dist/types/blob-file/index.d.ts +8 -0
- package/dist/types/blob-file/index.d.ts.map +1 -0
- package/dist/types/blob-file/prompts.d.ts +101 -0
- package/dist/types/blob-file/prompts.d.ts.map +1 -0
- package/dist/types/bun/bun.d.ts +266 -0
- package/dist/types/bun/bun.d.ts.map +1 -0
- package/dist/types/bun/index.d.ts +7 -0
- package/dist/types/bun/index.d.ts.map +1 -0
- package/dist/types/bun/prompts.d.ts +93 -0
- package/dist/types/bun/prompts.d.ts.map +1 -0
- package/dist/types/callable/callable.d.ts +200 -0
- package/dist/types/callable/callable.d.ts.map +1 -0
- package/dist/types/callable/index.d.ts +6 -0
- package/dist/types/callable/index.d.ts.map +1 -0
- package/dist/types/callable/prompts.d.ts +45 -0
- package/dist/types/callable/prompts.d.ts.map +1 -0
- package/dist/types/constructable/constructable.d.ts +150 -0
- package/dist/types/constructable/constructable.d.ts.map +1 -0
- package/dist/types/constructable/index.d.ts +5 -0
- package/dist/types/constructable/index.d.ts.map +1 -0
- package/dist/types/constructable/prompts.d.ts +41 -0
- package/dist/types/constructable/prompts.d.ts.map +1 -0
- package/dist/types/date/date.d.ts +258 -0
- package/dist/types/date/date.d.ts.map +1 -0
- package/dist/types/date/index.d.ts +6 -0
- package/dist/types/date/index.d.ts.map +1 -0
- package/dist/types/date/prompts.d.ts +93 -0
- package/dist/types/date/prompts.d.ts.map +1 -0
- package/dist/types/error/error.d.ts +191 -0
- package/dist/types/error/error.d.ts.map +1 -0
- package/dist/types/error/index.d.ts +6 -0
- package/dist/types/error/index.d.ts.map +1 -0
- package/dist/types/error/prompts.d.ts +49 -0
- package/dist/types/error/prompts.d.ts.map +1 -0
- package/dist/types/event-emitter/event-emitter.d.ts +230 -0
- package/dist/types/event-emitter/event-emitter.d.ts.map +1 -0
- package/dist/types/event-emitter/index.d.ts +6 -0
- package/dist/types/event-emitter/index.d.ts.map +1 -0
- package/dist/types/event-emitter/prompts.d.ts +51 -0
- package/dist/types/event-emitter/prompts.d.ts.map +1 -0
- package/dist/types/fetch/headers.d.ts +126 -0
- package/dist/types/fetch/headers.d.ts.map +1 -0
- package/dist/types/fetch/index.d.ts +9 -0
- package/dist/types/fetch/index.d.ts.map +1 -0
- package/dist/types/fetch/prompts.d.ts +139 -0
- package/dist/types/fetch/prompts.d.ts.map +1 -0
- package/dist/types/fetch/request.d.ts +188 -0
- package/dist/types/fetch/request.d.ts.map +1 -0
- package/dist/types/fetch/response.d.ts +155 -0
- package/dist/types/fetch/response.d.ts.map +1 -0
- package/dist/types/form-data/form-data.d.ts +277 -0
- package/dist/types/form-data/form-data.d.ts.map +1 -0
- package/dist/types/form-data/index.d.ts +7 -0
- package/dist/types/form-data/index.d.ts.map +1 -0
- package/dist/types/form-data/prompts.d.ts +80 -0
- package/dist/types/form-data/prompts.d.ts.map +1 -0
- package/dist/types/index.d.ts +29 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/map/index.d.ts +6 -0
- package/dist/types/map/index.d.ts.map +1 -0
- package/dist/types/map/map.d.ts +204 -0
- package/dist/types/map/map.d.ts.map +1 -0
- package/dist/types/map/prompts.d.ts +56 -0
- package/dist/types/map/prompts.d.ts.map +1 -0
- package/dist/types/never/index.d.ts +5 -0
- package/dist/types/never/index.d.ts.map +1 -0
- package/dist/types/never/never.d.ts +220 -0
- package/dist/types/never/never.d.ts.map +1 -0
- package/dist/types/never/prompts.d.ts +50 -0
- package/dist/types/never/prompts.d.ts.map +1 -0
- package/dist/types/object/index.d.ts +6 -0
- package/dist/types/object/index.d.ts.map +1 -0
- package/dist/types/object/object.d.ts +162 -0
- package/dist/types/object/object.d.ts.map +1 -0
- package/dist/types/object/prompts.d.ts +55 -0
- package/dist/types/object/prompts.d.ts.map +1 -0
- package/dist/types/object-literal/index.d.ts +6 -0
- package/dist/types/object-literal/index.d.ts.map +1 -0
- package/dist/types/object-literal/object-literal.d.ts +223 -0
- package/dist/types/object-literal/object-literal.d.ts.map +1 -0
- package/dist/types/object-literal/prompts.d.ts +49 -0
- package/dist/types/object-literal/prompts.d.ts.map +1 -0
- package/dist/types/promise/index.d.ts +6 -0
- package/dist/types/promise/index.d.ts.map +1 -0
- package/dist/types/promise/promise.d.ts +240 -0
- package/dist/types/promise/promise.d.ts.map +1 -0
- package/dist/types/promise/prompts.d.ts +45 -0
- package/dist/types/promise/prompts.d.ts.map +1 -0
- package/dist/types/record/index.d.ts +5 -0
- package/dist/types/record/index.d.ts.map +1 -0
- package/dist/types/record/prompts.d.ts +45 -0
- package/dist/types/record/prompts.d.ts.map +1 -0
- package/dist/types/record/record.d.ts +179 -0
- package/dist/types/record/record.d.ts.map +1 -0
- package/dist/types/regexp/index.d.ts +7 -0
- package/dist/types/regexp/index.d.ts.map +1 -0
- package/dist/types/regexp/prompts.d.ts +56 -0
- package/dist/types/regexp/prompts.d.ts.map +1 -0
- package/dist/types/regexp/regexp.d.ts +160 -0
- package/dist/types/regexp/regexp.d.ts.map +1 -0
- package/dist/types/set/index.d.ts +6 -0
- package/dist/types/set/index.d.ts.map +1 -0
- package/dist/types/set/prompts.d.ts +60 -0
- package/dist/types/set/prompts.d.ts.map +1 -0
- package/dist/types/set/set.d.ts +261 -0
- package/dist/types/set/set.d.ts.map +1 -0
- package/dist/types/streams/index.d.ts +8 -0
- package/dist/types/streams/index.d.ts.map +1 -0
- package/dist/types/streams/prompts.d.ts +53 -0
- package/dist/types/streams/prompts.d.ts.map +1 -0
- package/dist/types/streams/readable-stream.d.ts +148 -0
- package/dist/types/streams/readable-stream.d.ts.map +1 -0
- package/dist/types/streams/transform-stream.d.ts +67 -0
- package/dist/types/streams/transform-stream.d.ts.map +1 -0
- package/dist/types/streams/writable-stream.d.ts +111 -0
- package/dist/types/streams/writable-stream.d.ts.map +1 -0
- package/dist/types/text-codec/index.d.ts +12 -0
- package/dist/types/text-codec/index.d.ts.map +1 -0
- package/dist/types/text-codec/prompts.d.ts +79 -0
- package/dist/types/text-codec/prompts.d.ts.map +1 -0
- package/dist/types/text-codec/text-codec.d.ts +305 -0
- package/dist/types/text-codec/text-codec.d.ts.map +1 -0
- package/dist/types/tuple/index.d.ts +6 -0
- package/dist/types/tuple/index.d.ts.map +1 -0
- package/dist/types/tuple/prompts.d.ts +41 -0
- package/dist/types/tuple/prompts.d.ts.map +1 -0
- package/dist/types/tuple/tuple.d.ts +221 -0
- package/dist/types/tuple/tuple.d.ts.map +1 -0
- package/dist/types/unknown/index.d.ts +5 -0
- package/dist/types/unknown/index.d.ts.map +1 -0
- package/dist/types/unknown/prompts.d.ts +45 -0
- package/dist/types/unknown/prompts.d.ts.map +1 -0
- package/dist/types/unknown/unknown.d.ts +220 -0
- package/dist/types/unknown/unknown.d.ts.map +1 -0
- package/dist/types/url/index.d.ts +7 -0
- package/dist/types/url/index.d.ts.map +1 -0
- package/dist/types/url/prompts.d.ts +93 -0
- package/dist/types/url/prompts.d.ts.map +1 -0
- package/dist/types/url/url.d.ts +270 -0
- package/dist/types/url/url.d.ts.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SemanticNumber - LLM-enhanced number type with semantic understanding
|
|
3
|
+
*
|
|
4
|
+
* Extends the native JavaScript number with semantic operations including:
|
|
5
|
+
* - Natural language parsing
|
|
6
|
+
* - Context-aware equality comparison
|
|
7
|
+
* - Reasonableness validation
|
|
8
|
+
* - Unit inference and conversion
|
|
9
|
+
* - Human-friendly descriptions
|
|
10
|
+
*
|
|
11
|
+
* Implements shared interfaces:
|
|
12
|
+
* - Semantic<number> - Base semantic wrapper
|
|
13
|
+
* - Comparable<number | SemanticNumber> - Semantic equality comparison
|
|
14
|
+
* - ContextValidatable - Reasonableness checks
|
|
15
|
+
* - UnitConvertible<SemanticNumber> - Unit conversion
|
|
16
|
+
* - Describable - Human-friendly descriptions
|
|
17
|
+
*/
|
|
18
|
+
import type { LLMConfig, Message } from '../../llm/types.ts';
|
|
19
|
+
import type { SemanticEqualsResult, ReasonableResult, InferUnitResult } from '../../shared/types.ts';
|
|
20
|
+
import type { Semantic, Comparable, ContextValidatable, UnitConvertible, Describable } from '../../shared/interfaces.ts';
|
|
21
|
+
export type { SemanticEqualsResult, ReasonableResult, InferUnitResult, } from '../../shared/types.ts';
|
|
22
|
+
/** Options for semantic equality comparison */
|
|
23
|
+
export interface SemanticEqualsOptions {
|
|
24
|
+
tolerance?: 'exact' | 'approximate' | number;
|
|
25
|
+
}
|
|
26
|
+
/** LLM client interface for dependency injection (compatible with shared LLMClientInterface) */
|
|
27
|
+
export interface LLMClientInterface {
|
|
28
|
+
chat(options: {
|
|
29
|
+
messages: Message[];
|
|
30
|
+
systemPrompt?: string;
|
|
31
|
+
} & LLMConfig): Promise<{
|
|
32
|
+
content: string;
|
|
33
|
+
}>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* SemanticNumber class
|
|
37
|
+
* Wraps a numeric value with LLM-powered semantic operations
|
|
38
|
+
*
|
|
39
|
+
* Implements:
|
|
40
|
+
* - Semantic<number> - valueOf() returns the numeric value
|
|
41
|
+
* - Comparable<number | SemanticNumber> - semanticallyEquals() for comparison
|
|
42
|
+
* - ContextValidatable - isReasonable() for context-aware validation
|
|
43
|
+
* - UnitConvertible<SemanticNumber> - convert() and inferUnit()
|
|
44
|
+
* - Describable - describe() for human-friendly descriptions
|
|
45
|
+
*/
|
|
46
|
+
export declare class SemanticNumber implements Semantic<number>, Comparable<number | SemanticNumber>, ContextValidatable, UnitConvertible<SemanticNumber>, Describable {
|
|
47
|
+
private readonly _value;
|
|
48
|
+
private readonly _llmClient;
|
|
49
|
+
private readonly _llmConfig?;
|
|
50
|
+
/**
|
|
51
|
+
* Create a SemanticNumber instance
|
|
52
|
+
* @param value - The numeric value to wrap
|
|
53
|
+
* @param llmClient - Optional LLM client for dependency injection (useful for testing)
|
|
54
|
+
* @param llmConfig - Optional LLM configuration
|
|
55
|
+
*/
|
|
56
|
+
constructor(value: number, llmClient?: LLMClientInterface, llmConfig?: LLMConfig);
|
|
57
|
+
/**
|
|
58
|
+
* Parse a number from natural language or formatted string
|
|
59
|
+
* Understands words, abbreviations, and localized formats
|
|
60
|
+
*
|
|
61
|
+
* @param input - Natural language or formatted number string
|
|
62
|
+
* @param context - Optional context for interpretation
|
|
63
|
+
* @param llmClient - Optional LLM client for dependency injection
|
|
64
|
+
* @param llmConfig - Optional LLM configuration
|
|
65
|
+
* @returns SemanticNumber instance
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* SemanticNumber.from("twenty-five") // 25
|
|
69
|
+
* SemanticNumber.from("2.5k") // 2500
|
|
70
|
+
* SemanticNumber.from("$1,234.56") // 1234.56
|
|
71
|
+
* SemanticNumber.from("about a dozen") // 12
|
|
72
|
+
*/
|
|
73
|
+
static from(input: string, context?: string, llmClient?: LLMClientInterface, llmConfig?: LLMConfig): Promise<SemanticNumber>;
|
|
74
|
+
/**
|
|
75
|
+
* Check if two numbers are semantically equivalent
|
|
76
|
+
* Considers approximate values and contextual equivalence
|
|
77
|
+
*
|
|
78
|
+
* @param other - Number to compare with
|
|
79
|
+
* @param options - Comparison options including tolerance
|
|
80
|
+
* @returns Equivalence result with confidence
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* SemanticNumber.from(100).semanticallyEquals(99, { tolerance: "approximate" })
|
|
84
|
+
* // { equivalent: true, confidence: 0.95 }
|
|
85
|
+
*/
|
|
86
|
+
semanticallyEquals(other: number | SemanticNumber, options?: SemanticEqualsOptions): Promise<SemanticEqualsResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Validate if the number is reasonable for a given context
|
|
89
|
+
*
|
|
90
|
+
* @param context - What this number represents
|
|
91
|
+
* @returns Validation result with explanation
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* SemanticNumber.from(150).isReasonable("human age")
|
|
95
|
+
* // { reasonable: false, explanation: "Human age rarely exceeds 120 years" }
|
|
96
|
+
*/
|
|
97
|
+
isReasonable(context: string): Promise<ReasonableResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Infer the likely unit for this number based on context
|
|
100
|
+
*
|
|
101
|
+
* @param context - Context describing what this number represents
|
|
102
|
+
* @returns Inferred unit with confidence
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* SemanticNumber.from(72).inferUnit("body temperature")
|
|
106
|
+
* // { unit: "fahrenheit", confidence: 0.85 }
|
|
107
|
+
*/
|
|
108
|
+
inferUnit(context: string): Promise<InferUnitResult>;
|
|
109
|
+
/**
|
|
110
|
+
* Convert to a different unit with semantic understanding
|
|
111
|
+
*
|
|
112
|
+
* @param toUnit - Target unit
|
|
113
|
+
* @param fromUnit - Source unit (optional, can be inferred)
|
|
114
|
+
* @returns Converted number
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* SemanticNumber.from(100).convert("celsius", "fahrenheit")
|
|
118
|
+
* // SemanticNumber(37.78)
|
|
119
|
+
*/
|
|
120
|
+
convert(toUnit: string, fromUnit?: string): Promise<SemanticNumber>;
|
|
121
|
+
/**
|
|
122
|
+
* Get a human-friendly description of the number's magnitude
|
|
123
|
+
*
|
|
124
|
+
* @param context - Optional context for more relevant description
|
|
125
|
+
* @returns Human-readable description
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* SemanticNumber.from(1000000).describe()
|
|
129
|
+
* // "one million"
|
|
130
|
+
*/
|
|
131
|
+
describe(context?: string): Promise<string>;
|
|
132
|
+
/**
|
|
133
|
+
* Get the raw numeric value
|
|
134
|
+
* @returns The underlying number
|
|
135
|
+
*/
|
|
136
|
+
valueOf(): number;
|
|
137
|
+
/**
|
|
138
|
+
* Explain the number in a human-readable way.
|
|
139
|
+
* Implements Explainable interface.
|
|
140
|
+
*
|
|
141
|
+
* @param context - Optional context for the explanation
|
|
142
|
+
* @returns Human-readable explanation
|
|
143
|
+
*/
|
|
144
|
+
explain(context?: string): Promise<string>;
|
|
145
|
+
/**
|
|
146
|
+
* Convert to string
|
|
147
|
+
*/
|
|
148
|
+
toString(): string;
|
|
149
|
+
/**
|
|
150
|
+
* Convert to JSON
|
|
151
|
+
*/
|
|
152
|
+
toJSON(): number;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../src/primitives/number/number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,kBAAkB,EAClB,eAAe,EACf,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAiBpC,YAAY,EACV,oBAAoB,EACpB,gBAAgB,EAChB,eAAe,GAChB,MAAM,uBAAuB,CAAC;AAE/B,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,OAAO,GAAG,aAAa,GAAG,MAAM,CAAC;CAC9C;AAED,gGAAgG;AAChG,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,OAAO,EAAE;QAAE,QAAQ,EAAE,OAAO,EAAE,CAAC;QAAC,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,SAAS,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzG;AAED;;;;;;;;;;GAUG;AACH,qBAAa,cACX,YACE,QAAQ,CAAC,MAAM,CAAC,EAChB,UAAU,CAAC,MAAM,GAAG,cAAc,CAAC,EACnC,kBAAkB,EAClB,eAAe,CAAC,cAAc,CAAC,EAC/B,WAAW;IAEb,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAqB;IAChD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAY;IAExC;;;;;OAKG;gBAED,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,kBAAkB,EAC9B,SAAS,CAAC,EAAE,SAAS;IAOvB;;;;;;;;;;;;;;;OAeG;WACU,IAAI,CACf,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,MAAM,EAChB,SAAS,CAAC,EAAE,kBAAkB,EAC9B,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,cAAc,CAAC;IA0B1B;;;;;;;;;;;OAWG;IACG,kBAAkB,CACtB,KAAK,EAAE,MAAM,GAAG,cAAc,EAC9B,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IAkBhC;;;;;;;;;OASG;IACG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAc9D;;;;;;;;;OASG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAc1D;;;;;;;;;;OAUG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAuBzE;;;;;;;;;OASG;IACG,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBjD;;;OAGG;IACH,OAAO,IAAI,MAAM;IAIjB;;;;;;OAMG;IACG,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAIhD;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,MAAM,IAAI,MAAM;CAGjB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompts for SemanticNumber LLM operations
|
|
3
|
+
* These prompts are used for various semantic number operations that require LLM understanding
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* System prompt for number parsing operations
|
|
7
|
+
*/
|
|
8
|
+
export declare const PARSE_NUMBER_SYSTEM = "You are a number parsing assistant. Your task is to extract numeric values from natural language or formatted strings.\n\nRules:\n- Parse words (e.g., \"twenty-five\" -> 25)\n- Parse abbreviations (e.g., \"2.5k\" -> 2500, \"1M\" -> 1000000)\n- Parse formatted numbers (e.g., \"$1,234.56\" -> 1234.56)\n- Parse approximate terms (e.g., \"about a dozen\" -> 12, \"a few\" -> 3)\n- Handle fractions (e.g., \"half\" -> 0.5, \"a quarter\" -> 0.25)\n- Return null if the input cannot be parsed as a number\n\nAlways respond with valid JSON only.";
|
|
9
|
+
/**
|
|
10
|
+
* User prompt template for parsing numbers
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseNumberPrompt(input: string, context?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* System prompt for semantic equality comparison
|
|
15
|
+
*/
|
|
16
|
+
export declare const SEMANTIC_EQUALS_SYSTEM = "You are a number comparison assistant. Your task is to determine if two numbers are semantically equivalent based on context and tolerance.\n\nConsider:\n- Approximate equivalence when tolerance is \"approximate\"\n- Exact equivalence when tolerance is \"exact\"\n- Numeric tolerance when a number is provided\n- Context matters: in some domains small differences matter more than others\n\nAlways respond with valid JSON only.";
|
|
17
|
+
/**
|
|
18
|
+
* User prompt template for semantic equality
|
|
19
|
+
*/
|
|
20
|
+
export declare function semanticEqualsPrompt(value1: number, value2: number, tolerance: 'exact' | 'approximate' | number): string;
|
|
21
|
+
/**
|
|
22
|
+
* System prompt for reasonableness validation
|
|
23
|
+
*/
|
|
24
|
+
export declare const IS_REASONABLE_SYSTEM = "You are a validation assistant. Your task is to determine if a given number is reasonable for a specific context.\n\nConsider:\n- Physical constraints (e.g., human age rarely exceeds 120)\n- Logical constraints (e.g., quantities cannot be negative)\n- Domain-specific norms (e.g., typical salary ranges)\n- Common sense expectations\n\nAlways respond with valid JSON only.";
|
|
25
|
+
/**
|
|
26
|
+
* User prompt template for reasonableness check
|
|
27
|
+
*/
|
|
28
|
+
export declare function isReasonablePrompt(value: number, context: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* System prompt for unit inference
|
|
31
|
+
*/
|
|
32
|
+
export declare const INFER_UNIT_SYSTEM = "You are a unit inference assistant. Your task is to infer the most likely unit for a number based on its value and context.\n\nConsider:\n- The numeric value (e.g., 72 for body temperature suggests Fahrenheit in US)\n- The context provided (e.g., \"body temperature\", \"speed limit\")\n- Regional conventions (e.g., US uses Fahrenheit, Europe uses Celsius)\n- Domain-specific standards (e.g., scientific measurements)\n\nAlways respond with valid JSON only.";
|
|
33
|
+
/**
|
|
34
|
+
* User prompt template for unit inference
|
|
35
|
+
*/
|
|
36
|
+
export declare function inferUnitPrompt(value: number, context: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* System prompt for unit conversion
|
|
39
|
+
*/
|
|
40
|
+
export declare const CONVERT_UNIT_SYSTEM = "You are a unit conversion assistant. Your task is to convert numbers between different units.\n\nYou must:\n- Apply correct conversion formulas\n- Handle temperature conversions (C to F: multiply by 9/5 and add 32)\n- Handle length conversions (m to ft, km to mi, etc.)\n- Handle weight conversions (kg to lb, etc.)\n- Handle any other standard unit conversions\n\nAlways respond with valid JSON only.";
|
|
41
|
+
/**
|
|
42
|
+
* User prompt template for unit conversion
|
|
43
|
+
*/
|
|
44
|
+
export declare function convertUnitPrompt(value: number, fromUnit: string, toUnit: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* System prompt for number description
|
|
47
|
+
*/
|
|
48
|
+
export declare const DESCRIBE_NUMBER_SYSTEM = "You are a number description assistant. Your task is to provide human-friendly descriptions of numbers, explaining their magnitude in understandable terms.\n\nConsider:\n- Large numbers: use words like \"million\", \"billion\"\n- Time-based context: convert seconds to readable durations\n- Contextual comparisons: relate to familiar concepts\n- Keep descriptions concise but informative\n\nAlways respond with valid JSON only.";
|
|
49
|
+
/**
|
|
50
|
+
* User prompt template for describing numbers
|
|
51
|
+
*/
|
|
52
|
+
export declare function describeNumberPrompt(value: number, context?: string): string;
|
|
53
|
+
//# sourceMappingURL=number.prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"number.prompts.d.ts","sourceRoot":"","sources":["../../../src/primitives/number/number.prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB,giBAUK,CAAC;AAEtC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAQzE;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,gbAQE,CAAC;AAEtC;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,OAAO,GAAG,aAAa,GAAG,MAAM,GAC1C,MAAM,CAgBR;AAED;;GAEG;AACH,eAAO,MAAM,oBAAoB,yXAQI,CAAC;AAEtC;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQzE;AAED;;GAEG;AACH,eAAO,MAAM,iBAAiB,+cAQO,CAAC;AAEtC;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAQtE;AAED;;GAEG;AACH,eAAO,MAAM,mBAAmB,sZASK,CAAC;AAEtC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CASzF;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,gbAQE,CAAC;AAEtC;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ5E"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation dataset for SemanticString.classify()
|
|
3
|
+
* Tests classification of text into predefined categories
|
|
4
|
+
*/
|
|
5
|
+
import type { EvalDataset } from '../../../shared/eval-types.ts';
|
|
6
|
+
export declare const dataset: EvalDataset;
|
|
7
|
+
//# sourceMappingURL=classify.evals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"classify.evals.d.ts","sourceRoot":"","sources":["../../../../src/primitives/string/evals/classify.evals.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,eAAO,MAAM,OAAO,EAAE,WAmSrB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/primitives/string/evals/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Evaluation dataset for SemanticString.semanticallyEquals()
|
|
3
|
+
* Tests semantic comparison of strings for meaning equivalence
|
|
4
|
+
*/
|
|
5
|
+
import type { EvalDataset } from '../../../shared/eval-types.ts';
|
|
6
|
+
export declare const dataset: EvalDataset;
|
|
7
|
+
//# sourceMappingURL=semanticallyEquals.evals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semanticallyEquals.evals.d.ts","sourceRoot":"","sources":["../../../../src/primitives/string/evals/semanticallyEquals.evals.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAEjE,eAAO,MAAM,OAAO,EAAE,WA6VrB,CAAC"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SemanticString - LLM-enhanced string with semantic understanding
|
|
3
|
+
*
|
|
4
|
+
* Extends native string capabilities with AI-powered semantic operations
|
|
5
|
+
* including meaning-aware comparisons, classification, and analysis.
|
|
6
|
+
*
|
|
7
|
+
* Implements shared interfaces:
|
|
8
|
+
* - Semantic<string> - Base semantic wrapper
|
|
9
|
+
* - Comparable<string | SemanticString> - Semantic equality comparison
|
|
10
|
+
* - Validatable - Rule-based validation
|
|
11
|
+
* - Classifiable - Category classification
|
|
12
|
+
* - Summarizable - Text summarization
|
|
13
|
+
* - SensitivityDetectable - Sensitive data detection
|
|
14
|
+
*/
|
|
15
|
+
import type { LLMClient } from '../../llm/client.ts';
|
|
16
|
+
import type { SemanticEqualsResult, ClassifyResult, ValidateResult, DetectIntentResult, DetectLanguageResult, Correction } from '../../shared/types.ts';
|
|
17
|
+
import type { Semantic, Comparable, Validatable, Classifiable, Summarizable, SensitivityDetectable } from '../../shared/interfaces.ts';
|
|
18
|
+
export type { SemanticEqualsResult, ClassifyResult, ValidateResult, DetectIntentResult, DetectLanguageResult, Correction, } from '../../shared/types.ts';
|
|
19
|
+
/** Result of sensitive information detection (alias for SensitiveResult) */
|
|
20
|
+
export interface ContainsSensitiveResult {
|
|
21
|
+
hasSensitive: boolean;
|
|
22
|
+
types: string[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* SemanticString class - wraps a string with semantic capabilities
|
|
26
|
+
*
|
|
27
|
+
* Implements:
|
|
28
|
+
* - Semantic<string> - valueOf() returns the string value
|
|
29
|
+
* - Comparable<string | SemanticString> - semanticallyEquals() for comparison
|
|
30
|
+
* - Validatable - validate() for rule-based validation
|
|
31
|
+
* - Classifiable - classify() for categorization
|
|
32
|
+
* - Summarizable - summarize() for text summarization
|
|
33
|
+
* - SensitivityDetectable - containsSensitive() for PII detection
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const str = SemanticString.from("The meeting is cancelled");
|
|
38
|
+
* const result = await str.semanticallyEquals("Meeting has been called off");
|
|
39
|
+
* // { equivalent: true, confidence: 0.92 }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class SemanticString implements Semantic<string>, Comparable<string | SemanticString>, Validatable, Classifiable, Summarizable, SensitivityDetectable {
|
|
43
|
+
private readonly value;
|
|
44
|
+
private readonly client;
|
|
45
|
+
private constructor();
|
|
46
|
+
/**
|
|
47
|
+
* Create a SemanticString from a regular string
|
|
48
|
+
*/
|
|
49
|
+
static from(value: string, client?: LLMClient): SemanticString;
|
|
50
|
+
/**
|
|
51
|
+
* Get the underlying string value
|
|
52
|
+
*/
|
|
53
|
+
toString(): string;
|
|
54
|
+
/**
|
|
55
|
+
* Get the underlying string value
|
|
56
|
+
*/
|
|
57
|
+
valueOf(): string;
|
|
58
|
+
/**
|
|
59
|
+
* Get the length of the string
|
|
60
|
+
*/
|
|
61
|
+
get length(): number;
|
|
62
|
+
/**
|
|
63
|
+
* Check if two strings are semantically equivalent (same meaning).
|
|
64
|
+
* Understands synonyms, paraphrases, and different phrasings.
|
|
65
|
+
*
|
|
66
|
+
* @param other - String to compare with
|
|
67
|
+
* @param options - Comparison options
|
|
68
|
+
* @returns Equivalence result with confidence
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const str = SemanticString.from("purchase");
|
|
73
|
+
* await str.semanticallyEquals("buy");
|
|
74
|
+
* // { equivalent: true, confidence: 0.95 }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
semanticallyEquals(other: string | SemanticString, options?: {
|
|
78
|
+
threshold?: number;
|
|
79
|
+
context?: string;
|
|
80
|
+
}): Promise<SemanticEqualsResult>;
|
|
81
|
+
/**
|
|
82
|
+
* Classify the string into one of the provided categories.
|
|
83
|
+
* Uses semantic understanding to match meaning, not just keywords.
|
|
84
|
+
*
|
|
85
|
+
* @param categories - Array of category names to classify into
|
|
86
|
+
* @param context - Optional context to improve classification
|
|
87
|
+
* @returns Best matching category with confidence
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* ```ts
|
|
91
|
+
* const str = SemanticString.from("I can't log in to my account");
|
|
92
|
+
* await str.classify(["billing", "technical", "account", "general"]);
|
|
93
|
+
* // { category: "account", confidence: 0.89 }
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
classify(categories: string[], context?: string): Promise<ClassifyResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Extract specific types of information from the string.
|
|
99
|
+
*
|
|
100
|
+
* @param types - Types of entities to extract (e.g., "email", "date", "name")
|
|
101
|
+
* @returns Object mapping types to extracted values
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* const str = SemanticString.from("Contact John at john@example.com by Friday");
|
|
106
|
+
* await str.extract(["email", "name", "date"]);
|
|
107
|
+
* // { email: "john@example.com", name: "John", date: "Friday" }
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
extract(types: string[]): Promise<Record<string, string | string[] | null>>;
|
|
111
|
+
/**
|
|
112
|
+
* Validate the string against semantic rules (not just regex).
|
|
113
|
+
*
|
|
114
|
+
* @param rules - Natural language validation rules
|
|
115
|
+
* @returns Validation result with issues if any
|
|
116
|
+
*
|
|
117
|
+
* @example
|
|
118
|
+
* ```ts
|
|
119
|
+
* const str = SemanticString.from("Buy now!!!");
|
|
120
|
+
* await str.validate(["should be professional", "no excessive punctuation"]);
|
|
121
|
+
* // { valid: false, issues: ["excessive punctuation (!!!)"] }
|
|
122
|
+
* ```
|
|
123
|
+
*/
|
|
124
|
+
validate(rules: string[]): Promise<ValidateResult>;
|
|
125
|
+
/**
|
|
126
|
+
* Determine the likely intent or purpose of the string.
|
|
127
|
+
*
|
|
128
|
+
* @returns Intent classification with confidence
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const str = SemanticString.from("How do I reset my password?");
|
|
133
|
+
* await str.detectIntent();
|
|
134
|
+
* // { intent: "question", subtype: "how-to", topic: "password-reset", confidence: 0.94 }
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
detectIntent(): Promise<DetectIntentResult>;
|
|
138
|
+
/**
|
|
139
|
+
* Detect the language of the string.
|
|
140
|
+
*
|
|
141
|
+
* @returns Detected language code with confidence
|
|
142
|
+
*
|
|
143
|
+
* @example
|
|
144
|
+
* ```ts
|
|
145
|
+
* const str = SemanticString.from("Bonjour le monde");
|
|
146
|
+
* await str.detectLanguage();
|
|
147
|
+
* // { language: "fr", confidence: 0.98 }
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
detectLanguage(): Promise<DetectLanguageResult>;
|
|
151
|
+
/**
|
|
152
|
+
* Check if the string contains sensitive information (PII, secrets, etc.).
|
|
153
|
+
*
|
|
154
|
+
* @returns Detection result with types of sensitive data found
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* const str = SemanticString.from("My SSN is 123-45-6789");
|
|
159
|
+
* await str.containsSensitive();
|
|
160
|
+
* // { hasSensitive: true, types: ["ssn"] }
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
containsSensitive(): Promise<ContainsSensitiveResult>;
|
|
164
|
+
/**
|
|
165
|
+
* Get a semantic similarity score with another string (0-1).
|
|
166
|
+
*
|
|
167
|
+
* @param other - String to compare with
|
|
168
|
+
* @returns Similarity score from 0 (unrelated) to 1 (identical meaning)
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```ts
|
|
172
|
+
* const str = SemanticString.from("happy");
|
|
173
|
+
* await str.similarity("joyful"); // 0.85
|
|
174
|
+
* await str.similarity("sad"); // 0.15
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
similarity(other: string | SemanticString): Promise<number>;
|
|
178
|
+
/**
|
|
179
|
+
* Summarize the string to a target length while preserving meaning.
|
|
180
|
+
*
|
|
181
|
+
* @param maxLength - Maximum character length for summary
|
|
182
|
+
* @returns Summarized string
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* const str = SemanticString.from("The quick brown fox jumps over the lazy dog. This is a common pangram used for testing.");
|
|
187
|
+
* await str.summarize(50);
|
|
188
|
+
* // "A pangram about a fox jumping over a lazy dog."
|
|
189
|
+
* ```
|
|
190
|
+
*/
|
|
191
|
+
summarize(maxLength: number): Promise<string>;
|
|
192
|
+
/**
|
|
193
|
+
* Suggest corrections for spelling, grammar, or style issues.
|
|
194
|
+
*
|
|
195
|
+
* @returns Array of suggested corrections
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```ts
|
|
199
|
+
* const str = SemanticString.from("Their going to the store tommorow");
|
|
200
|
+
* await str.suggestCorrections();
|
|
201
|
+
* // [{ original: "Their", suggestion: "They're" }, { original: "tommorow", suggestion: "tomorrow" }]
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
suggestCorrections(): Promise<Correction[]>;
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/string/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,EACX,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACtB,MAAM,4BAA4B,CAAC;AAepC,YAAY,EACV,oBAAoB,EACpB,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,UAAU,GACX,MAAM,uBAAuB,CAAC;AAE/B,4EAA4E;AAC5E,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,cACX,YACE,QAAQ,CAAC,MAAM,CAAC,EAChB,UAAU,CAAC,MAAM,GAAG,cAAc,CAAC,EACnC,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,qBAAqB;IAEvB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAY;IAEnC,OAAO;IAKP;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,GAAG,cAAc;IAI9D;;OAEG;IACH,QAAQ,IAAI,MAAM;IAIlB;;OAEG;IACH,OAAO,IAAI,MAAM;IAIjB;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;;;;;;;;;OAcG;IACG,kBAAkB,CACtB,KAAK,EAAE,MAAM,GAAG,cAAc,EAC9B,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GACjD,OAAO,CAAC,oBAAoB,CAAC;IAchC;;;;;;;;;;;;;;OAcG;IACG,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAM/E;;;;;;;;;;;;OAYG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;IAMjF;;;;;;;;;;;;OAYG;IACG,QAAQ,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,CAAC;IAMxD;;;;;;;;;;;OAWG;IACG,YAAY,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAMjD;;;;;;;;;;;OAWG;IACG,cAAc,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAMrD;;;;;;;;;;;OAWG;IACG,iBAAiB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAM3D;;;;;;;;;;;;OAYG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC;IAQjE;;;;;;;;;;;;OAYG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAOnD;;;;;;;;;;;OAWG;IACG,kBAAkB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;CAMlD"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompts for SemanticString LLM operations
|
|
3
|
+
* Each prompt is designed to return structured JSON output
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Prompt for semantic equality comparison
|
|
7
|
+
*/
|
|
8
|
+
export declare function semanticallyEqualsPrompt(str1: string, str2: string, context?: string): string;
|
|
9
|
+
/**
|
|
10
|
+
* Prompt for string classification
|
|
11
|
+
*/
|
|
12
|
+
export declare function classifyPrompt(text: string, categories: string[], context?: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Prompt for entity extraction
|
|
15
|
+
*/
|
|
16
|
+
export declare function extractPrompt(text: string, types: string[]): string;
|
|
17
|
+
/**
|
|
18
|
+
* Prompt for semantic validation
|
|
19
|
+
*/
|
|
20
|
+
export declare function validatePrompt(text: string, rules: string[]): string;
|
|
21
|
+
/**
|
|
22
|
+
* Prompt for intent detection
|
|
23
|
+
*/
|
|
24
|
+
export declare function detectIntentPrompt(text: string): string;
|
|
25
|
+
/**
|
|
26
|
+
* Prompt for language detection
|
|
27
|
+
*/
|
|
28
|
+
export declare function detectLanguagePrompt(text: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Prompt for sensitive information detection
|
|
31
|
+
*/
|
|
32
|
+
export declare function containsSensitivePrompt(text: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Prompt for semantic similarity scoring
|
|
35
|
+
*/
|
|
36
|
+
export declare function similarityPrompt(str1: string, str2: string): string;
|
|
37
|
+
/**
|
|
38
|
+
* Prompt for text summarization
|
|
39
|
+
*/
|
|
40
|
+
export declare function summarizePrompt(text: string, maxLength: number): string;
|
|
41
|
+
/**
|
|
42
|
+
* Prompt for correction suggestions
|
|
43
|
+
*/
|
|
44
|
+
export declare function suggestCorrectionsPrompt(text: string): string;
|
|
45
|
+
//# sourceMappingURL=string.prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.prompts.d.ts","sourceRoot":"","sources":["../../../src/primitives/string/string.prompts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAkBR;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAAE,EACpB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAgBR;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAanE;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,CAgBpE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAkBvD;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAWzD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAmB5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAmBnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAevE;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoB7D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/primitives/symbol/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,aAAa,CAAC"}
|