Skip to content
New issue

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

Updates MongoDBGraphStore.__init__ signature #83

Merged
merged 4 commits into from
Feb 25, 2025

Conversation

caseyclements
Copy link
Collaborator

Update signature of constructor to remove positional arguments, allows one of collection, or connection_string, database_name, and collection_name.

Link to a passing patch

"db.create_collection.(coll_name, validator={'$jsonSchema': schema.entity_schema})"
)
else:
client: MongoClient = MongoClient(
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can't assume that the collection doesn't already exist just because we're creating the client.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@blink1073 This is inside a warning message.

Copy link
Collaborator

Choose a reason for hiding this comment

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

My question is: if the collection already exists, what is the behavior here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Actually, I see what happens now. There would be no validation added. I think we need to always attempt to add validation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We do attempt. It's in a try/except block. Let's discuss on slack if we want to delay release of a version for this.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We do not attempt for a collection that already exists, which may have been created by the user, no?

@caseyclements
Copy link
Collaborator Author

Link to a new passing patch after additional cases of adding validation

Copy link
Collaborator

@blink1073 blink1073 left a comment

Choose a reason for hiding this comment

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

LGTM!

@caseyclements caseyclements merged commit 964277e into langchain-ai:main Feb 25, 2025
11 checks passed
@caseyclements caseyclements deleted the graphrag-new-signature branch February 25, 2025 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants