utils
Various utiles used from the projects.
get_base_path()
get_base_url()
Allows exposing the base url.
Source code in cat/utils.py
get_plugins_path()
get_static_path()
get_static_url()
match_prompt_variables(prompt_variables, prompt_template)
Ensure prompt variables and prompt placeholders map, so there are no issues on mismatches
Source code in cat/utils.py
to_camel_case(text)
Format string to camel case.
Takes a string of words separated by either hyphens or underscores and returns a string of words in camel case.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text
|
str
|
String of hyphens or underscores separated words. |
required |
Returns:
Type | Description |
---|---|
str
|
Camel case formatted string. |
Source code in cat/utils.py
verbal_timedelta(td)
Convert a timedelta in human form.
The function takes a timedelta and converts it to a human-readable string format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
td
|
timedelta
|
Difference between two dates. |
required |
Returns:
Type | Description |
---|---|
str
|
Human-readable string of time difference. |
Notes
This method is used to give the Language Model information time information about the memories retrieved from the vector database.
Examples: