mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-19 21:33:51 +00:00
Improvement[Community] Improve streamlit_callback_handler
(#26373)
- add decorator for static methods Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
parent
1a62f9850f
commit
1a8e9023de
@ -53,13 +53,15 @@ class LLMThoughtLabeler:
|
|||||||
labeling logic.
|
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
|
"""Return the markdown label for a new LLMThought that doesn't have
|
||||||
an associated tool yet.
|
an associated tool yet.
|
||||||
"""
|
"""
|
||||||
return f"{THINKING_EMOJI} **Thinking...**"
|
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
|
"""Return the label for an LLMThought that has an associated
|
||||||
tool.
|
tool.
|
||||||
|
|
||||||
@ -91,13 +93,15 @@ class LLMThoughtLabeler:
|
|||||||
label = f"{emoji} **{name}:** {input}"
|
label = f"{emoji} **{name}:** {input}"
|
||||||
return label
|
return label
|
||||||
|
|
||||||
def get_history_label(self) -> str:
|
@staticmethod
|
||||||
|
def get_history_label() -> str:
|
||||||
"""Return a markdown label for the special 'history' container
|
"""Return a markdown label for the special 'history' container
|
||||||
that contains overflow thoughts.
|
that contains overflow thoughts.
|
||||||
"""
|
"""
|
||||||
return f"{HISTORY_EMOJI} **History**"
|
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 -
|
"""Return the markdown label for the agent's final thought -
|
||||||
the "Now I have the answer" thought, that doesn't involve
|
the "Now I have the answer" thought, that doesn't involve
|
||||||
a tool.
|
a tool.
|
||||||
|
Loading…
Reference in New Issue
Block a user