Skip to content

fix: handle proprely document json in fast api response#1004

Merged
samsja merged 18 commits intofeat-rewrite-v2from
fix-fastapi-bug
Jan 10, 2023
Merged

fix: handle proprely document json in fast api response#1004
samsja merged 18 commits intofeat-rewrite-v2from
fix-fastapi-bug

Conversation

@samsja
Copy link
Copy Markdown
Member

@samsja samsja commented Jan 10, 2023

Context

this PR fix several bug related to docarray, orjson and FastAPI

this is now working and return the proper tensor

     from docarray.document import DocumenResponse

    @app.post("/doc/", response_model=OutputDoc, response_class=DocumentResponse)
    async def create_item(doc: InputDoc) -> OutputDoc:
        ## call my fancy model to generate the embeddings
        doc = OutputDoc(
            embedding_clip=np.zeros((100, 1)), embedding_bert=np.zeros((100, 1))
        )
        return doc

@samsja samsja changed the title Fix fastapi bug fix: handle proprely document json in fast api response Jan 10, 2023
Signed-off-by: Sami Jaghouar <[email protected]>
Signed-off-by: Sami Jaghouar <[email protected]>
Copy link
Copy Markdown
Member

@JohannesMessner JohannesMessner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you have to rebase with the new file structure with docarray.documents etc

Copy link
Copy Markdown
Member

@JohannesMessner JohannesMessner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

already approving so we don't have to go back and forth 1M times

Signed-off-by: Sami Jaghouar <[email protected]>
@samsja samsja merged commit 56434bf into feat-rewrite-v2 Jan 10, 2023
@samsja samsja deleted the fix-fastapi-bug branch January 10, 2023 16:37
@github-actions
Copy link
Copy Markdown

📝 Docs are deployed on https://ft-fix-fastapi-bug--jina-docs.netlify.app 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants