I got the error "AttributeError: 'NoneType' object has no attribute 'content'" while learning Llama Stack Inference

As stated in title, I’ve seen this error here:
https://learn.deeplearning.ai/courses/introducing-multimodal-llama-3-2/lesson/8/llama-stack

Here’s the screenshots:


How can I fix it?

I am having the same issue. I thought the problem was the together API so I signed up on their website, replaced the environment variable that stores the key with my own and it still gave the same error. I also tried to run the iterator outside the run_main function and without streaming and got the following error on calling next twice:

client = LlamaStackClient(
        base_url=LLAMA_STACK_API_TOGETHER_URL,
    )
iterator = client.inference.chat_completion(
        messages=[
            UserMessage(
                content="Who wrote the book Innovator's Dilemma? How about Charlotte's Web?",
                role="user",
            ),

            UserMessage(
                content="which book was published first?",
                role="user",
            ),
        ],
        model=LLAMA31_8B_INSTRUCT,
        stream=True
    )
next(iterator)
ChatCompletionResponse(completion_message=None, logprobs=None, error={'message': '500: Internal server error: An unexpected error occurred.'})
1 Like