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

community: Add Snowflake model session handling via keyfile and external sessions #27664

Closed

Conversation

zaramzamzam
Copy link

@zaramzamzam zaramzamzam commented Oct 27, 2024

Description

  • Implement session creation using keyfile for secure access without password

    • Keyfiles can be encrypted, with passwords stored in SNOWFLAKE_KEYFILE_PASSWORD
  • Add session as a parameter for external session management

    • Enables running langchain inside Snowflake with existing session handling
    • External sessions passed to the model are not closed on completion
  • Added comprehensive tests:

    • Session creation tests (keyfile, parameter-passed sessions)
    • Tests for varied environment variables and session configurations
  • Updated the documentation at snowflake.ipynb

Copy link

vercel bot commented Oct 27, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 12, 2024 8:16pm

@zaramzamzam zaramzamzam marked this pull request as ready for review October 27, 2024 07:16
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. community Related to langchain-community labels Oct 27, 2024
@zaramzamzam
Copy link
Author

Hi,

I added some more options to connect to the Snowflake models, but I can only integration test the variant of adding the Session directly and connecting via a keyfile.

@efriis
Copy link
Member

efriis commented Oct 31, 2024

cc @sfc-gh-nmoiseyev - I think this should be done as part of the move of the snowflake chat models to the integration package https://github.com/langchain-ai/langchain-snowflake

@zaramzamzam
Copy link
Author

Hi,

I hope the latest commit fixes the errors in the CI/CD pipeline.

For the unittests I mock the package import now which is a bit ugly. Maybe someone has a better idea.

For the integrationtests I removed the option to pass a Session to the model.

  • this removes the need to have snowpark installed
  • this results in not testing this passing of a session directly

@zaramzamzam
Copy link
Author

I think now all checks should succeed 🤞

- Implement session creation using keyfile for secure access without password
  - Keyfiles can be encrypted, with passwords stored in SNOWFLAKE_KEYFILE_PASSWORD
- Add session as a parameter for external session management
  - Enables running langchain inside Snowflake with existing session handling
  - External sessions passed to the model are not closed on completion
- Added comprehensive tests:
  - Session creation tests (keyfile, parameter-passed sessions)
  - Tests for varied environment variables and session configurations
- this removes the need to have the snowflake package installed
- but this results in the issue of not testing passing a session
@zaramzamzam
Copy link
Author

Looks like I forgot to run make format again.

Is there a possibility to have make format, make lint run before commit?
I could not see any pre-commit config.

@efriis
Copy link
Member

efriis commented Dec 16, 2024

believe some of the session mechanics were superceded by #27753 - if you want to reopen with just the changes related to aliasing feel free!

@efriis efriis closed this Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Related to langchain-community size:L This PR changes 100-499 lines, ignoring generated files.
Projects
Status: Closed
Development

Successfully merging this pull request may close these issues.

2 participants