mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-10 05:20:39 +00:00
**Description** Add support for Pinecone hosted embedding models as `PineconeEmbeddings`. Replacement for #22890 **Dependencies** Add `aiohttp` to support async embeddings call against REST directly - [x] **Add tests and docs**: If you're adding a new integration, please include Added `docs/docs/integrations/text_embedding/pinecone.ipynb` - [x] **Lint and test**: Run `make format`, `make lint` and `make test` from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/ Twitter: `gdjdg17` --------- Co-authored-by: Erick Friis <erick@langchain.dev>
17 lines
487 B
Python
17 lines
487 B
Python
from langchain_core.utils import convert_to_secret_str
|
|
|
|
from langchain_pinecone import PineconeEmbeddings
|
|
|
|
API_KEY = convert_to_secret_str("NOT_A_VALID_KEY")
|
|
MODEL_NAME = "multilingual-e5-large"
|
|
|
|
|
|
def test_default_config() -> None:
|
|
e = PineconeEmbeddings(pinecone_api_key=API_KEY, model=MODEL_NAME)
|
|
assert e.batch_size == 96
|
|
|
|
|
|
def test_custom_config() -> None:
|
|
e = PineconeEmbeddings(pinecone_api_key=API_KEY, model=MODEL_NAME, batch_size=128)
|
|
assert e.batch_size == 128
|