langchain
langchain copied to clipboard
Zep Retriever - Vector Search Over Chat History
Zep Retriever - Vector Search Over Chat History with the Zep Long-term Memory Service
More on Zep: https://github.com/getzep/zep
Note: This PR is related to and relies on https://github.com/hwchase17/langchain/pull/4834. I did not want to modify the pyproject.toml file to add the zep-python dependency a second time.
Before submitting
Notebook included in the PR. Integration tests require a Zep service container. Let me know if this is feasible given your CI setup.
Who can review?
Community members can review the PR once tests pass. Tag maintainers/contributors who might be interested:
@dev2049
@dev2049 Thanks for pointing that out. Removed the class attributes. Note that this PR relies on the other Zep PR for installation of the zep-python client: https://github.com/hwchase17/langchain/pull/4834
@dev2049 Bump on this one, too. Thanks!
@dev2049 do you think we could do this at the same time as https://github.com/hwchase17/langchain/pull/4898?
this seems reasonable to me! i think @dev2049 already merged in the other pr, but lets wait to announce both of them on friday?
Friday's good. Thanks!
couple small comments but otherwise looks good! do you think it might be useful to add a to_retriever method to ZepChatMessageHistory or a from_message_history method to ZepRetriever (or both) that instantiates retriever from message history (since seems like they're based on same client/params under the hood)
Love the idea. Can we do so in a future PR? We have some other features coming - search and metadata related - that may require an update.
looking good! could we add some tests as well?
looking good! could we add some tests as well?
Coming up. 10 minutes.
@dev2049 Tests pushed
Took me a little longer to get the tests written. I hadn't really thought very deeply what popping would do here in terms of testing expected vs actual :-)
def _search_result_to_doc(self, results: List[SearchResult]) -> List[Document]:
return [
Document(
page_content=r.message.pop("content"),
metadata={"score": r.dist, **r.message},
)
for r in results
if r.message
]
Looks like github is having issues again :-(
Fetching the repository
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +03d2d1812795c619db355c36408497040e658203:refs/remotes/pull/4533/merge
Error: fatal: unable to access 'https://github.com/hwchase17/langchain/': The requested URL returned error: 429
The process '/usr/bin/git' failed with exit code 128
Waiting 17 seconds before trying again
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +03d2d1812795c619db355c36408[49](https://github.com/hwchase17/langchain/actions/runs/5018751764/jobs/8998524009?pr=4533#step:2:54)7040e658203:refs/remotes/pull/4533/merge
Error: fatal: unable to access 'https://github.com/hwchase17/langchain/': The requested URL returned error: 429
The process '/usr/bin/git' failed with exit code 128
Waiting 14 seconds before trying again
/usr/bin/git -c protocol.version=2 fetch --no-tags --prune --progress --no-recurse-submodules --depth=1 origin +03d2d1812795c619db355c36408497040e658203:refs/remotes/pull/4533/merge
Error: fatal: unable to access 'https://github.com/hwchase17/langchain/': The requested URL returned error: 429
Error: The process '/usr/bin/git' failed with exit code 128