chat_document
langroid/agent/chat_document.py
StatusCode
¶
Bases: str
, Enum
Codes meant to be returned by task.run(). Some are not used yet.
ChatDocument
¶
Bases: Document
get_json_tools()
¶
Get names of attempted JSON tool usages in the content of the message. Returns: List[str]: list of JSON tool names
Source code in langroid/agent/chat_document.py
log_fields()
¶
Fields for logging in csv/tsv logger Returns: List[str]: list of fields
Source code in langroid/agent/chat_document.py
pop_tool_ids()
¶
from_LLMResponse(response, displayed=False)
staticmethod
¶
Convert LLMResponse to ChatDocument. Args: response (LLMResponse): LLMResponse to convert. displayed (bool): Whether this response was displayed to the user. Returns: ChatDocument: ChatDocument representation of this LLMResponse.
Source code in langroid/agent/chat_document.py
to_LLMMessage(message)
staticmethod
¶
Convert to LLMMessage for use with LLM.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
message |
str | ChatDocument
|
Message to convert. |
required |
Returns: LLMMessage: LLMMessage representation of this str or ChatDocument.