-
Notifications
You must be signed in to change notification settings - Fork 238
feat: docarray fastapi simple integration #1320
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
8688d1b
660ec31
bc5e56c
8e9c7c1
2e42176
4c0ab75
15183d5
8154a04
5908613
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,20 @@ | ||
| from abc import ABC, abstractmethod | ||
| from typing import TYPE_CHECKING | ||
| from typing import TYPE_CHECKING, TypeVar, Optional, Type | ||
|
|
||
| if TYPE_CHECKING: | ||
| from docarray.proto import NodeProto | ||
|
|
||
| T = TypeVar('T') | ||
|
|
||
|
|
||
| class BaseNode(ABC): | ||
| """ | ||
| A DocumentNode is an object than can be nested inside a Document. | ||
| A Document itself is a DocumentNode as well as prebuilt type | ||
| """ | ||
|
|
||
| _proto_type_name: Optional[str] = None | ||
|
|
||
| @abstractmethod | ||
| def _to_node_protobuf(self) -> 'NodeProto': | ||
| """Convert itself into a NodeProto message. This function should | ||
|
|
@@ -20,3 +24,14 @@ def _to_node_protobuf(self) -> 'NodeProto': | |
| :return: the nested item protobuf message | ||
| """ | ||
| ... | ||
|
|
||
| @classmethod | ||
| @abstractmethod | ||
| def from_protobuf(cls: Type[T], pb_msg: T) -> T: | ||
| ... | ||
|
|
||
| def _docarray_to_json_compatible(self): | ||
| """ | ||
| Convert itself into a json compatible object | ||
| """ | ||
| ... | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should not it still return self by default ?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or maybe not
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it's better to leave this abstract and define for each class that uses, otherwise we say self by default but override it in both IOmixin and BaseDoc class |
||
Uh oh!
There was an error while loading. Please reload this page.