Conlist() got an unexpected keyword argument 'min_items'


I am trying out the ungraded in Week 2 of Course 4 which is ## Deploying Machine Learning Models in Production in " [Machine Learning Engineering for Production (MLOps) Specialization]

The ungraded lab for with-batch

The pydandic package does not seem to work. My docker run gives me the following error
conlist() got an unexpected keyword argument ‘min_items’.

I tried various versions of pydantic and fastAPI but could not get the docker image to work.

Could you please help?

Full error is
vijayrajan@Vijays-MBP:~/Desktop/MLOps/4. deploying-machine-learning-models-in-production/Week-2/1. Model Serving Architecture/lab/machine-learning-engineering-for-production-public/course4/week2-ungraded-labs/C4_W2_Lab_1_FastAPI_Docker/with-batch|main​:zap: ⇒ docker run --rm -p 81:80 mlepc4w2-ugl:with-batch
WARNING: The requested image’s platform (linux/amd64) does not match the detected host platform (linux/arm64/v8) and no specific platform was requested
Traceback (most recent call last):
File “/opt/conda/bin/uvicorn”, line 8, in
File “/opt/conda/lib/python3.7/site-packages/click/”, line 1157, in call
return self.main(*args, **kwargs)
File “/opt/conda/lib/python3.7/site-packages/click/”, line 1078, in main
rv = self.invoke(ctx)
File “/opt/conda/lib/python3.7/site-packages/click/”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/conda/lib/python3.7/site-packages/click/”, line 783, in invoke
return __callback(*args, **kwargs)
File “/opt/conda/lib/python3.7/site-packages/uvicorn/”, line 456, in main
File “/opt/conda/lib/python3.7/site-packages/uvicorn/”, line 578, in run
File “/opt/conda/lib/python3.7/site-packages/uvicorn/”, line 61, in run
File “/opt/conda/lib/python3.7/asyncio/”, line 43, in run
return loop.run_until_complete(main)
File “/opt/conda/lib/python3.7/asyncio/”, line 587, in run_until_complete
return future.result()
File “/opt/conda/lib/python3.7/site-packages/uvicorn/”, line 68, in serve
File “/opt/conda/lib/python3.7/site-packages/uvicorn/”, line 473, in load
self.loaded_app = import_from_string(
File “/opt/conda/lib/python3.7/site-packages/uvicorn/”, line 21, in import_from_string
module = importlib.import_module(module_str)
File “/opt/conda/lib/python3.7/importlib/”, line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File “”, line 1006, in _gcd_import
File “”, line 983, in _find_and_load
File “”, line 967, in _find_and_load_unlocked
File “”, line 677, in _load_unlocked
File “”, line 728, in exec_module
File “”, line 219, in _call_with_frames_removed
File “/app/”, line 11, in
class Wine(BaseModel):
File “/app/”, line 12, in Wine
batches: List[conlist(item_type=float, min_items=13, max_items=13)]
TypeError: conlist() got an unexpected keyword argument ‘min_items’

Please use this:

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

The staff have been notified to fix this. Thanks for bringing this up.