LLMClient Class

Singleton client for the DWSIM Assistant HTTP/WebSocket API. All members are implicitly Shared (VB.NET Module).

Definition

Namespace: DWSIM.SharedClasses
Assembly: DWSIM.SharedClasses (in DWSIM.SharedClasses.dll) Version: 10.0.0.0
public class LLMClient
Inheritance
Object    LLMClient

Constructors

Methods

ApplyConfigAsync Push all API key and integration settings to the running server (POST /api-keys) then switch the backend (PATCH /session).
Ask Synchronous LLM call. Blocks the calling thread until the full response arrives. Safe to use from IronPython scripts and non-UI contexts. Prefer AskAsync in async/UI code.
AskAsync Asynchronous streaming LLM call via WebSocket. Calls onChunk for each received text fragment. Returns the complete concatenated response when the stream ends. Uses the server's currently active backend and model by default.
Debug 
EffectiveModel Returns the model name that matches the server's current active backend. Falls back to locally configured values.
EscEscape a string for embedding inside a JSON string value.
FetchSettingsFromServerAsync Reads the server's active settings (GET /api-keys + GET /session) and updates Config with non-secret fields: models, endpoints, backend, flags. API keys in Config are NOT overwritten (server returns masked values). Call this whenever the user may have changed settings via the web UI.
InitAsync 
IsServerRunningAsyncReturns True if the server responds on /session within 3 seconds.
JBool Extract a boolean value from a flat JSON object. Returns True when the value is the JSON literal true.
JIntJSON integer field: "key":number
JSJSON string field: "key":"escaped_value"
JsonUnescape 
JStr Extract a string value from a flat JSON object. Handles "key":"value" and "key": "value" (with whitespace). Returns "" when the key is absent or the value is null/empty.
OpenInBrowserOpen the DWSIM Assistant web UI in the default browser.
OverwriteIfNotEmptyOnly update a config property if the new value is non-empty.
SetBackendAsyncSwitch the active LLM backend: local | openai | claude | custom | azure.

Fields

_http 
ConfigActive configuration. Populate via InitAsync() or LoadConfig().

Extension Methods

GetEnumNames
(Defined by General)
IsValidDouble
(Defined by General)

See Also