mirror of
https://github.com/langchain-ai/langchain-pinecone.git
synced 2026-07-18 18:54:37 -04:00
[PR #27] [MERGED] chore: Rerank unit and integration tests #49
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/langchain-ai/langchain-pinecone/pull/27
Author: @simjak
Created: 5/6/2025
Status: ✅ Merged
Merged: 5/7/2025
Merged by: @jamescalam
Base:
feat/reranker← Head:feat/reranker📝 Commits (5)
4786ea8chore: unit tests suiteb0d9d35chore: rerank integration tests3391a29docs: Rerank docstrings5bbbbb2chore: lint524af14chore: import tests📊 Changes
6 files changed (+701 additions, -165 deletions)
View changed files
📝
libs/pinecone/langchain_pinecone/__init__.py(+2 -2)➖
libs/pinecone/langchain_pinecone/pinecone_rerank.py(+0 -163)➕
libs/pinecone/langchain_pinecone/rerank.py(+287 -0)➕
libs/pinecone/tests/integration_tests/test_rerank.py(+105 -0)📝
libs/pinecone/tests/unit_tests/test_imports.py(+1 -0)➕
libs/pinecone/tests/unit_tests/test_rerank.py(+306 -0)📄 Description
This pull request refactors the
PineconeRerankimplementation by relocating it to a new module, enhancing its functionality, and adding comprehensive integration tests. The changes also include updates to ensure compatibility with the new structure and improved documentation.Refactoring and Relocation:
PineconeRerankclass has been moved fromlibs/pinecone/langchain_pinecone/pinecone_rerank.pytolibs/pinecone/langchain_pinecone/rerank.py. This includes re-importing it in__init__.pyto reflect the new module structure. [1] [2]Enhancements to
PineconeRerank:_document_to_dictmethod to use thetextfield instead ofcontentfor document representation, aligning with Pinecone's API defaults.rerankmethod to provide detailed examples and documentation for usage, including support for custom rank fields and model parameters.Removal of Old Implementation:
PineconeRerankimplementation fromlibs/pinecone/langchain_pinecone/pinecone_rerank.pyto avoid redundancy.Integration and Unit Testing:
libs/pinecone/tests/integration_tests/test_rerank.pyto validate the functionality ofPineconeRerank, including tests for basic reranking,top_nfiltering, custom rank fields, and additional parameters.libs/pinecone/tests/unit_tests/test_imports.pyto include the relocatedPineconeRerankin the import checks.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.