generated from langchain-ai/integration-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Makes GraphStore a Protocol * Updated CHANGELOG
- Loading branch information
1 parent
06db048
commit 158699e
Showing
3 changed files
with
15 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,32 @@ | ||
from abc import abstractmethod | ||
from typing import Any, Dict, List | ||
from typing import Any, Dict, List, Protocol, runtime_checkable | ||
|
||
from langchain_neo4j.graphs.graph_document import GraphDocument | ||
|
||
|
||
class GraphStore: | ||
@runtime_checkable | ||
class GraphStore(Protocol): | ||
"""Abstract class for graph operations.""" | ||
|
||
@property | ||
@abstractmethod | ||
def get_schema(self) -> str: | ||
"""Return the schema of the Graph database""" | ||
pass | ||
... | ||
|
||
@property | ||
@abstractmethod | ||
def get_structured_schema(self) -> Dict[str, Any]: | ||
"""Return the schema of the Graph database""" | ||
pass | ||
... | ||
|
||
@abstractmethod | ||
def query(self, query: str, params: dict = {}) -> List[Dict[str, Any]]: | ||
"""Query the graph.""" | ||
pass | ||
... | ||
|
||
@abstractmethod | ||
def refresh_schema(self) -> None: | ||
"""Refresh the graph schema information.""" | ||
pass | ||
|
||
@abstractmethod | ||
def add_graph_documents( | ||
self, graph_documents: List[GraphDocument], include_source: bool = False | ||
) -> None: | ||
"""Take GraphDocument as input as uses it to construct a graph.""" | ||
pass | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters