Callbacks
Overview
LLMを呼ぶタイミングなどに処理を挟むことができる
on_llm_starton_llm_endon_llm_new_tokenon_llm_erroron_chain_starton_chain_endon_agent_actionon_tool_endon_tool_erroron_agent_finish
Examples
- StdOutCallbackHandler <-
verbose=TrueとするとセットされるCallbackHandler - CostCalcCallbackHandler: CostStreaming用のCallback
- SimpleStreamlitCallbackHandler: StreamlitでチャットがStreamingで出るようにするためのCallback
Run
platform darwin -- Python 3.9.9, pytest-7.4.0, pluggy-1.2.0
rootdir: /Users/m.naka/repos/nakamasato/gpt-poc
plugins: cov-4.1.0
collected 4 items / 3 deselected / 1 selected
tests/test_callbacks.py run_id=UUID('a49fbd93-2745-4b73-807b-7ae668fcc9fd')
prompts=['Tell me a joke']
serialized={'lc': 1, 'type': 'not_implemented', 'id': ['langchain', 'llms', 'fake', 'FakeListLLM']}
.
promptsをチェックしたりできる。