diff --git a/libs/community/langchain_community/graph_vectorstores/cassandra.py b/libs/community/langchain_community/graph_vectorstores/cassandra.py index da9b09e993..6fb04c60a1 100644 --- a/libs/community/langchain_community/graph_vectorstores/cassandra.py +++ b/libs/community/langchain_community/graph_vectorstores/cassandra.py @@ -9,6 +9,7 @@ from typing import ( Type, ) +from langchain_core._api import beta from langchain_core.documents import Document from langchain_core.embeddings import Embeddings from langchain_core.graph_vectorstores.base import ( @@ -23,6 +24,7 @@ if TYPE_CHECKING: from cassandra.cluster import Session +@beta() class CassandraGraphVectorStore(GraphVectorStore): def __init__( self, diff --git a/libs/community/langchain_community/graph_vectorstores/extractors/gliner_link_extractor.py b/libs/community/langchain_community/graph_vectorstores/extractors/gliner_link_extractor.py index f5aa2eb27a..a485f849c7 100644 --- a/libs/community/langchain_community/graph_vectorstores/extractors/gliner_link_extractor.py +++ b/libs/community/langchain_community/graph_vectorstores/extractors/gliner_link_extractor.py @@ -1,5 +1,6 @@ from typing import Any, Dict, Iterable, List, Optional, Set, Union +from langchain_core._api import beta from langchain_core.documents import Document from langchain_core.graph_vectorstores.links import Link @@ -11,6 +12,7 @@ from langchain_community.graph_vectorstores.extractors.link_extractor import ( GLiNERInput = Union[str, Document] +@beta() class GLiNERLinkExtractor(LinkExtractor[GLiNERInput]): """Link documents with common named entities using GLiNER .""" diff --git a/libs/community/langchain_community/graph_vectorstores/extractors/hierarchy_link_extractor.py b/libs/community/langchain_community/graph_vectorstores/extractors/hierarchy_link_extractor.py index 7a324df261..525445f015 100644 --- a/libs/community/langchain_community/graph_vectorstores/extractors/hierarchy_link_extractor.py +++ b/libs/community/langchain_community/graph_vectorstores/extractors/hierarchy_link_extractor.py @@ -1,5 +1,6 @@ from typing import Callable, List, Set +from langchain_core._api import beta from langchain_core.documents import Document from langchain_core.graph_vectorstores.links import Link @@ -18,6 +19,7 @@ _CHILD: str = "c:" _SIBLING: str = "s:" +@beta() class HierarchyLinkExtractor(LinkExtractor[HierarchyInput]): def __init__( self, diff --git a/libs/community/langchain_community/graph_vectorstores/extractors/html_link_extractor.py b/libs/community/langchain_community/graph_vectorstores/extractors/html_link_extractor.py index 49ff1703a3..bc82095847 100644 --- a/libs/community/langchain_community/graph_vectorstores/extractors/html_link_extractor.py +++ b/libs/community/langchain_community/graph_vectorstores/extractors/html_link_extractor.py @@ -4,6 +4,7 @@ from dataclasses import dataclass from typing import TYPE_CHECKING, List, Optional, Set, Union from urllib.parse import urldefrag, urljoin, urlparse +from langchain_core._api import beta from langchain_core.documents import Document from langchain_core.graph_vectorstores import Link @@ -61,6 +62,7 @@ class HtmlInput: base_url: str +@beta() class HtmlLinkExtractor(LinkExtractor[HtmlInput]): def __init__(self, *, kind: str = "hyperlink", drop_fragments: bool = True): """Extract hyperlinks from HTML content. diff --git a/libs/community/langchain_community/graph_vectorstores/extractors/keybert_link_extractor.py b/libs/community/langchain_community/graph_vectorstores/extractors/keybert_link_extractor.py index aee7898a5c..54be34d463 100644 --- a/libs/community/langchain_community/graph_vectorstores/extractors/keybert_link_extractor.py +++ b/libs/community/langchain_community/graph_vectorstores/extractors/keybert_link_extractor.py @@ -1,5 +1,6 @@ from typing import Any, Dict, Iterable, Optional, Set, Union +from langchain_core._api import beta from langchain_core.documents import Document from langchain_core.graph_vectorstores.links import Link @@ -10,6 +11,7 @@ from langchain_community.graph_vectorstores.extractors.link_extractor import ( KeybertInput = Union[str, Document] +@beta() class KeybertLinkExtractor(LinkExtractor[KeybertInput]): def __init__( self, diff --git a/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor.py b/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor.py index 619ba2a6d1..45b8a526f9 100644 --- a/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor.py +++ b/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor.py @@ -3,6 +3,7 @@ from __future__ import annotations from abc import ABC, abstractmethod from typing import Generic, Iterable, Set, TypeVar +from langchain_core._api import beta from langchain_core.graph_vectorstores import Link InputT = TypeVar("InputT") @@ -10,6 +11,7 @@ InputT = TypeVar("InputT") METADATA_LINKS_KEY = "links" +@beta() class LinkExtractor(ABC, Generic[InputT]): """Interface for extracting links (incoming, outgoing, bidirectional).""" diff --git a/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor_adapter.py b/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor_adapter.py index 19af73bab9..68dfbeb7cb 100644 --- a/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor_adapter.py +++ b/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor_adapter.py @@ -1,5 +1,6 @@ from typing import Callable, Iterable, Set, TypeVar +from langchain_core._api import beta from langchain_core.graph_vectorstores import Link from langchain_community.graph_vectorstores.extractors.link_extractor import ( @@ -10,6 +11,7 @@ InputT = TypeVar("InputT") UnderlyingInputT = TypeVar("UnderlyingInputT") +@beta() class LinkExtractorAdapter(LinkExtractor[InputT]): def __init__( self, diff --git a/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor_transformer.py b/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor_transformer.py index 3a5b4e83a5..752b4b4986 100644 --- a/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor_transformer.py +++ b/libs/community/langchain_community/graph_vectorstores/extractors/link_extractor_transformer.py @@ -1,5 +1,6 @@ from typing import Any, Sequence +from langchain_core._api import beta from langchain_core.documents import Document from langchain_core.documents.transformers import BaseDocumentTransformer from langchain_core.graph_vectorstores.links import copy_with_links @@ -9,6 +10,7 @@ from langchain_community.graph_vectorstores.extractors.link_extractor import ( ) +@beta() class LinkExtractorTransformer(BaseDocumentTransformer): """DocumentTransformer for applying one or more LinkExtractors. diff --git a/libs/core/langchain_core/graph_vectorstores/base.py b/libs/core/langchain_core/graph_vectorstores/base.py index 2235dd054f..97eec8d5cb 100644 --- a/libs/core/langchain_core/graph_vectorstores/base.py +++ b/libs/core/langchain_core/graph_vectorstores/base.py @@ -32,6 +32,7 @@ def _has_next(iterator: Iterator) -> bool: return next(iterator, sentinel) is not sentinel +@beta() class Node(Serializable): """Node in the GraphVectorStore. @@ -115,6 +116,7 @@ def _documents_to_nodes(documents: Iterable[Document]) -> Iterator[Node]: ) +@beta() def nodes_to_documents(nodes: Iterable[Node]) -> Iterator[Document]: for node in nodes: metadata = node.metadata.copy() diff --git a/libs/core/langchain_core/graph_vectorstores/links.py b/libs/core/langchain_core/graph_vectorstores/links.py index 11c95986ee..1e2353b0b4 100644 --- a/libs/core/langchain_core/graph_vectorstores/links.py +++ b/libs/core/langchain_core/graph_vectorstores/links.py @@ -1,9 +1,11 @@ from dataclasses import dataclass from typing import Iterable, List, Literal, Union +from langchain_core._api import beta from langchain_core.documents import Document +@beta() @dataclass(frozen=True) class Link: """A link to/from a tag of a given tag. @@ -38,6 +40,7 @@ class Link: METADATA_LINKS_KEY = "links" +@beta() def get_links(doc: Document) -> List[Link]: """Get the links from a document. Args: @@ -54,6 +57,7 @@ def get_links(doc: Document) -> List[Link]: return links +@beta() def add_links(doc: Document, *links: Union[Link, Iterable[Link]]) -> None: """Add links to the given metadata. Args: @@ -68,6 +72,7 @@ def add_links(doc: Document, *links: Union[Link, Iterable[Link]]) -> None: links_in_metadata.append(link) +@beta() def copy_with_links(doc: Document, *links: Union[Link, Iterable[Link]]) -> Document: """Return a document with the given links added.