mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 04:49:17 +00:00
Docs combine document chain (#6994)
Co-authored-by: Dev 2049 <dev.dev2049@gmail.com> Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
@@ -5,12 +5,12 @@ from typing import Any, List
|
||||
import pytest
|
||||
|
||||
from langchain import PromptTemplate
|
||||
from langchain.chains.combine_documents.base import format_document
|
||||
from langchain.chains.combine_documents.map_reduce import (
|
||||
from langchain.chains.combine_documents.reduce import (
|
||||
_collapse_docs,
|
||||
_split_list_of_docs,
|
||||
)
|
||||
from langchain.docstore.document import Document
|
||||
from langchain.schema import format_document
|
||||
|
||||
|
||||
def _fake_docs_len_func(docs: List[Document]) -> int:
|
||||
@@ -28,13 +28,6 @@ def test__split_list_long_single_doc() -> None:
|
||||
_split_list_of_docs(docs, _fake_docs_len_func, 100)
|
||||
|
||||
|
||||
def test__split_list_long_pair_doc() -> None:
|
||||
"""Test splitting of a list with two medium docs."""
|
||||
docs = [Document(page_content="foo" * 30)] * 2
|
||||
with pytest.raises(ValueError):
|
||||
_split_list_of_docs(docs, _fake_docs_len_func, 100)
|
||||
|
||||
|
||||
def test__split_list_single_doc() -> None:
|
||||
"""Test splitting works with just a single doc."""
|
||||
docs = [Document(page_content="foo")]
|
||||
|
@@ -86,8 +86,8 @@ def test_imports() -> None:
|
||||
from langchain.document_loaders import BSHTMLLoader # noqa: F401
|
||||
from langchain.embeddings import OpenAIEmbeddings # noqa: F401
|
||||
from langchain.llms import OpenAI # noqa: F401
|
||||
from langchain.prompts import BasePromptTemplate # noqa: F401
|
||||
from langchain.retrievers import VespaRetriever # noqa: F401
|
||||
from langchain.schema import BasePromptTemplate # noqa: F401
|
||||
from langchain.tools import DuckDuckGoSearchResults # noqa: F401
|
||||
from langchain.utilities import SerpAPIWrapper # noqa: F401
|
||||
from langchain.vectorstores import FAISS # noqa: F401
|
||||
|
Reference in New Issue
Block a user