Graphorin API reference v0.4.0
Graphorin API reference / @graphorin/memory / / QueryTransformer
Interface: QueryTransformer
Defined in: packages/memory/src/search/query-transform.ts:46
Pluggable query-transformation seam consumed by SemanticMemory.search(..., { multiQuery, hyde }). The built-in provider-backed implementation lives in createProviderQueryTransformer; advanced callers can supply a bespoke one (e.g. a deterministic synonym expander) to new SemanticMemory({ queryTransformer }).
Implementations MUST degrade gracefully — return [] / null rather than throw — so a transform failure never breaks recall.
Stable
Methods
expand()
expand(
query,
count,
options?): Promise<readonly string[]>;Defined in: packages/memory/src/search/query-transform.ts:52
Rewrite a query into up to count additional reworded variants (the original query is retained by the caller). Returns [] when transformation is unavailable or the model returns nothing usable.
Parameters
| Parameter | Type |
|---|---|
query | string |
count | number |
options? | QueryTransformOptions |
Returns
Promise<readonly string[]>
hypothetical()
hypothetical(query, options?): Promise<string | null>;Defined in: packages/memory/src/search/query-transform.ts:62
Generate a single short hypothetical-answer passage to embed (HyDE), or null when unavailable. The caller embeds the passage and fuses its vector neighbours into the result.
Parameters
| Parameter | Type |
|---|---|
query | string |
options? | QueryTransformOptions |
Returns
Promise<string | null>