-
Notifications
You must be signed in to change notification settings - Fork 94
Add embed
to Index configure
calls
#515
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
16 commits
Select commit
Hold shift + click to select a range
17ef903
add ConfigureIndexEmbed model and allow passing in IndexResource conf…
austin-denoble 21c2b06
move to using a simpler ConfigureIndexEmbed(TypedDict) class, update …
austin-denoble 5fec10b
Merge remote-tracking branch 'origin/main' into adenoble/add-embed-to…
austin-denoble 7f279ca
lint format
austin-denoble a5035df
export db_control types from the top of the package, make sure to pas…
austin-denoble 5b6476e
add embed to top level Pinecone configure_index method, update legacy…
austin-denoble 5a4487a
Merge remote-tracking branch 'origin/main' into adenoble/add-embed-to…
austin-denoble f00c752
Merge remote-tracking branch 'origin/main' into adenoble/add-embed-to…
austin-denoble 448a9f6
Merge remote-tracking branch 'origin/main' into adenoble/add-embed-to…
austin-denoble 7b1146b
expose embed on asyncio configure method
austin-denoble 77a2118
add integration tests for integrated inference upgrade path
austin-denoble 107a1cd
fix assertions in embed integration tests
austin-denoble 48db04e
add black defaults in pyproject.toml, undo a bunch of the <100 line b…
austin-denoble 4058f24
lint
austin-denoble 570c5ff
use proper fixture name in sync resources test
austin-denoble b4ab820
fix resource test
austin-denoble 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
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
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
from .create_index_for_model_embed import CreateIndexForModelEmbedTypedDict | ||
from .configure_index_embed import ConfigureIndexEmbed | ||
|
||
__all__ = ["CreateIndexForModelEmbedTypedDict"] | ||
__all__ = ["CreateIndexForModelEmbedTypedDict", "ConfigureIndexEmbed"] |
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,8 @@ | ||
from typing import TypedDict, Dict, Any, Optional | ||
|
||
|
||
class ConfigureIndexEmbed(TypedDict): | ||
model: str | ||
field_map: Dict[str, str] | ||
read_parameters: Optional[Dict[str, Any]] | ||
write_parameters: Optional[Dict[str, Any]] |
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
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
27 changes: 27 additions & 0 deletions
27
tests/integration/control/serverless/test_configure_index_embed.py
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,27 @@ | ||
class TestConfigureIndexEmbed: | ||
def test_convert_index_to_integrated(self, client, create_sl_index_params): | ||
name = create_sl_index_params["name"] | ||
create_sl_index_params["dimension"] = 1024 | ||
client.create_index(**create_sl_index_params) | ||
desc = client.describe_index(name) | ||
assert desc.embed is None | ||
|
||
embed_config = { | ||
"model": "multilingual-e5-large", | ||
"field_map": {"text": "chunk_text"}, | ||
} | ||
client.configure_index(name, embed=embed_config) | ||
|
||
desc = client.describe_index(name) | ||
assert desc.embed.model == "multilingual-e5-large" | ||
assert desc.embed.field_map == {"text": "chunk_text"} | ||
assert desc.embed.read_parameters == {"input_type": "query", "truncate": "END"} | ||
assert desc.embed.write_parameters == { | ||
"input_type": "passage", | ||
"truncate": "END", | ||
} | ||
assert desc.embed.vector_type == "dense" | ||
assert desc.embed.dimension == 1024 | ||
assert desc.embed.metric == "cosine" | ||
|
||
client.delete_index(name) |
31 changes: 31 additions & 0 deletions
31
tests/integration/control_asyncio/test_configure_index_embed.py
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,31 @@ | ||
from pinecone import PineconeAsyncio | ||
|
||
|
||
class TestConfigureIndexEmbed: | ||
async def test_convert_index_to_integrated(self, create_sl_index_params): | ||
pc = PineconeAsyncio() | ||
name = create_sl_index_params["name"] | ||
create_sl_index_params["dimension"] = 1024 | ||
await pc.create_index(**create_sl_index_params) | ||
desc = await pc.describe_index(name) | ||
assert desc.embed is None | ||
|
||
embed_config = { | ||
"model": "multilingual-e5-large", | ||
"field_map": {"text": "chunk_text"}, | ||
} | ||
await pc.configure_index(name, embed=embed_config) | ||
|
||
desc = await pc.describe_index(name) | ||
assert desc.embed.model == "multilingual-e5-large" | ||
assert desc.embed.field_map == {"text": "chunk_text"} | ||
assert desc.embed.read_parameters == {"input_type": "query", "truncate": "END"} | ||
assert desc.embed.write_parameters == { | ||
"input_type": "passage", | ||
"truncate": "END", | ||
} | ||
assert desc.embed.vector_type == "dense" | ||
assert desc.embed.dimension == 1024 | ||
assert desc.embed.metric == "cosine" | ||
|
||
await pc.delete_index(name) |
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.
what's the reason for adding ConfigureIndexEmbed and CreateIndexForModelEmbedTypedDict here?
Uh oh!
There was an error while loading. Please reload this page.
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.
Adding the classes to
_db_control_lazy_imports
, which we seem to do for all of our custom models and types. It seemed likeCreateIndexForModelEmbedTypedDict
was also not included here, so I added it.This is to allow lazy loaded imports to be exported from the top level of the package here:
pinecone-python-client/pinecone/__init__.py
Line 145 in dfd0125
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 I was wondering why we added types here but here's the reason why:
#507 (comment)