Skip to content

Conversation

caseyclements
Copy link
Collaborator

@caseyclements caseyclements commented Oct 10, 2025

Issue Key

Summary

Changes in this PR

This is a small bugfix. When we switched from including OPENAI_API_KEY in CI secrets to using AZURE_OPENAI_ENDPOINTS, we missed this one.

Test Plan

  • Tests are run in github and evergreen. A passing patch build will be included.

Checklist

Checklist for Author

  • [ na] Did you update the changelog (if necessary)?
  • Is the intention of the code captured in relevant tests?
  • [na] If there are new TODOs, has a related JIRA ticket been created?
  • Has a MongoDB Employee run the patch build of this PR?

Checklist for Reviewer {@primary_reviewer}

  • Does the title of the PR reference a JIRA Ticket?
  • Do you fully understand the implementation? (Would you be comfortable explaining how this code works to someone else?)
  • Have you checked for spelling & grammar errors?
  • Is all relevant documentation (README or docstring) updated?

Focus Areas for Reviewer (optional)

The author had thought of updating MongoDBGraphStore to be a context manager. All this would do is close the client. We decided to leave it with a close method only.

@caseyclements caseyclements requested a review from Copilot October 10, 2025 19:17
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a testing configuration issue where the GraphRAG tests were only checking for OpenAI API key but not Azure OpenAI endpoint, and implements better resource management by using context managers and explicit client closing.

  • Updated test skip condition to check for both OPENAI_API_KEY and AZURE_OPENAI_ENDPOINT environment variables
  • Replaced manual client creation/closing with context managers for better resource management
  • Added explicit store.close() calls to properly clean up MongoDBGraphStore instances

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

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 pending a patch build

@caseyclements
Copy link
Collaborator Author

Passing Build

@caseyclements caseyclements merged commit 752fc2c into langchain-ai:main Oct 10, 2025
14 checks passed
caseyclements added a commit to caseyclements/langchain-mongodb that referenced this pull request Oct 13, 2025
…and cleaned up closing clients (langchain-ai#232)

[Issue Key](https://jira.mongodb.org/browse/{ISSUE_KEY})

<!-- What is this PR introducing? If context is already provided from
the JIRA ticket, still place it in the Pull Request as you should not
make the reviewer do digging for a basic summary. -->

<!-- What changes did you make to the code? What new APIs (public or
private) were added, removed, or edited to generate the desired outcome
explained in the above summary? -->

This is a small bugfix. When we switched from including OPENAI_API_KEY
in CI secrets to using AZURE_OPENAI_ENDPOINTS, we missed this one.

<!-- How did you test the code? If you added unit tests, you can say
that. If you didn’t introduce unit tests, explain why. All code should
be tested in some way – so please list what your validation strategy
was. -->

- Tests are run in github and evergreen. A passing patch build will be
included.

<!-- Do not delete the items provided on this checklist -->

- [ na] Did you update the changelog (if necessary)?
- [X] Is the intention of the code captured in relevant tests?
- [na] If there are new TODOs, has a related JIRA ticket been created?
- [X] Has a MongoDB Employee run [the patch build of this
PR](https://github.com/mongodb-labs/ai-ml-pipeline-testing?tab=readme-ov-file#running-a-patch-build-of-a-given-pr)?

- [x] Does the title of the PR reference a JIRA Ticket?
- [x] Do you fully understand the implementation? (Would you be
comfortable explaining how this code works to someone else?)
- [x] Have you checked for spelling & grammar errors?
- [x] Is all relevant documentation (README or docstring) updated?

<!-- List any complex portion of code you believe needs particular
scrutiny and explain why. -->
The author had thought of updating MongoDBGraphStore to be a context
manager. All this would do is close the client. We decided to leave it
with a close method only.
caseyclements added a commit to caseyclements/langchain-mongodb that referenced this pull request Oct 17, 2025
…and cleaned up closing clients (langchain-ai#232)

[Issue Key](https://jira.mongodb.org/browse/{ISSUE_KEY})

<!-- What is this PR introducing? If context is already provided from
the JIRA ticket, still place it in the Pull Request as you should not
make the reviewer do digging for a basic summary. -->

<!-- What changes did you make to the code? What new APIs (public or
private) were added, removed, or edited to generate the desired outcome
explained in the above summary? -->

This is a small bugfix. When we switched from including OPENAI_API_KEY
in CI secrets to using AZURE_OPENAI_ENDPOINTS, we missed this one.

<!-- How did you test the code? If you added unit tests, you can say
that. If you didn’t introduce unit tests, explain why. All code should
be tested in some way – so please list what your validation strategy
was. -->

- Tests are run in github and evergreen. A passing patch build will be
included.

<!-- Do not delete the items provided on this checklist -->

- [ na] Did you update the changelog (if necessary)?
- [X] Is the intention of the code captured in relevant tests?
- [na] If there are new TODOs, has a related JIRA ticket been created?
- [X] Has a MongoDB Employee run [the patch build of this
PR](https://github.com/mongodb-labs/ai-ml-pipeline-testing?tab=readme-ov-file#running-a-patch-build-of-a-given-pr)?

- [x] Does the title of the PR reference a JIRA Ticket?
- [x] Do you fully understand the implementation? (Would you be
comfortable explaining how this code works to someone else?)
- [x] Have you checked for spelling & grammar errors?
- [x] Is all relevant documentation (README or docstring) updated?

<!-- List any complex portion of code you believe needs particular
scrutiny and explain why. -->
The author had thought of updating MongoDBGraphStore to be a context
manager. All this would do is close the client. We decided to leave it
with a close method only.
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