def process_response(response: Any, completion: str) -> CompletionResponse:
    """
    Processes the response from Aleph Alpha API.

    :param response: The response object from Aleph Alpha API.
    :param completion: The completion text.

    :return: A CompletionResponse object.
    """
    log_probs_formatted = []

    if response.completions and hasattr(response.completions[0], "log_probs"):
        log_probs_extracted = response.completions[0].log_probs or []

        for lp_dict in log_probs_extracted:
            if isinstance(lp_dict, dict):
                for token, log_prob in lp_dict.items():
                    log_probs_formatted.append(LogProb(token=token, logprob=log_prob))

    additional_info = extract_additional_info_from_response(response)

    return CompletionResponse(
        text=completion,
        raw=response.to_json(),
        logprobs=[log_probs_formatted],
        additional_kwargs=additional_info,
    )

    Processes the response from Aleph Alpha API.

    :param response: The response object from Aleph Alpha API.
    :param completion: The completion text.

    :return: A CompletionResponse object.
    
llama-index-integrations/llms/llama-index-llms-alephalpha/llama_index/llms/alephalpha/utils.py