-
Notifications
You must be signed in to change notification settings - Fork 175
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
Normalize client
usage
#1173
Normalize client
usage
#1173
Conversation
Codecov ReportAttention: Patch coverage is 📢 Thoughts on this report? Let us know! |
2858f4e
to
6adac93
Compare
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.
Nice work, just a couple minor things
CHANGELOG.md
Outdated
- **BREAKING**: Renamed parameter `bedrock_client` on `AmazonBedrockCohereEmbeddingDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `bedrock_client` on `AmazonBedrockTitanEmbeddingDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `bedrock_client` on `AmazonBedrockImageGenerationDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `bedrock_client` on `AmazonBedrockImageQueryDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `bedrock_client` on `AmazonBedrockPromptDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `sagemaker_client` on `AmazonSageMakerJumpstartEmbeddingDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `sagemaker_client` on `AmazonSageMakerJumpstartPromptDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `sqs_client` on `AmazonSqsEventListenerDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `iotdata_client` on `AwsIotCoreEventListenerDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `s3_client` on `AmazonS3FileManagerDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `s3_client` on `AwsS3Tool` to `client`. | ||
- **BREAKING**: Renamed parameter `pusher_client` on `PusherEventListenerDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `mq` on `MarqoVectorStoreDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `model_client` on `GooglePromptDriver` to `client`. | ||
- **BREAKING**: Renamed parameter `model_client` on `GoogleTokenizer` to `client`. | ||
- **BREAKING**: Renamed parameter `pipe` on `HuggingFacePipelinePromptDriver` to `text_generation_pipeline`. | ||
- **BREAKING**: Renamed parameter `engine` on `PgVectorVectorStoreDriver` to `sqlalchemy_engine`. |
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.
Let's move this under a single BREAKING
item with a nested list.
_text_generation_pipeline: TextGenerationPipeline = field( | ||
default=None, kw_only=True, alias="text_generation_pipeline", metadata={"serializable": False} | ||
) |
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.
I know I'm contradicting a point I made offline, but what if we change this to support non-text generation pipelines in the future? Maybe it's better to name off the base class: Pipeline
.
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.
yeah went back and forth, will update
table_name: str = field(kw_only=True, metadata={"serializable": True}) | ||
_model: Any = field(default=Factory(lambda self: self.default_vector_model(), takes_self=True)) | ||
_sqlalchemy_engine: sqlalchemy.Engine = field(default=None, kw_only=True, metadata={"serializable": False}) |
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.
I think this can stay as engine
.
default=Factory(lambda self: self.session.client("bedrock-runtime"), takes_self=True), | ||
kw_only=True, | ||
) | ||
_client: Any = field(default=None, kw_only=True, alias="client", metadata={"serializable": False}) |
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.
Can we add types to all the Amazon Drivers or does that break tests?
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.
will give it a shot
4d2f81f
to
4b7eee2
Compare
19460b6
to
dde87f2
Compare
closes #1174 |
Describe your changes
This normalizes the usage and naming of API clients in various drivers throughout the framework.
Today, any parameters set after init on any drivers that use a
client
are ignored because theclient
is typically initialized during driver initialization via an attrsFactory
. Adding@lazy_property
to the clients allow for making parameter modifications on theDriver
before the client is used, namely in the globalDefaults
object. see #1174 for an example.Issue ticket number and link
#1174