class_docstr: Encapsulates the Streamlit UI for a single LLM 'thought' during a LangChain Agent
  run. Each tool usage gets its own thought; and runs also generally having a
  concluding thought where the Agent determines that it has an answer to the prompt.
  
  Each thought gets its own expander UI.
class_docstr_tok: ["Encapsulates","the","Streamlit","UI","for","a","single","LLM","'thought","'","during","a","LangChain","Agent","run",".","Each","tool","usage","gets","its","own","thought",";","and","runs","also","generally","having","a","concluding","thought","where","the","Agent","determines","that","it","has","an","answer","to","the","prompt",".","Each","thought","gets","its","own","expander","UI","."]
docstr: Finish the thought.
docstr_tok: ["Finish","the","thought","."]
code: def complete(self, final_label: Optional[str] = None) -> None:
      """Finish the thought."""
      if (
          final_label is None
          and self._state == LLMThoughtState.RUNNING_TOOL
      ):
          assert (
              self._last_tool is not None
          ), "_last_tool should never be null when _state == RUNNING_TOOL"
          final_label = self._labeler.get_tool_label(
              self._last_tool, is_complete=True
          )
  
      if self._last_tool and self._last_tool.name == "_Exception":
          self._state = LLMThoughtState.ERROR
      elif self._state != LLMThoughtState.ERROR:
          self._state = LLMThoughtState.COMPLETE
  
      if self._collapse_on_complete:
          # Add a quick delay to show the user the final output before we collapse
          time.sleep(0.25)
  
      self._container.update(
          label=final_label,
          expanded=False if self._collapse_on_complete else None,
          state="error"
          if self._state == LLMThoughtState.ERROR
          else "complete",
      )
  
imports: from __future__ import annotations
  import time
  from enum import Enum
  from typing import TYPE_CHECKING, Any, Dict, List, NamedTuple, Optional
  from langchain.callbacks.base import BaseCallbackHandler
  from langchain.schema import AgentAction, AgentFinish, LLMResult
  from streamlit.runtime.metrics_util import gather_metrics
label_desc: Use image node_id 13 for calling the LLMThought obj's underlying member method code with example usage: obj.complete(final_label) without return types