Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions libs/langchain-community/src/graphs/neo4j_graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,20 +188,24 @@ function formatSchema(
}
} else {
// Format node properties
formattedNodeProps = schema.nodeProps.map((el: Record<string, Any>) => {
const propsStr = el.properties
.map((prop: Record<string, Any>) => `${prop.property}: ${prop.type} `)
.join(", ");
return `${el.labels} {${propsStr} } `;
});
formattedNodeProps = Object.entries(schema.nodeProps).map(
([key, value]: [string, Any]) => {
const propsStr = value
.map((prop: Record<string, Any>) => `${prop.property}: ${prop.type}`)
.join(", ");
return `${key} {${propsStr}}`;
}
);

// Format relationship properties
formattedRelProps = schema.relProps.map((el: Record<string, Any>) => {
const propsStr = el.properties
.map((prop: Record<string, Any>) => `${prop.property}: ${prop.type} `)
.join(", ");
return `${el.type} {${propsStr} } `;
});
formattedRelProps = Object.entries(schema.relProps).map(
([key, value]: [string, Any]) => {
const propsStr = value
.map((prop: Record<string, Any>) => `${prop.property}: ${prop.type} `)
.join(", ");
return `${key} {${propsStr} } `;
Copy link
Collaborator

@jacoblee93 jacoblee93 May 31, 2024

Choose a reason for hiding this comment

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

Is the extra space here a mistake?

Not a regression so won't block on it

}
);
}

// Format relationships
Expand Down