get_log_context¶
gepa.optimize_anything.get_log_context() -> LogContext
¶
Return the active log context for the current evaluator call.
Use this to propagate oa.log() capture to child threads spawned
inside your evaluator::
import threading
import gepa.optimize_anything as oa
def my_evaluator(candidate):
ctx = oa.get_log_context()
def worker():
oa.set_log_context(ctx)
oa.log("from child thread")
t = threading.Thread(target=worker)
t.start()
t.join()
oa.log("from main evaluator thread")
return score
Raises:
| Type | Description |
|---|---|
RuntimeError
|
If called outside an evaluator invocation. |