Skip to content

Graphorin API reference v0.12.1


Graphorin API reference / @graphorin/provider-llamacpp-node / / LlamaSessionInstance

Interface: LlamaSessionInstance

Defined in: packages/provider-llamacpp-node/src/runtime.ts:49

Internal

Loaded chat session capable of streaming responses.

Methods

dispose()?

ts
optional dispose(): void;

Defined in: packages/provider-llamacpp-node/src/runtime.ts:73

Release the per-request context / sequence backing this session. node-llama-cpp contexts hold KV-cache memory (hundreds of MB at large context sizes); the adapter calls this in a finally after every stream so long-running agents do not leak until OOM.

Returns

void


promptStreamingResponse()

ts
promptStreamingResponse(prompt, options?): AsyncIterable<string>;

Defined in: packages/provider-llamacpp-node/src/runtime.ts:50

Parameters

ParameterType
promptstring
options?{ maxTokens?: number; signal?: AbortSignal; temperature?: number; }
options.maxTokens?number
options.signal?AbortSignal
options.temperature?number

Returns

AsyncIterable&lt;string&gt;


setChatHistory()?

ts
optional setChatHistory(history): void;

Defined in: packages/provider-llamacpp-node/src/runtime.ts:66

W-096: replace the session's chat history (node-llama-cpp v3 setChatHistory). When present, the adapter feeds multi-turn transcripts as REAL chat history + prompts only the last user turn

  • instead of serialising the whole conversation into one pseudo-prompt string. Optional: fixtures / custom factories without it keep the legacy render-prompt path.

Parameters

ParameterType
historyreadonly LlamaChatHistoryItem[]

Returns

void