Skip to content

Jupyter error, retrying: litellm.APIError: AzureException APIError - argument of type 'NoneType' is not iterable #1595

Open
@siyuyuan

Description

@siyuyuan

Describe the bug

def inerpreter_test():
    from interpreter import interpreter
    import os

    model_name = "gpt-4o-2024-08-06"
    api_version = "2024-03-01-preview"
    api_base = os.getenv(
        "AZURE_ENDPOINT", "haha"
    )
    interpreter.llm.model = f'azure/{model_name}'
    interpreter.llm.api_key = os.environ.get("AZURE_OPENAI_API_KEY", "haha")
    interpreter.llm.api_version = api_version
    interpreter.llm.api_base = api_base
    interpreter.auto_run = True
    interpreter.chat("# # Problem Description:\nMonocarp is gathering an army to fight a dragon in a videogame. The army consists of two parts: the heroes and the defensive artifacts. Each hero has one parameter — his health. Each defensive artifact also has one parameter — its durability. Before the battle begins, Monocarp distributes artifacts to the heroes so that each hero receives at most one artifact. The battle consists of rounds that proceed as follows: 1. First, the dragon deals damage equal to 1/(a + b) (a real number without rounding) to each hero, where a is the number of heroes alive and b is the number of active artifacts; 2. After that, all heroes with health 0 or less die; 3. Finally, some artifacts are deactivated. An artifact with durability x is deactivated when one of the following occurs: the hero holding the artifact either dies or receives x total damage (from the start of the battle). If an artifact is not held by any hero, it is inactive from the beginning of the battle. The battle ends when there are no heroes left alive. Initially, the army is empty. There are q queries: add a hero with health x or an artifact with durability y to the army. After each query, determine the maximum number of rounds that Monocarp can survive if he distributes the artifacts optimally. \n\n# Input format:\nThe first line contains one integer q (1 ≤ q ≤ 3 · 10^5) — the number of queries. In the i-th of the following q lines, there are two integers t_i and v_i (t_i ∈ {1, 2}; 1 ≤ v_i ≤ 10^9) — the type of the query and the value of the query parameter. If the type is 1, a hero with health v_i is added. If the type is 2, an artifact with durability v_i is added.\n\n# Output format:\nPrint q integers. After each query, output the maximum number of rounds that Monocarp can survive if he distributes the artifacts optimally.\n\n## Sample Input 1\n\n3\n2 5\n1 4\n1 10\n\n\n## Sample Output 1\n\n0\n8\n19\n\n\n## Sample Input 2\n\n10\n1 9\n1 6\n2 4\n1 8\n1 3\n2 10\n1 3\n1 6\n1 10\n2 6\n\n\n## Sample Output 2\n\n9\n15\n19\n27\n30\n39\n42\n48\n59\n65\n\n\n")
    print(interpreter.messages)

inerpreter_test()

result

Jupyter error, retrying: litellm.APIError: AzureException APIError - argument of type 'NoneType' is not iterable

Reproduce

You can run the code above. However, it seems like this bug can occur randomly and once it occurs, I can not obtain the results

Expected behavior

Please solve the bug.

Screenshots

No response

Open Interpreter version

0.4.3

Python version

3.10.15

Operating System name and version

Debian GNU/Linux 10

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions