Skip to content

Commit 7832dfc

Browse files
authored
feat: add attribution for pinecone (#3067)
### Summary - Updates the `pinecone-client` from v2 to v4 using the [client migration guide](https://canyon-quilt-082.notion.site/Pinecone-Python-SDK-v3-0-0-Migration-Guide-056d3897d7634bf7be399676a4757c7b#932ad98a2d33432cac4229e1df34d3d5). Version bump was required to [add attribution](https://pinecone-2-partner-integration-guide.mintlify.app/integrations/build-integration/attribute-api-activity) and will also enable use to support [serverless indexes](https://docs.pinecone.io/reference/pinecone-clients#initialize) - Adds `"unstructured.{version}"` as the source tag for the connector ### Testing Destination connection tests [pass](https://github.com/Unstructured-IO/unstructured/actions/runs/9180305080/job/25244484432?pr=3067) with the updates.
1 parent b0d8a77 commit 7832dfc

File tree

7 files changed

+26
-46
lines changed

7 files changed

+26
-46
lines changed

CHANGELOG.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
## 0.14.2-dev0
2+
3+
### Enhancements
4+
5+
### Features
6+
7+
* Add attribution to the `pinecone` connector
8+
9+
### Fixes
10+
111
## 0.14.1
212

313
### Enhancements
@@ -13,7 +23,8 @@
1323
* Use the python client when calling the unstructured api for partitioning or chunking
1424
* Saving the final content is now a dedicated destination connector (local) set as the default if none are provided. Avoids adding new files locally if uploading elsewhere.
1525
* Leverage last modified date when deciding if new files should be downloaded and reprocessed.
16-
* **Add support for Python 3.12**. `unstructured` now works with Python 3.12!
26+
* Add attribution to the `pinecone` connector
27+
* **Add support for Python 3.12**. `unstructured` now works with Python 3.12!
1728

1829
### Fixes
1930

@@ -47,7 +58,7 @@
4758
* **Fix disk-space leak in `partition_odt()`.** Remove temporary file created but not removed when `file` argument is passed to `partition_odt()`.
4859
* **AstraDB: option to prevent indexing metadata**
4960
* **Fix Missing py.typed**
50-
61+
5162
## 0.13.7
5263

5364
### Enhancements

requirements/ingest/embed-huggingface.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ requests==2.32.1
152152
# transformers
153153
safetensors==0.4.3
154154
# via transformers
155-
scikit-learn==1.4.2
155+
scikit-learn==1.5.0
156156
# via sentence-transformers
157157
scipy==1.11.3
158158
# via

requirements/ingest/pinecone.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
-c ../deps/constraints.txt
22
-c ../base.txt
3-
pinecone-client==2.2.4
3+
pinecone-client>=3.7.1

requirements/ingest/pinecone.txt

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,43 +5,12 @@
55
# pip-compile ./ingest/pinecone.in
66
#
77
certifi==2024.2.2
8-
# via
9-
# -c ./ingest/../base.txt
10-
# -c ./ingest/../deps/constraints.txt
11-
# requests
12-
charset-normalizer==3.3.2
13-
# via
14-
# -c ./ingest/../base.txt
15-
# requests
16-
dnspython==2.6.1
17-
# via pinecone-client
18-
idna==3.7
19-
# via
20-
# -c ./ingest/../base.txt
21-
# requests
22-
loguru==0.7.2
23-
# via pinecone-client
24-
numpy==1.26.4
258
# via
269
# -c ./ingest/../base.txt
2710
# -c ./ingest/../deps/constraints.txt
2811
# pinecone-client
29-
pinecone-client==2.2.4
12+
pinecone-client==4.1.0
3013
# via -r ./ingest/pinecone.in
31-
python-dateutil==2.9.0.post0
32-
# via
33-
# -c ./ingest/../base.txt
34-
# pinecone-client
35-
pyyaml==6.0.1
36-
# via pinecone-client
37-
requests==2.32.1
38-
# via
39-
# -c ./ingest/../base.txt
40-
# pinecone-client
41-
six==1.16.0
42-
# via
43-
# -c ./ingest/../base.txt
44-
# python-dateutil
4514
tqdm==4.66.4
4615
# via
4716
# -c ./ingest/../base.txt
@@ -55,4 +24,3 @@ urllib3==1.26.18
5524
# -c ./ingest/../base.txt
5625
# -c ./ingest/../deps/constraints.txt
5726
# pinecone-client
58-
# requests

requirements/ingest/salesforce.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ requests==2.32.1
4848
# requests-toolbelt
4949
# simple-salesforce
5050
# zeep
51-
requests-file==2.0.0
51+
requests-file==2.1.0
5252
# via zeep
5353
requests-toolbelt==1.0.0
5454
# via zeep

unstructured/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.14.1" # pragma: no cover
1+
__version__ = "0.14.2-dev0" # pragma: no cover

unstructured/ingest/connector/pinecone.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,17 @@ def initialize(self):
7272

7373
@requires_dependencies(["pinecone"], extras="pinecone")
7474
def create_index(self) -> "PineconeIndex":
75-
import pinecone
75+
from pinecone import Pinecone
7676

77-
pinecone.init(
77+
from unstructured import __version__ as unstructured_version
78+
79+
pc = Pinecone(
7880
api_key=self.connector_config.access_config.api_key,
79-
environment=self.connector_config.environment,
80-
)
81-
index = pinecone.Index(self.connector_config.index_name)
82-
logger.debug(
83-
f"Connected to index: {pinecone.describe_index(self.connector_config.index_name)}"
81+
source_tag=f"unstructured=={unstructured_version}",
8482
)
83+
84+
index = pc.Index(self.connector_config.index_name)
85+
logger.debug(f"Connected to index: {pc.describe_index(self.connector_config.index_name)}")
8586
return index
8687

8788
@DestinationConnectionError.wrap

0 commit comments

Comments
 (0)