<!-- .github/pull_request_template.md --> ## Description <!-- Provide a clear description of the changes in this PR --> ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
18 lines
585 B
Python
18 lines
585 B
Python
from typing import List, Optional
|
|
from abc import ABC, abstractmethod
|
|
|
|
from cognee.modules.graph.cognee_graph.CogneeGraphElements import Edge
|
|
|
|
|
|
class BaseGraphRetriever(ABC):
|
|
"""Base class for all graph based retrievers."""
|
|
|
|
@abstractmethod
|
|
async def get_context(self, query: str) -> List[Edge]:
|
|
"""Retrieves triplets based on the query."""
|
|
pass
|
|
|
|
@abstractmethod
|
|
async def get_completion(self, query: str, context: Optional[List[Edge]] = None) -> str:
|
|
"""Generates a response using the query and optional context (triplets)."""
|
|
pass
|