MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT-LLM / register_function

Method register_function

tensorrt_llm/executor/rpc/rpc_server.py:179–193  ·  view source on GitHub ↗

Exposes a single function to clients. Args: func: The function to register. name: The name of the function. If not provided, the name of the function will be used.

(self,
                          func: Callable[..., Any],
                          name: Optional[str] = None)

Source from the content-addressed store, hash-verified

177 color="yellow")
178
179 def register_function(self,
180 func: Callable[..., Any],
181 name: Optional[str] = None) -> None:
182 """Exposes a single function to clients.
183
184 Args:
185 func: The function to register.
186 name: The name of the function. If not provided, the name of the function will be used.
187 """
188 fname = name or func.__name__
189 if fname in self._functions:
190 logger.warning(
191 f"Function '{fname}' is already registered. Overwriting.")
192 self._functions[fname] = func
193 logger_debug(f"[server] Registered function: {fname}")
194
195 def register_instance(self, instance: Any) -> None:
196 """Exposes all public methods of a class instance.

Callers 1

register_instanceMethod · 0.95

Calls 2

logger_debugFunction · 0.85
warningMethod · 0.45

Tested by

no test coverage detected