Skip to content

Commit

Permalink
fix: MarkdownFileCallbackHandler to aboid null exception
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu007 committed Sep 17, 2024
1 parent ad69b29 commit f03d3f9
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/codeinterpreterapi/callbacks/markdown/callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ def on_llm_end(self, response: LLMResult, **kwargs: Any) -> None:

def on_chain_start(self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any) -> None:
self.step_count += 1
chain_name = serialized.get("name", "Unknown Chain")
self._write_header(f"Chain Start - {chain_name}")
self._write_serialized(serialized)
self._write_inputs(inputs)
if serialized:
chain_name = serialized.get("name", "Unknown Chain")
self._write_header(f"Chain Start - {chain_name}")
self._write_serialized(serialized)
self._write_inputs(inputs)

def on_chain_end(self, outputs: Dict[str, Any], **kwargs: Any) -> None:
self._write_header("Chain End")
Expand Down

0 comments on commit f03d3f9

Please sign in to comment.