-
Notifications
You must be signed in to change notification settings - Fork 92
Speed up client initialization with lazy loading #473
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
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
aaa7104
Refactor PluginAware to do lazy loading
jhamon b3bc5a4
Fix unit test
jhamon 7b9b383
Add unit tests for PluginAware
jhamon 79c73a8
Add assistant plugin to dev deps
jhamon 7933e80
Refactoring
jhamon 2c6e1ce
Refactoring
jhamon a08ae73
WIP
jhamon 67323cb
WIP
jhamon b7bdd4f
WIP
jhamon 0584c63
Add missing exports
jhamon cd15bf9
Fix unit tests
jhamon 7fed334
Update lockfile
jhamon 85d4842
Add integration tests for reorg methods
jhamon 85c4839
Fix mypy errors
jhamon 93d1610
Fix test failures, lint errors
jhamon 8937278
Fix grpc unit tests
jhamon b5b3b85
Fix lint errors
jhamon 163cde7
Fix mypy errors and warnings
jhamon 7e94a40
Fix inference
jhamon 2d65da7
Fix data tests
jhamon f2a3e82
Fix mypy errors
jhamon 497b0f9
Add missing exports
jhamon 7a37ef5
Fix async tests
jhamon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
from pinecone.config import Config | ||
from pinecone.config import ConfigBuilder | ||
from pinecone.config import PineconeConfig | ||
from pinecone.inference import RerankModel | ||
from pinecone.inference import EmbedModel | ||
from pinecone.db_data.dataclasses import ( | ||
Vector, | ||
SparseValues, | ||
SearchQuery, | ||
SearchQueryVector, | ||
SearchRerank, | ||
) | ||
from pinecone.db_data.models import ( | ||
FetchResponse, | ||
DeleteRequest, | ||
DescribeIndexStatsRequest, | ||
IndexDescription as DescribeIndexStatsResponse, | ||
RpcStatus, | ||
ScoredVector, | ||
SingleQueryResults, | ||
QueryRequest, | ||
QueryResponse, | ||
UpsertResponse, | ||
UpdateRequest, | ||
) | ||
from pinecone.core.openapi.db_data.models import ImportErrorMode | ||
from pinecone.db_data.errors import ( | ||
VectorDictionaryMissingKeysError, | ||
VectorDictionaryExcessKeysError, | ||
VectorTupleLengthError, | ||
SparseValuesTypeError, | ||
SparseValuesMissingKeysError, | ||
SparseValuesDictionaryExpectedError, | ||
) | ||
from pinecone.db_control.enums import ( | ||
CloudProvider, | ||
AwsRegion, | ||
GcpRegion, | ||
AzureRegion, | ||
PodIndexEnvironment, | ||
Metric, | ||
VectorType, | ||
DeletionProtection, | ||
PodType, | ||
) | ||
from pinecone.db_control.models import ( | ||
CollectionDescription, | ||
CollectionList, | ||
IndexList, | ||
IndexModel, | ||
IndexEmbed, | ||
ServerlessSpec, | ||
ServerlessSpecDefinition, | ||
PodSpec, | ||
PodSpecDefinition, | ||
) | ||
from pinecone.pinecone import Pinecone | ||
from pinecone.pinecone_asyncio import PineconeAsyncio | ||
|
||
# Re-export all the types | ||
__all__ = [ | ||
# Primary client classes | ||
"Pinecone", | ||
"PineconeAsyncio", | ||
# Config classes | ||
"Config", | ||
"ConfigBuilder", | ||
"PineconeConfig", | ||
# Inference classes | ||
"RerankModel", | ||
"EmbedModel", | ||
# Data classes | ||
"Vector", | ||
"SparseValues", | ||
"SearchQuery", | ||
"SearchQueryVector", | ||
"SearchRerank", | ||
# Model classes | ||
"FetchResponse", | ||
"DeleteRequest", | ||
"DescribeIndexStatsRequest", | ||
"DescribeIndexStatsResponse", | ||
"RpcStatus", | ||
"ScoredVector", | ||
"SingleQueryResults", | ||
"QueryRequest", | ||
"QueryResponse", | ||
"UpsertResponse", | ||
"UpdateRequest", | ||
"ImportErrorMode", | ||
# Error classes | ||
"VectorDictionaryMissingKeysError", | ||
"VectorDictionaryExcessKeysError", | ||
"VectorTupleLengthError", | ||
"SparseValuesTypeError", | ||
"SparseValuesMissingKeysError", | ||
"SparseValuesDictionaryExpectedError", | ||
# Control plane enums | ||
"CloudProvider", | ||
"AwsRegion", | ||
"GcpRegion", | ||
"AzureRegion", | ||
"PodIndexEnvironment", | ||
"Metric", | ||
"VectorType", | ||
"DeletionProtection", | ||
"PodType", | ||
# Control plane models | ||
"CollectionDescription", | ||
"CollectionList", | ||
"IndexList", | ||
"IndexModel", | ||
"IndexEmbed", | ||
"ServerlessSpec", | ||
"ServerlessSpecDefinition", | ||
"PodSpec", | ||
"PodSpecDefinition", | ||
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This config gets evaluated during intialization, and loading the entire urllib3 package just to get access to a reference to these socket constants was adding a big penalty to our load time. So I decided to inline it and remove the urllib3 dep here.