Skip to content

@codesoul-co/hypha-serving-cache / key ​

Using this module ​

Use the Key module for using the public contracts and operations for this capability boundary. It exports 6 functions.

Import from the package entrypoint ​

ts
import {
  buildPromptPrefixMetadata,
  canonicalize,
  createLLMCacheKey,
  hashStableJson,
  normalizeLLMCacheKeyInput,
  stableJson,
} from '@codesoul-co/hypha-serving-cache';

Usage patterns ​

  • The module exposes 6 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.

Public exports ​

SymbolKindSignatureDescription
buildPromptPrefixMetadatafunctionbuildPromptPrefixMetadata(input: LLMCacheKeyInput): PromptPrefixMetadataBuild Prompt Prefix Metadata function with 1 public call signature; parameters and return types are listed below.
canonicalizefunctioncanonicalize(value: unknown): unknownCanonicalize function with 1 public call signature; parameters and return types are listed below.
createLLMCacheKeyfunctioncreateLLMCacheKey(input: LLMCacheKeyInput): stringCreate LLM Cache Key function with 1 public call signature; parameters and return types are listed below.
hashStableJsonfunctionhashStableJson(value: unknown): stringHash Stable JSON function with 1 public call signature; parameters and return types are listed below.
normalizeLLMCacheKeyInputfunctionnormalizeLLMCacheKeyInput(input: LLMCacheKeyInput): LLMCacheKeyInputNormalize LLM Cache Key Input function with 1 public call signature; parameters and return types are listed below.
stableJsonfunctionstableJson(value: unknown): stringStable JSON function with 1 public call signature; parameters and return types are listed below.

buildPromptPrefixMetadata ​

Build Prompt Prefix Metadata function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { buildPromptPrefixMetadata } from '@codesoul-co/hypha-serving-cache';
  • Source module: key

Declaration ​

text
export declare function buildPromptPrefixMetadata(input: LLMCacheKeyInput): PromptPrefixMetadata;

Call signature ​

text
buildPromptPrefixMetadata(input: LLMCacheKeyInput): PromptPrefixMetadata

Parameters ​

ParameterTypeRequiredDescription
inputLLMCacheKeyInputYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: PromptPrefixMetadata
  • Description: The return contract is defined by the type shown above.

canonicalize ​

Canonicalize function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { canonicalize } from '@codesoul-co/hypha-serving-cache';
  • Source module: key

Declaration ​

text
export declare function canonicalize(value: unknown): unknown;

Call signature ​

text
canonicalize(value: unknown): unknown

Parameters ​

ParameterTypeRequiredDescription
valueunknownYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: unknown
  • Description: The return contract is defined by the type shown above.

createLLMCacheKey ​

Create LLM Cache Key function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { createLLMCacheKey } from '@codesoul-co/hypha-serving-cache';
  • Source module: key

Declaration ​

text
export declare function createLLMCacheKey(input: LLMCacheKeyInput): string;

Call signature ​

text
createLLMCacheKey(input: LLMCacheKeyInput): string

Parameters ​

ParameterTypeRequiredDescription
inputLLMCacheKeyInputYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: string
  • Description: The return contract is defined by the type shown above.

hashStableJson ​

Hash Stable JSON function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { hashStableJson } from '@codesoul-co/hypha-serving-cache';
  • Source module: key

Declaration ​

text
export declare function hashStableJson(value: unknown): string;

Call signature ​

text
hashStableJson(value: unknown): string

Parameters ​

ParameterTypeRequiredDescription
valueunknownYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: string
  • Description: The return contract is defined by the type shown above.

normalizeLLMCacheKeyInput ​

Normalize LLM Cache Key Input function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { normalizeLLMCacheKeyInput } from '@codesoul-co/hypha-serving-cache';
  • Source module: key

Declaration ​

text
export declare function normalizeLLMCacheKeyInput(input: LLMCacheKeyInput): LLMCacheKeyInput;

Call signature ​

text
normalizeLLMCacheKeyInput(input: LLMCacheKeyInput): LLMCacheKeyInput

Parameters ​

ParameterTypeRequiredDescription
inputLLMCacheKeyInputYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: LLMCacheKeyInput
  • Description: The return contract is defined by the type shown above.

stableJson ​

Stable JSON function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { stableJson } from '@codesoul-co/hypha-serving-cache';
  • Source module: key

Declaration ​

text
export declare function stableJson(value: unknown): string;

Call signature ​

text
stableJson(value: unknown): string

Parameters ​

ParameterTypeRequiredDescription
valueunknownYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: string
  • Description: The return contract is defined by the type shown above.