UNPKG

openclaw

Version:

Multi-channel AI gateway with extensible messaging integrations

2 lines • 1.09 kB
//!src/llm/model-runtime-binding.ts const MODEL_LLM_RUNTIME=Symbol(`openclaw.modelLlmRuntime`);const streamLlmRuntimes=/* @__PURE__ */ new WeakMap;function bindModelRuntime(e,t){const n={...e};Object.defineProperty(n,MODEL_LLM_RUNTIME,{value:t,enumerable:false});return n}function bindModelLlmRuntime(e,t,n){return bindModelRuntime(e,{runtime:t,completionTransport:n,completionOwner:getModelCompletionOwner(e)})}function bindModelCompletionOwner(e,t){return bindModelRuntime(e,{...e[MODEL_LLM_RUNTIME],completionOwner:t})}function getModelCompletionOwner(e){return e[MODEL_LLM_RUNTIME]?.completionOwner}function getModelLlmRuntime(e){return e[MODEL_LLM_RUNTIME]?.runtime}function getModelCompletionTransport(e){return e[MODEL_LLM_RUNTIME]?.completionTransport}function bindStreamLlmRuntime(e,t){streamLlmRuntimes.set(e,t)}function getStreamLlmRuntime(e){return e?streamLlmRuntimes.get(e):void 0}export{getModelCompletionTransport as a,getModelCompletionOwner as i,bindModelLlmRuntime as n,getModelLlmRuntime as o,bindStreamLlmRuntime as r,getStreamLlmRuntime as s,bindModelCompletionOwner as t};