Skip to content

Util

COST_MARGIN_FACTOR = 5 module-attribute

default_json_serializer(obj)

dollar_cost_to_credits(cost)

Convert cost in $ to credits.

dollar_payment_to_credits(payment)

Convert payment in $ to credits.

ensure_string(final_content)

is_tool_call(message)

Check whether a message has a tool call (or calls).

name_of(inst_or_class)

Get the name of a class or instance.

recursive_remove_keys(d, keys)

Remove named keys from dicts recursively.

Useful when comparing models where something like id should be excluded.


d: dict to remove keys from
keys: list of keys to remove

dict with keys removed