ai.analysis.model package

Submodules

ai.analysis.model.assistant_chat_model module

class ai.analysis.model.assistant_chat_model.AssistantChatModel(*values)[source]

Bases: Enum

Enum of supported assistant chat model identifiers.

GPT_4O

Identifier for the full GPT-4O model.

Type:

str

GPT_4_1

Identifier for the GPT-4.1 model.

Type:

str

GPT_4_1_MINI

Identifier for the GPT-4.1 Mini model.

Type:

str

GPT_4_1_NANO

Identifier for the GPT-4.1 Nano model.

Type:

str

GPT_4O_MINI

Identifier for the GPT-4O Mini model.

Type:

str

QWEN_2_5_7B

Identifier for the Qwen 2.5-7B Instruct model.

Type:

str

QWEN_2_5_7B_TOGETHER

Identifier for the Qwen 2.5-7B Instruct Turbo model.

Type:

str

LLAMA_70B

Identifier for the Meta LLaMA-3.3-70B Instruct model.

Type:

str

LLAMA_3B

Identifier for the Meta LLaMA-3.2-3B Instruct model.

Type:

str

GPT_4O = 'gpt-4o'
GPT_4_1 = 'gpt-4.1'
GPT_4_1_MINI = 'gpt-4.1-mini'
GPT_4_1_NANO = 'gpt-4.1-nano'
GPT_4O_MINI = 'gpt-4o-mini'
QWEN_2_5_7B = 'qwen/qwen-2.5-7b-instruct'
QWEN_2_5_7B_TOGETHER = 'Qwen/Qwen2.5-7B-Instruct-Turbo'
LLAMA_70B = 'meta-llama/llama-3.3-70b-instruct'
LLAMA_3B = 'meta-llama/llama-3.2-3b-instruct'

ai.analysis.model.token_price_calculator module

class ai.analysis.model.token_price_calculator.ModelPriceInfo(input_token_cost: Money, output_token_cost: Money)[source]

Bases: object

Cost information for input and output tokens of a model.

input_token_cost

Cost per input token.

Type:

Money

output_token_cost

Cost per output token.

Type:

Money

input_token_cost: Money
output_token_cost: Money
get_cost_for(token_type: TokenType) Money[source]

Return the cost for the specified token type.

Parameters:

token_type (TokenType) – The type of token (INPUT or OUTPUT).

Returns:

The cost associated with the token type.

Return type:

Money

Raises:

ValueError – If an unsupported token type is provided.

__init__(input_token_cost: Money, output_token_cost: Money) None
class ai.analysis.model.token_price_calculator.TokenPriceCalculator[source]

Bases: object

Calculator for determining token costs of supported assistant models.

model_price_infos: dict[AssistantChatModel, ModelPriceInfo] = {AssistantChatModel.GPT_4O: ModelPriceInfo(input_token_cost=$2.5e-06, output_token_cost=$1e-05), AssistantChatModel.GPT_4O_MINI: ModelPriceInfo(input_token_cost=$1.5e-07, output_token_cost=$6e-07), AssistantChatModel.GPT_4_1: ModelPriceInfo(input_token_cost=$2e-06, output_token_cost=$8e-06), AssistantChatModel.GPT_4_1_MINI: ModelPriceInfo(input_token_cost=$4e-07, output_token_cost=$1.6e-06), AssistantChatModel.GPT_4_1_NANO: ModelPriceInfo(input_token_cost=$1e-07, output_token_cost=$4e-07), AssistantChatModel.LLAMA_3B: ModelPriceInfo(input_token_cost=$1.5e-08, output_token_cost=$2.5e-08), AssistantChatModel.LLAMA_70B: ModelPriceInfo(input_token_cost=$1.2e-07, output_token_cost=$3e-07), AssistantChatModel.QWEN_2_5_7B: ModelPriceInfo(input_token_cost=$2.5e-08, output_token_cost=$5e-08), AssistantChatModel.QWEN_2_5_7B_TOGETHER: ModelPriceInfo(input_token_cost=$3e-07, output_token_cost=$3e-07)}
get_cost(model: AssistantChatModel, token_type: TokenType) Money[source]

Calculate the cost for a given model and token type.

Parameters:
Returns:

The cost for one token of the specified type for the given model.

Return type:

Money

Raises:

ValueError – If the model is not found in the price information.

ai.analysis.model.token_type module

class ai.analysis.model.token_type.TokenType(*values)[source]

Bases: Enum

Types of tokens for cost calculation.

INPUT

Represents an input token.

OUTPUT

Represents an output token.

INPUT = 1
OUTPUT = 2

Module contents