MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / cleanup

Method cleanup

python/src/llm/config.rs:370–380  ·  view source on GitHub ↗

Cleanup the Python instance from the global registry Call this method when you're done using a HuggingFace or other PythonBridge configuration to free memory and Python resources. Returns True if an instance was removed, False otherwise. Example: config = LlmConfig.huggingface(api_key="...", model="...") # ... use config ... config.cleanup() # Frees resources

(&self)

Source from the content-addressed store, hash-verified

368 /// # ... use config ...
369 /// config.cleanup() # Frees resources
370 fn cleanup(&self) -> bool {
371 if let CoreLlmConfig::PythonBridge {
372 instance_id: Some(ref id),
373 ..
374 } = self.inner
375 {
376 unregister_python_instance(id)
377 } else {
378 false
379 }
380 }
381 /// Context manager entry point
382 ///
383 /// Enables `with` statement usage for automatic resource cleanup:

Callers 4

__exit__Method · 0.80
teardown_methodMethod · 0.80
teardown_methodMethod · 0.80

Calls 1

Tested by 3

teardown_methodMethod · 0.64
teardown_methodMethod · 0.64