phasellm.html#
Support for convering LLM-related classes and objects to HTML and various outputs.
Module Contents#
Functions#
|
Converts a String into an HTML-friendly representation. |
|
Takes a html object generated by PhaseLLM and saves it to an HTML file. |
|
Converts a chatbot's message stack to a JSON array. Optionally, add an order_field key to save the order of the array itself. |
|
Converts a chatbot's message stack to HTML. |
Attributes#
- phasellm.html.style = Multiline-String#
Show Value
""" .phasellm_chatbot_stream { margin:5px; box-sizing:content-box; padding:8px; border-radius:8px; border:1px solid black; display:inline-block; } .phasellm_chatbot_stream .response_container { display:block; display:block; margin:5px; padding:8px; } .content_user { background-color:green; color:white; } .content_system { color:gray; background-color:lightgray; font-style:italic; } .content_assistant { color:white; background-color:crimson; } .response { padding:8px; border-radius:8px; } .phasellm_chatbot_stream .timestamp { margin:5px 5px 5px 15px; font-size:70%; color:gray; font-style:italic; display:inline-block; } .phasellm_chatbot_stream .time_taken { margin:5px 5px 5px 15px; font-size:70%; color:gray; font-style:italic; display:inline-block; } .legend { font-size:70%; text-align:right; padding-right:15px; } .legend_box { width:10px; height:10px; display:inline-block; position:relative; top:2px; margin-left:8px; margin-right:2px; } """
- phasellm.html._formatContentToHtml(string) str#
Converts a String into an HTML-friendly representation.
- Parameters:
string – The string to convert.
- Returns:
The HTML formatted string.
- phasellm.html.toHtmlFile(html, filepath) None#
Takes a html object generated by PhaseLLM and saves it to an HTML file.
- Parameters:
html – The HTML object to save.
filepath – The path to save the HTML file to.
- phasellm.html.chatbotToJson(chatbot, order_field=None) str#
Converts a chatbot’s message stack to a JSON array. Optionally, add an order_field key to save the order of the array itself.
- Parameters:
chatbot – The ChatBot object whose message stack we want.
order_field – Optional key to include the array order value into the dictionary.
- Returns:
The JSON dictionary representing the mesages from the chatbot object.
- phasellm.html.chatbotToHtml(chatbot) str#
Converts a chatbot’s message stack to HTML.
- Parameters:
chatbot – The chatbot to convert.
- Returns:
The HTML representation of the chatbot message stack.