mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-14 17:07:25 +00:00
pinecone[patch]: integration test new namespace (#17121)
This commit is contained in:
parent
3ccffa5dcc
commit
15bd1154a7
@ -100,15 +100,17 @@ class TestPinecone:
|
|||||||
texts = [needs] + texts
|
texts = [needs] + texts
|
||||||
|
|
||||||
metadatas = [{"page": i} for i in range(len(texts))]
|
metadatas = [{"page": i} for i in range(len(texts))]
|
||||||
|
|
||||||
|
namespace = f"{NAMESPACE_NAME}-md"
|
||||||
docsearch = Pinecone.from_texts(
|
docsearch = Pinecone.from_texts(
|
||||||
texts,
|
texts,
|
||||||
embedding_openai,
|
embedding_openai,
|
||||||
index_name=INDEX_NAME,
|
index_name=INDEX_NAME,
|
||||||
metadatas=metadatas,
|
metadatas=metadatas,
|
||||||
namespace=NAMESPACE_NAME,
|
namespace=namespace,
|
||||||
)
|
)
|
||||||
time.sleep(DEFAULT_SLEEP) # prevent race condition
|
time.sleep(DEFAULT_SLEEP) # prevent race condition
|
||||||
output = docsearch.similarity_search(needs, k=1, namespace=NAMESPACE_NAME)
|
output = docsearch.similarity_search(needs, k=1, namespace=namespace)
|
||||||
|
|
||||||
# TODO: why metadata={"page": 0.0}) instead of {"page": 0}?
|
# TODO: why metadata={"page": 0.0}) instead of {"page": 0}?
|
||||||
assert output == [Document(page_content=needs, metadata={"page": 0.0})]
|
assert output == [Document(page_content=needs, metadata={"page": 0.0})]
|
||||||
|
Loading…
Reference in New Issue
Block a user