We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I have the following code where I create an index from documents and then fetch a node.
const index = await VectorStoreIndex.fromDocuments(documents, { serviceContext: this.getServiceContext() }) // some other stuff const node = await index.docStore.getDocument('some-node-id', false);
The returned node doesn't have relationship information. Is this on purpose?
It seems like it is not being included when converting JSON to a TextNode in storage/docStore/utils.ts
storage/docStore/utils.ts
export function jsonToDoc(docDict) { const docType = docDict[TYPE_KEY]; const dataDict = JSON.parse(docDict[DATA_KEY]); let doc; if (docType === ObjectType.DOCUMENT) { doc = new Document({ text: dataDict.text, id_: dataDict.id_, embedding: dataDict.embedding, hash: dataDict.hash, metadata: dataDict.metadata, }); } else if (docType === ObjectType.TEXT) { doc = new TextNode({ text: dataDict.text, id_: dataDict.id_, hash: dataDict.hash, metadata: dataDict.metadata, // relationships: dataDict.relationships, # not in existing code }); } else { throw new Error(`Unknown doc type: ${docType}`); } return doc; }
Curious if this is done for a specific reason, and if there are any recommended ways to fetch nodes from an index while retaining their relationships.
The text was updated successfully, but these errors were encountered:
@garviand yes this looks wrong. Great catch! Want to send a PR?
Sorry, something went wrong.
@marcusschiesser sure! I should have time in the next couple of days.
No branches or pull requests
Hi, I have the following code where I create an index from documents and then fetch a node.
The returned node doesn't have relationship information. Is this on purpose?
It seems like it is not being included when converting JSON to a TextNode in
storage/docStore/utils.ts
Curious if this is done for a specific reason, and if there are any recommended ways to fetch nodes from an index while retaining their relationships.
The text was updated successfully, but these errors were encountered: