phasellm.logging#

Logging support. This allows you to use the phasellm library to send chats to evals.phasellm.com and review them via our hosted front-end.

Module Contents#

Classes#

PhaseLogger

Helper class for logging chats to evals.phasellm.com.

Attributes#

phasellm.logging._PHASELLM_EVALS_BASE_URL = 'https://evals.phasellm.com/api/v0.1'#
class phasellm.logging.PhaseLogger(apikey: str)#

Helper class for logging chats to evals.phasellm.com.

Parameters:

apikey – The API key associated with your evals.phasellm.com account.

log(messages: List[phasellm.llms.Message], chat_id: int | None = None, title: str | None = None, source_id: str | None = None) int#

Saves or updates the relevant chat at evals.phasellm.com

Parameters:
  • messages – The messages array from the chat.

  • chat_id – Optional chat ID. If you provide a chat ID from an earlier log event, the messages will overwrite the original chat. This should be used for updating conversations rather than replacing them.

  • title – Optional title for the chat.

  • source_id – Optional String representing an ID for the chat. This is to enable easier referencing of chats for end users and is not used by PhaseLLM Evals.

Returns:

The chat_id associated with the chat.

logChatBot(chatbot: phasellm.llms.ChatBot, chat_id: int | None = None, title: str | None = None, source_id: str | None = None) int#