llm: Union[BaseFireworks, FireworksChat], **kwargs: Any
) -> Any:
    """Use tenacity to retry the async completion call."""
    if "prompt" not in kwargs.keys():
        answers = []
        for i in range(len(kwargs["messages"])):
            result = kwargs["messages"][i]["content"]
            result = execute(
                result,
                kwargs["model"],
                llm.fireworks_api_key,
                llm.max_tokens,
                llm.temperature,
            )
            curr_string = json.loads(result)["choices"][0]["text"]
            answers.append(curr_string)
    else:
        answers = []
        for i in range(len(kwargs["prompt"])):
            result = kwargs["prompt"][i]
            result = execute(
                result,
                kwargs["model"],
                llm.fireworks_api_key,
                llm.max_tokens,
                llm.temperature,
            )
            curr_string = json.loads(result)["choices"][0]["text"]
            answers.append(curr_string)
    return answers