Skip to content

docs: add docs for the dict() method #1560

@samsja

Description

@samsja

Context

we need to document the behavior of calling dict() on a BaseDoc. Especially with nested DocList.

class InnerDoc(BaseDoc):
    x: int

class MyDoc(BaseDoc):
    l: DocList[InnerDoc]

doc = MyDoc(l=[InnerDoc(x=1), InnerDoc(x=2)])
print(f'{doc.dict()=}')
#> doc_view.dict()={'id': 'ab65fc52a60d1da1ce6196c100943e1f', 'l': [{'id': 'e218c3a6904cbbd0f48ccd10130c9f78', 'x': 1}, {'id': 'e30bf3d613bf5c3e805faf0c0dc0f704', 'x': 2}]}

and we need to explain how using dict(doc) is different from using doc.dict()

Metadata

Metadata

Assignees

No one assigned

    Labels

    good-first-issueSuitable as your first contribution to DocArray!

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions