C4W2_lab1_FastAPI_Docker

Hello. Whenever I am trying to work on batch prediction the following error is showing up.
Any lead on how to solve this issue.

This error says min_items keyword (probably used for a parameter) is not right! Check if thats a variable on your work book.

yes that was given on the repo code itself. I do not know what to use instead.

I dont know either what to recomend at this point.

I am experiencing the same issue. Did you identify a fix?

Hi all,

I noticed that this is the second part of the lab with batches.

The lab specifies these modifications need to be made to the Wine class:

Now you will modify the Wine class. It used to represent a wine but now it will represent a batch of wines. To accomplish this you can set the attribute batches and specify that it will be of type List of conlists. Since FastAPI enforces types of objects you need to explicitly specify them. In this case you know that the batch will be a list of arbitrary size but you also need to specify the type of the elements within that list. You could do a List of Lists of floats but there is a better alternative, using pydantic’s conlist. The “con” prefix stands for constrained, so this is a constrained list. This type allows you to select the type of the items within the list and also the maximum and minimum number of items. In this case your model was trained using 13 features so each data point should be of size 13:

# Represents a batch of wines 
class Wine(BaseModel): 
    batches: List[conlist(item_type=float, min_items=13, max_items=13)]

Hope this helps!

Sam

this code is exactly what is in the main.py and the error still shows

Hi @Nnaemeka_Nwankwo @TimJ @Waliur_Rahman !

It seems Pydantic has changed the keyword arguments for conlist()
In

batches: List[conlist(item_type=float, min_items=13, max_items=13)]

please change
min_items → min_length
max_items → max_length

batches: List[conlist(item_type=float, min_length=13, max_length=13)]

I’ll inform the course instructors of this change.

Hope this helps!

Sam