Merge branch 'dev' into multi-tenancy
This commit is contained in:
commit
76bf99b8a6
3 changed files with 28 additions and 18 deletions
33
.github/workflows/weighted_edges_tests.yml
vendored
33
.github/workflows/weighted_edges_tests.yml
vendored
|
|
@ -2,7 +2,7 @@ name: Weighted Edges Tests
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, weighted_edges ]
|
branches: [ main, dev, weighted_edges ]
|
||||||
paths:
|
paths:
|
||||||
- 'cognee/modules/graph/utils/get_graph_from_model.py'
|
- 'cognee/modules/graph/utils/get_graph_from_model.py'
|
||||||
- 'cognee/infrastructure/engine/models/Edge.py'
|
- 'cognee/infrastructure/engine/models/Edge.py'
|
||||||
|
|
@ -10,7 +10,7 @@ on:
|
||||||
- 'examples/python/weighted_edges_example.py'
|
- 'examples/python/weighted_edges_example.py'
|
||||||
- '.github/workflows/weighted_edges_tests.yml'
|
- '.github/workflows/weighted_edges_tests.yml'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main, dev ]
|
||||||
paths:
|
paths:
|
||||||
- 'cognee/modules/graph/utils/get_graph_from_model.py'
|
- 'cognee/modules/graph/utils/get_graph_from_model.py'
|
||||||
- 'cognee/infrastructure/engine/models/Edge.py'
|
- 'cognee/infrastructure/engine/models/Edge.py'
|
||||||
|
|
@ -32,7 +32,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
LLM_PROVIDER: openai
|
LLM_PROVIDER: openai
|
||||||
LLM_MODEL: gpt-5-mini
|
LLM_MODEL: gpt-5-mini
|
||||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
|
|
@ -67,14 +67,13 @@ jobs:
|
||||||
env:
|
env:
|
||||||
LLM_PROVIDER: openai
|
LLM_PROVIDER: openai
|
||||||
LLM_MODEL: gpt-5-mini
|
LLM_MODEL: gpt-5-mini
|
||||||
LLM_ENDPOINT: https://api.openai.com/v1/
|
LLM_ENDPOINT: https://api.openai.com/v1
|
||||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||||
LLM_API_VERSION: "2024-02-01"
|
LLM_API_VERSION: "2024-02-01"
|
||||||
EMBEDDING_PROVIDER: openai
|
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||||
EMBEDDING_MODEL: text-embedding-3-small
|
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||||
EMBEDDING_ENDPOINT: https://api.openai.com/v1/
|
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||||
EMBEDDING_API_KEY: ${{ secrets.LLM_API_KEY }}
|
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||||
EMBEDDING_API_VERSION: "2024-02-01"
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
@ -108,14 +107,14 @@ jobs:
|
||||||
env:
|
env:
|
||||||
LLM_PROVIDER: openai
|
LLM_PROVIDER: openai
|
||||||
LLM_MODEL: gpt-5-mini
|
LLM_MODEL: gpt-5-mini
|
||||||
LLM_ENDPOINT: https://api.openai.com/v1/
|
LLM_ENDPOINT: https://api.openai.com/v1
|
||||||
LLM_API_KEY: ${{ secrets.LLM_API_KEY }}
|
LLM_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
||||||
LLM_API_VERSION: "2024-02-01"
|
LLM_API_VERSION: "2024-02-01"
|
||||||
EMBEDDING_PROVIDER: openai
|
EMBEDDING_MODEL: ${{ secrets.EMBEDDING_MODEL }}
|
||||||
EMBEDDING_MODEL: text-embedding-3-small
|
EMBEDDING_ENDPOINT: ${{ secrets.EMBEDDING_ENDPOINT }}
|
||||||
EMBEDDING_ENDPOINT: https://api.openai.com/v1/
|
EMBEDDING_API_KEY: ${{ secrets.EMBEDDING_API_KEY }}
|
||||||
EMBEDDING_API_KEY: ${{ secrets.LLM_API_KEY }}
|
EMBEDDING_API_VERSION: ${{ secrets.EMBEDDING_API_VERSION }}
|
||||||
EMBEDDING_API_VERSION: "2024-02-01"
|
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Check out repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
|
||||||
|
|
@ -416,6 +416,15 @@ class NeptuneAnalyticsAdapter(NeptuneGraphDB, VectorDBInterface):
|
||||||
self._client.query(f"MATCH (n :{self._VECTOR_NODE_LABEL}) DETACH DELETE n")
|
self._client.query(f"MATCH (n :{self._VECTOR_NODE_LABEL}) DETACH DELETE n")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
async def is_empty(self) -> bool:
|
||||||
|
query = """
|
||||||
|
MATCH (n)
|
||||||
|
RETURN true
|
||||||
|
LIMIT 1;
|
||||||
|
"""
|
||||||
|
query_result = await self._client.query(query)
|
||||||
|
return len(query_result) == 0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_scored_result(
|
def _get_scored_result(
|
||||||
item: dict, with_vector: bool = False, with_score: bool = False
|
item: dict, with_vector: bool = False, with_score: bool = False
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
from typing import Any, Optional
|
from typing import Any, Optional
|
||||||
|
from fastapi.encoders import jsonable_encoder
|
||||||
|
|
||||||
from cognee.infrastructure.databases.graph import get_graph_engine
|
from cognee.infrastructure.databases.graph import get_graph_engine
|
||||||
from cognee.modules.retrieval.base_retriever import BaseRetriever
|
from cognee.modules.retrieval.base_retriever import BaseRetriever
|
||||||
from cognee.modules.retrieval.utils.completion import generate_completion
|
from cognee.modules.retrieval.utils.completion import generate_completion
|
||||||
|
|
@ -50,7 +52,7 @@ class CypherSearchRetriever(BaseRetriever):
|
||||||
logger.warning("Search attempt on an empty knowledge graph")
|
logger.warning("Search attempt on an empty knowledge graph")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
result = await graph_engine.query(query)
|
result = jsonable_encoder(await graph_engine.query(query))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error("Failed to execture cypher search retrieval: %s", str(e))
|
logger.error("Failed to execture cypher search retrieval: %s", str(e))
|
||||||
raise CypherSearchError() from e
|
raise CypherSearchError() from e
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue