ragna icon indicating copy to clipboard operation
ragna copied to clipboard

`/answer` does not return `Document` metadata

Open nenb opened this issue 1 year ago • 2 comments

Bug description

(I'm not sure if this is a bug or just user error, or deliberately intended.)

When I store Document metadata in the database, it's not returned when I make a request to /answer. This is unfortunate as the metadata contains lots of useful information about the data source that I would like to display.

How to reproduce the bug?

Upload a single document with metadata.

Make a request to /answer and inspect the response.

Versions and dependencies used

All

Anything else?

No response

nenb avatar Mar 12 '24 01:03 nenb

/chats/{id}/answer

https://github.com/Quansight/ragna/blob/4a667f9aced1970f8eab8aa9e01aaf8c67b05db0/ragna/deploy/_api/core.py#L258-L264

returns a Message

https://github.com/Quansight/ragna/blob/4a667f9aced1970f8eab8aa9e01aaf8c67b05db0/ragna/deploy/_api/schemas.py#L54-L61

So, directly, no document is returned here at all. The document is part of the Sources that are being returned

https://github.com/Quansight/ragna/blob/4a667f9aced1970f8eab8aa9e01aaf8c67b05db0/ragna/deploy/_api/schemas.py#L35-L41

Finally we arrive at the Document that indeed does not contain the metadata

https://github.com/Quansight/ragna/blob/4a667f9aced1970f8eab8aa9e01aaf8c67b05db0/ragna/deploy/_api/schemas.py#L18-L20

Since we do have the metadata in the DB already, it shouldn't be too hard to link it back to the Document model. Doing that should fix this.

pmeier avatar Mar 12 '24 13:03 pmeier

I've played around with it for a bit and I think this is more a feature request than a bug. That being said, I think the change is for the better. I started a branch in #355. However, this includes breaking changes. I'd rather wait after the 0.2.0 release to merge this.

pmeier avatar Mar 12 '24 14:03 pmeier