MCPcopy Create free account
hub / github.com/Emmimal/control-layer / call

Method call

control_layer.py:801–822  ·  view source on GitHub ↗
(self, prompt: str)

Source from the content-addressed store, hash-verified

799 self.timeout_seconds = timeout_seconds
800
801 def call(self, prompt: str) -> str:
802 result: Dict[str, Any] = {}
803 error: Dict[str, Any] = {}
804
805 def target():
806 try:
807 result["value"] = self.llm_fn(prompt)
808 except Exception as exc:
809 error["value"] = exc
810
811 thread = threading.Thread(target=target, daemon=True)
812 thread.start()
813 thread.join(timeout=self.timeout_seconds)
814
815 if thread.is_alive():
816 raise LLMTimeoutError(
817 f"LLM call exceeded {self.timeout_seconds}s timeout"
818 )
819 if "value" in error:
820 raise error["value"]
821
822 return result.get("value", "")
823
824
825# =============================================================================

Callers 3

test_timeout_raisesMethod · 0.95
runMethod · 0.80

Calls 1

LLMTimeoutErrorClass · 0.85

Tested by 2

test_timeout_raisesMethod · 0.76