diff --git a/README.md b/README.md index 96f2d5faa1..79202079e0 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,8 @@ class MyDocument(BaseDoc): image_url: ImageUrl # could also be VideoUrl, AudioUrl, etc. image_tensor: Optional[ TorchTensor[1704, 2272, 3] - ] # could also be NdArray or TensorflowTensor - embedding: Optional[TorchTensor] + ] = None # could also be NdArray or TensorflowTensor + embedding: Optional[TorchTensor] = None ``` So not only can you define the types of your data, you can even **specify the shape of your tensors!** @@ -643,8 +643,8 @@ import tensorflow as tf class Podcast(BaseDoc): - audio_tensor: Optional[AudioTensorFlowTensor] - embedding: Optional[AudioTensorFlowTensor] + audio_tensor: Optional[AudioTensorFlowTensor] = None + embedding: Optional[AudioTensorFlowTensor] = None class MyPodcastModel(tf.keras.Model): @@ -713,6 +713,7 @@ async def create_item(doc: InputDoc) -> OutputDoc: ) return doc + input_doc = InputDoc(text='', img=ImageDoc(tensor=np.random.random((3, 224, 224)))) async with AsyncClient(app=app, base_url="http://test") as ac: diff --git a/tests/documentation/test_docs.py b/tests/documentation/test_docs.py index df1ae1a282..f5940a3acc 100644 --- a/tests/documentation/test_docs.py +++ b/tests/documentation/test_docs.py @@ -70,7 +70,6 @@ def test_files_good(fpath): check_md_file(fpath=fpath, memory=True, keyword_ignore=['pickle', 'jac']) -@pytest.mark.skipif(is_pydantic_v2, reason="Not working with pydantic v2 for now") def test_readme(): check_md_file( fpath='README.md',