mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-20 11:31:58 +00:00
REFACTOR: combine core documents files (#13733)
This commit is contained in:
parent
14d4fb98fc
commit
32d087fcb8
4
libs/core/langchain_core/documents/__init__.py
Normal file
4
libs/core/langchain_core/documents/__init__.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
from langchain_core.documents.base import Document
|
||||||
|
from langchain_core.documents.transformers import BaseDocumentTransformer
|
||||||
|
|
||||||
|
__all__ = ["Document", "BaseDocumentTransformer"]
|
0
libs/core/tests/unit_tests/documents/__init__.py
Normal file
0
libs/core/tests/unit_tests/documents/__init__.py
Normal file
7
libs/core/tests/unit_tests/documents/test_imports.py
Normal file
7
libs/core/tests/unit_tests/documents/test_imports.py
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
from langchain_core.documents import __all__
|
||||||
|
|
||||||
|
EXPECTED_ALL = ["Document", "BaseDocumentTransformer"]
|
||||||
|
|
||||||
|
|
||||||
|
def test_all_imports() -> None:
|
||||||
|
assert set(__all__) == set(EXPECTED_ALL)
|
@ -1,7 +1,6 @@
|
|||||||
from typing import Any, Iterator, List, Sequence, cast
|
from typing import Any, Iterator, List, Sequence, cast
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
|
|
||||||
class BeautifulSoupTransformer(BaseDocumentTransformer):
|
class BeautifulSoupTransformer(BaseDocumentTransformer):
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from typing import Any, List, Optional, Sequence
|
from typing import Any, List, Optional, Sequence
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
from langchain.utils import get_from_env
|
from langchain.utils import get_from_env
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from typing import Any, Optional, Sequence
|
from typing import Any, Optional, Sequence
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
from langchain.utils import get_from_env
|
from langchain.utils import get_from_env
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from typing import Any, Optional, Sequence
|
from typing import Any, Optional, Sequence
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
from langchain.utils import get_from_env
|
from langchain.utils import get_from_env
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
from typing import Any, Callable, List, Sequence
|
from typing import Any, Callable, List, Sequence
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
from langchain_core.embeddings import Embeddings
|
from langchain_core.embeddings import Embeddings
|
||||||
from langchain_core.pydantic_v1 import BaseModel, Field
|
from langchain_core.pydantic_v1 import BaseModel, Field
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from typing import Any, Optional, Sequence
|
from typing import Any, Optional, Sequence
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
from langchain.utilities.vertexai import get_client_info
|
from langchain.utilities.vertexai import get_client_info
|
||||||
|
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
from typing import Any, Sequence
|
from typing import Any, Sequence
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
|
|
||||||
class Html2TextTransformer(BaseDocumentTransformer):
|
class Html2TextTransformer(BaseDocumentTransformer):
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
"""Reorder documents"""
|
"""Reorder documents"""
|
||||||
from typing import Any, List, Sequence
|
from typing import Any, List, Sequence
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
from langchain_core.pydantic_v1 import BaseModel
|
from langchain_core.pydantic_v1 import BaseModel
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,8 +3,7 @@ import json
|
|||||||
import uuid
|
import uuid
|
||||||
from typing import Any, Sequence
|
from typing import Any, Sequence
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
from langchain.tools.nuclia.tool import NucliaUnderstandingAPI
|
from langchain.tools.nuclia.tool import NucliaUnderstandingAPI
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
"""Document transformers that use OpenAI Functions models"""
|
"""Document transformers that use OpenAI Functions models"""
|
||||||
from typing import Any, Dict, Optional, Sequence, Type, Union
|
from typing import Any, Dict, Optional, Sequence, Type, Union
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
from langchain_core.language_models import BaseLanguageModel
|
from langchain_core.language_models import BaseLanguageModel
|
||||||
from langchain_core.prompts import ChatPromptTemplate
|
from langchain_core.prompts import ChatPromptTemplate
|
||||||
from langchain_core.pydantic_v1 import BaseModel
|
from langchain_core.pydantic_v1 import BaseModel
|
||||||
|
@ -3,8 +3,7 @@ from abc import ABC, abstractmethod
|
|||||||
from inspect import signature
|
from inspect import signature
|
||||||
from typing import List, Optional, Sequence, Union
|
from typing import List, Optional, Sequence, Union
|
||||||
|
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
from langchain_core.pydantic_v1 import BaseModel
|
from langchain_core.pydantic_v1 import BaseModel
|
||||||
|
|
||||||
from langchain.callbacks.manager import Callbacks
|
from langchain.callbacks.manager import Callbacks
|
||||||
|
@ -2,8 +2,7 @@
|
|||||||
from langchain_core.agents import AgentAction, AgentFinish
|
from langchain_core.agents import AgentAction, AgentFinish
|
||||||
from langchain_core.caches import BaseCache
|
from langchain_core.caches import BaseCache
|
||||||
from langchain_core.chat_history import BaseChatMessageHistory
|
from langchain_core.chat_history import BaseChatMessageHistory
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
from langchain_core.exceptions import LangChainException, OutputParserException
|
from langchain_core.exceptions import LangChainException, OutputParserException
|
||||||
from langchain_core.memory import BaseMemory
|
from langchain_core.memory import BaseMemory
|
||||||
from langchain_core.messages import (
|
from langchain_core.messages import (
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer, Document
|
||||||
from langchain_core.documents import Document
|
|
||||||
|
|
||||||
__all__ = ["Document", "BaseDocumentTransformer"]
|
__all__ = ["Document", "BaseDocumentTransformer"]
|
||||||
|
@ -51,7 +51,7 @@ from typing import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from langchain_core.document_transformers import BaseDocumentTransformer
|
from langchain_core.documents import BaseDocumentTransformer
|
||||||
|
|
||||||
from langchain.docstore.document import Document
|
from langchain.docstore.document import Document
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user