Find answers from the community

Updated last month

Metadata assignment in document object

At a glance

The community member is trying to assign a string of file paths to the 'appendix' key in the metadata of a Document object, but is encountering an issue where the metadata is either empty or a list. The community members discuss potential solutions, such as using a list of strings instead of a concatenated string, and confirm that assigning a list should work. However, there is no explicitly marked answer in the comments.

Hello everyone! Did anyone encounter weird behavior from metadata assignment in Document object?

I am trying to pass 'appendix' key and a string value, which is a string of paths with a '';'' separator, but for some reason it does not work. For example I am essentially trying to do this:

'appendix': '\folder1\file1; \folder1\file2; \folder1\file3'

I did print out those strings and they do properly display.
W
i
18 comments
hey what error did you face?
no error, just empty appendix
lemme explain a bit more
Essentially I am trying to parse some html and xml files
and they have appendix files, some documents pdf, docx, whatever
and I am trying to get the path to those documents, and write it into metadata of the document (html or xml data)
I tried passing them to metadata as a list of strings, and as a single concatenated string
but it doesn't do anything
essentially:
Document(
text=text
metadata={
'appendix': path
}
)
then to check I do document.metadata['appendix']
it returns me either empty string or empty list
Concatenated one too
can you assign a list to it?
yep it should work
I will double check my code
Add a reply
Sign up and join the conversation on Discord