taskgen.base#
Functions
|
Performs a chat with the host's LLM model with system prompt, user prompt, model, verbose and kwargs Returns the output string res - system_prompt: String. Write in whatever you want the LLM to become. e.g. "You are a <purpose in life>" - user_prompt: String. The user input. Later, when we use it as a function, this is the function input - model: String. The LLM model to use for json generation - verbose: Boolean (default: False). Whether or not to print out the system prompt, user prompt, GPT response - host: String. The provider of the LLM - llm: User-made llm function. - Inputs: - system_prompt: String. Write in whatever you want the LLM to become. e.g. "You are a <purpose in life>" - user_prompt: String. The user input. Later, when we use it as a function, this is the function input - Output: - res: String. The response of the LLM call - **kwargs: Dict. Additional arguments for LLM chat. |
|
Ensures that output field of the key of JSON dictionary is of data_type Currently supports int, float, str, code, enum, lists, nested lists, dict, dict with keys Takes in **kwargs for the LLM model Returns corrected output field that matches the datatype |
|
Check whether each key in dict, or elements in list of new_output_format is present in field, and whether they meet the right data type requirements, then convert field to the right data type If needed, calls LLM model with parameters **kwargs to correct the output format for improperly formatted list output_format is user-given output format at each level, new_output_format is with delimiters in keys, and angle brackets surrounding values If output_format is a string, decode escape characters, so that code can run Returns field that is converted to a dictionary if able to. Otherwise, raises Exception errors for missing keys or wrong output format. |
|
Converts the string field into a dictionary with keys by splitting on '{delimiter}{key}{delimiter}' |
|
Converts the string field into a list using the LLM (with **kwargs) to list out elements line by line |
|
Uses the LLM to check if the field adheres to the llm_check_msg. |
|
|
|
Removes the unicode escape character from the ending string in my_datatype (can be nested) |
|
Ensures that OpenAI will always adhere to the desired output JSON format defined in output_format. |
|
Ensures that OpenAI will always adhere to the desired output JSON format defined in output_format. |
|
Ensures that OpenAI will always adhere to the desired output JSON format defined in output_format. |
|
|
|
Changes d to output_d by wrapping delimiters over the keys, and putting angle brackets on the values Also changes all mention of list after type: to array for better processing |