CostManager
- class echo_artistry.services.CostManager(token_counter, model_name='gpt-3.5-turbo-1106', image_model_name='dall-e-3', image_quality='standard', image_size='1792x1024')
CostManager is used to calculate the cost of a text.
- calculate_cost_image(image)
Calculate the cost of an image.
- Parameters:
image (Image) – The image to calculate the cost of.
- Returns:
The cost of the image.
- Return type:
float
- calculate_cost_messages(messages, is_input=True)
Calculate the cost of a message.
- Parameters:
messages (list) – The message to calculate the cost of.
is_input (bool, optional) – Whether the message is an input or an output. Defaults to True.
- Returns:
The cost of the message.
- Return type:
float
- calculate_cost_text(text, is_input=True)
Calculate the cost of a text.
- Parameters:
text (str) – The text to calculate the cost of.
is_input (bool, optional) – Whether the text is an input or an output. Defaults to True.
- Returns:
The cost of the text.
- Return type:
float
- calculate_cost_token(token_count, is_input=True)
Calculate the cost of a text.
- Parameters:
token_count (int) – The number of tokens in the text.
is_input (bool, optional) – Whether text is input or output. Defaults to True.
- Returns:
The cost of the text.
- Return type:
float
- get_total_cost()
Get the total cost of the text.
- Returns:
The total cost of the text.
- Return type:
float