Skip to content

Commit

Permalink
Improvement[Community] Improve streamlit_callback_handler (#26373)
Browse files Browse the repository at this point in the history
- add decorator for static methods

Co-authored-by: Erick Friis <erick@langchain.dev>
  • Loading branch information
ZhangShenao and efriis committed Sep 17, 2024
1 parent 1a62f98 commit 1a8e902
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ class LLMThoughtLabeler:
labeling logic.
"""

def get_initial_label(self) -> str:
@staticmethod
def get_initial_label() -> str:
"""Return the markdown label for a new LLMThought that doesn't have
an associated tool yet.
"""
return f"{THINKING_EMOJI} **Thinking...**"

def get_tool_label(self, tool: ToolRecord, is_complete: bool) -> str:
@staticmethod
def get_tool_label(tool: ToolRecord, is_complete: bool) -> str:
"""Return the label for an LLMThought that has an associated
tool.
Expand Down Expand Up @@ -91,13 +93,15 @@ def get_tool_label(self, tool: ToolRecord, is_complete: bool) -> str:
label = f"{emoji} **{name}:** {input}"
return label

def get_history_label(self) -> str:
@staticmethod
def get_history_label() -> str:
"""Return a markdown label for the special 'history' container
that contains overflow thoughts.
"""
return f"{HISTORY_EMOJI} **History**"

def get_final_agent_thought_label(self) -> str:
@staticmethod
def get_final_agent_thought_label() -> str:
"""Return the markdown label for the agent's final thought -
the "Now I have the answer" thought, that doesn't involve
a tool.
Expand Down

0 comments on commit 1a8e902

Please sign in to comment.