Conlist() got an unexpected keyword argument 'min_items'

Hi

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 https://github.com/https-deeplearning-ai/machine-learning-engineering-for-production-public/tree/main/course4/week2-ungraded-labs/C4_W2_Lab_1_FastAPI_Docker/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
sys.exit(main())
File “/opt/conda/lib/python3.7/site-packages/click/core.py”, line 1157, in call
return self.main(*args, **kwargs)
File “/opt/conda/lib/python3.7/site-packages/click/core.py”, line 1078, in main
rv = self.invoke(ctx)
File “/opt/conda/lib/python3.7/site-packages/click/core.py”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/opt/conda/lib/python3.7/site-packages/click/core.py”, line 783, in invoke
return __callback(*args, **kwargs)
File “/opt/conda/lib/python3.7/site-packages/uvicorn/main.py”, line 456, in main
h11_max_incomplete_event_size=h11_max_incomplete_event_size,
File “/opt/conda/lib/python3.7/site-packages/uvicorn/main.py”, line 578, in run
server.run()
File “/opt/conda/lib/python3.7/site-packages/uvicorn/server.py”, line 61, in run
return asyncio.run(self.serve(sockets=sockets))
File “/opt/conda/lib/python3.7/asyncio/runners.py”, line 43, in run
return loop.run_until_complete(main)
File “/opt/conda/lib/python3.7/asyncio/base_events.py”, line 587, in run_until_complete
return future.result()
File “/opt/conda/lib/python3.7/site-packages/uvicorn/server.py”, line 68, in serve
config.load()
File “/opt/conda/lib/python3.7/site-packages/uvicorn/config.py”, line 473, in load
self.loaded_app = import_from_string(self.app)
File “/opt/conda/lib/python3.7/site-packages/uvicorn/importer.py”, line 21, in import_from_string
module = importlib.import_module(module_str)
File “/opt/conda/lib/python3.7/importlib/init.py”, 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/main.py”, line 11, in
class Wine(BaseModel):
File “/app/main.py”, 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.