Skip to content

Commit 061bd81

Browse files
authored
docs: fix documentation for pydantic v2 (#1815)
Signed-off-by: samsja <[email protected]>
1 parent 3da3603 commit 061bd81

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ class MyDocument(BaseDoc):
111111
image_url: ImageUrl # could also be VideoUrl, AudioUrl, etc.
112112
image_tensor: Optional[
113113
TorchTensor[1704, 2272, 3]
114-
] # could also be NdArray or TensorflowTensor
115-
embedding: Optional[TorchTensor]
114+
] = None # could also be NdArray or TensorflowTensor
115+
embedding: Optional[TorchTensor] = None
116116
```
117117

118118
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
643643

644644

645645
class Podcast(BaseDoc):
646-
audio_tensor: Optional[AudioTensorFlowTensor]
647-
embedding: Optional[AudioTensorFlowTensor]
646+
audio_tensor: Optional[AudioTensorFlowTensor] = None
647+
embedding: Optional[AudioTensorFlowTensor] = None
648648

649649

650650
class MyPodcastModel(tf.keras.Model):
@@ -713,6 +713,7 @@ async def create_item(doc: InputDoc) -> OutputDoc:
713713
)
714714
return doc
715715

716+
716717
input_doc = InputDoc(text='', img=ImageDoc(tensor=np.random.random((3, 224, 224))))
717718

718719
async with AsyncClient(app=app, base_url="http://test") as ac:

tests/documentation/test_docs.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ def test_files_good(fpath):
7070
check_md_file(fpath=fpath, memory=True, keyword_ignore=['pickle', 'jac'])
7171

7272

73-
@pytest.mark.skipif(is_pydantic_v2, reason="Not working with pydantic v2 for now")
7473
def test_readme():
7574
check_md_file(
7675
fpath='README.md',

0 commit comments

Comments
 (0)