def calculate_tokens_necessary_for_function_call(context: BoltContext) -> int:
    """Calculates the estimated number of prompt tokens necessary for loading Function Call stuff"""
    function_call_module_name = context.get("OPENAI_FUNCTION_CALL_MODULE_NAME")
    if function_call_module_name is None:
        return 0

    global _prompt_tokens_used_by_function_call_cache
    if _prompt_tokens_used_by_function_call_cache is not None:
        return _prompt_tokens_used_by_function_call_cache

    def _calculate_prompt_tokens(functions) -> int:
        client = create_openai_client(context)
        return client.chat.completions.create(
            model=context.get("OPENAI_MODEL"),
            messages=[{"role": "user", "content": "hello"}],
            max_tokens=1024,
            user="system",
            **({"functions": functions} if functions is not None else {}),
        ).model_dump()["usage"]["prompt_tokens"]

    # TODO: If there is a better way to calculate this, replace the logic with it
    module = import_module(function_call_module_name)
    _prompt_tokens_used_by_function_call_cache = _calculate_prompt_tokens(
        module.functions
    ) - _calculate_prompt_tokens(None)
    return _prompt_tokens_used_by_function_call_cache
Calculates the estimated number of prompt tokens necessary for loading Function Call stuff
app/openai_ops.py