feat: docarray fastapi simple integration#1320
Merged
jupyterjazz merged 9 commits intofeat-rewrite-v2from Mar 31, 2023
Merged
Conversation
Signed-off-by: jupyterjazz <[email protected]>
Signed-off-by: jupyterjazz <[email protected]>
Signed-off-by: jupyterjazz <[email protected]>
Signed-off-by: jupyterjazz <[email protected]>
Signed-off-by: jupyterjazz <[email protected]>
Signed-off-by: jupyterjazz <[email protected]>
samsja
reviewed
Mar 31, 2023
samsja
reviewed
Mar 31, 2023
samsja
reviewed
Mar 31, 2023
Signed-off-by: jupyterjazz <[email protected]>
Signed-off-by: jupyterjazz <[email protected]>
Signed-off-by: jupyterjazz <[email protected]>
|
📝 Docs are deployed on https://ft-feat-simple-fastapi-integration--jina-docs.netlify.app 🎉 |
samsja
reviewed
Mar 31, 2023
| """ | ||
| Convert itself into a json compatible object | ||
| """ | ||
| ... |
Member
There was a problem hiding this comment.
should not it still return self by default ?
Contributor
Author
There was a problem hiding this comment.
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
samsja
approved these changes
Mar 31, 2023
RStar2022
pushed a commit
to RStar2022/docarray
that referenced
this pull request
Apr 2, 2023
* refactor: docarray fastapi simple integration Signed-off-by: jupyterjazz <[email protected]> * refactor: custom orjson response class Signed-off-by: jupyterjazz <[email protected]> * refactor: docarray response name Signed-off-by: jupyterjazz <[email protected]> * refactor: simplify from json Signed-off-by: jupyterjazz <[email protected]> * test: refactor tests Signed-off-by: jupyterjazz <[email protected]> * refactor: adjust type hint Signed-off-by: jupyterjazz <[email protected]> * refactor: use orjson Signed-off-by: jupyterjazz <[email protected]> * style: mypy errors Signed-off-by: jupyterjazz <[email protected]> * refactor: abstract method Signed-off-by: jupyterjazz <[email protected]> --------- Signed-off-by: jupyterjazz <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Presenting a simple way to use docarray with FastAPI as other approaches turned out to be more complicated.
Basically, FastAPI will treat our request as a
List[DocType]so you'll have to cast it toDocArrayinside the function, and in case you want to return yourDocArray, return it as aListand read it withfrom_json.We can definitely improve this procedure. I'll create a followup ticket and write down all the learnings I got from experimenting with different approaches this week.