-
Notifications
You must be signed in to change notification settings - Fork 131
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
feat: Add LangfuseConnector secure key management and serialization #1287
Conversation
Let's ask @ArzelaAscoIi for some input. @ArzelaAscoIi please see this comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks quite good to me already. My change requests are only about the tests.
In addition to my inline comments about monkeypatch.setenv for unit tests, let's add a unit test to check backwards compatibility of the serialization and use
monkeypatch.delenv("LANGFUSE_SECRET_KEY", raising=False)
monkeypatch.delenv("LANGFUSE_PUBLIC_KEY", raising=False)
to make sure env variables are not set for this test.
|
||
|
||
def test_pipeline_serialization(): | ||
"""Test that a pipeline with secrets can be properly serialized and deserialized""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we expect the envs to be set for this unit test, let's use monkeypatch.setenv, for OPENAI_API_KEY too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes here it makes sense as it is unit test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I mixed up a few things. Only one change request remains.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! 👍
…1287) * LangfuseConnector: add secret_key and public_key init params * Update tests * Linting * Add serde test * Lint * PR feedback * PR feedback
Why:
Enhances the
LangfuseConnector
by introducing secure handling of API keys through environment variables, improving security and flexibility in configuration.What:
public_key
andsecret_key
parameters to the LangfuseConnector's constructor, utilizing environment variables for secure access.to_dict
andfrom_dict
methods for serialization and deserialization of the connector, facilitating easier configuration management.How can it be used:
The
LangfuseConnector
can now be initialized with secure keys retrieved from environment variables, enhancing security in production environments. Here's how it looks:How did you test it:
Integration tests were updated to validate the new key management features by creating pipeline fixtures that utilize both environment variables and Secret objects. This ensures that the connector behaves as expected under different configurations.
Notes for the reviewer:
Please pay special attention to the new serialization methods and how the environment variables are handled in tests. Ensure that the key management complies with best security practices and that the changes integrate seamlessly with existing features.