MCPcopy Create free account
hub / github.com/ScrapeGraphAI/Scrapegraph-ai / get_custom_callback

Function get_custom_callback

scrapegraphai/utils/custom_callback.py:150–157  ·  view source on GitHub ↗

Function to get custom callback for LLM token usage statistics.

(llm_model_name: str)

Source from the content-addressed store, hash-verified

148
149@contextmanager
150def get_custom_callback(llm_model_name: str):
151 """
152 Function to get custom callback for LLM token usage statistics.
153 """
154 cb = CustomCallbackHandler(llm_model_name)
155 custom_callback.set(cb)
156 yield cb
157 custom_callback.set(None)

Callers 1

Calls 1

Tested by

no test coverage detected