Use run and arun in place of combine_docs and acombine_docs (#2635)

`combine_docs` does not go through the standard chain call path which
means that chain callbacks won't be triggered, meaning QA chains won't
be traced properly, this fixes that.

Also fix several errors in the chat_vector_db notebook
This commit is contained in:
Ankush Gola
2023-04-10 03:47:59 +02:00
committed by GitHub
parent 50c511d75f
commit b82cbd1be0
7 changed files with 105 additions and 69 deletions

View File

@@ -1,6 +1,6 @@
"""Test functionality related to combining documents."""
from typing import Any, List, Tuple
from typing import Any, List
import pytest
@@ -12,11 +12,11 @@ from langchain.docstore.document import Document
def _fake_docs_len_func(docs: List[Document]) -> int:
return len(_fake_combine_docs_func(docs)[0])
return len(_fake_combine_docs_func(docs))
def _fake_combine_docs_func(docs: List[Document], **kwargs: Any) -> Tuple[str, dict]:
return "".join([d.page_content for d in docs]), {}
def _fake_combine_docs_func(docs: List[Document], **kwargs: Any) -> str:
return "".join([d.page_content for d in docs])
def test__split_list_long_single_doc() -> None: