mirror of
https://github.com/trustgraph-ai/trustgraph.git
synced 2026-04-25 00:16:23 +02:00
Embeddings API scores (#671)
- Put scores in all responses - Remove unused 'middle' vector layer. Vector of texts -> vector of (vector embedding)
This commit is contained in:
parent
4fa7cc7d7c
commit
f2ae0e8623
65 changed files with 1339 additions and 1292 deletions
|
|
@ -11,6 +11,7 @@ NOTE: This is the first integration test file for GraphRAG (previously had only
|
|||
import pytest
|
||||
from unittest.mock import AsyncMock, MagicMock
|
||||
from trustgraph.retrieval.graph_rag.graph_rag import GraphRag
|
||||
from trustgraph.schema import EntityMatch, Term, IRI
|
||||
|
||||
|
||||
@pytest.mark.integration
|
||||
|
|
@ -35,9 +36,9 @@ class TestGraphRagIntegration:
|
|||
"""Mock graph embeddings client that returns realistic entities"""
|
||||
client = AsyncMock()
|
||||
client.query.return_value = [
|
||||
"http://trustgraph.ai/e/machine-learning",
|
||||
"http://trustgraph.ai/e/artificial-intelligence",
|
||||
"http://trustgraph.ai/e/neural-networks"
|
||||
EntityMatch(entity=Term(type=IRI, iri="http://trustgraph.ai/e/machine-learning"), score=0.95),
|
||||
EntityMatch(entity=Term(type=IRI, iri="http://trustgraph.ai/e/artificial-intelligence"), score=0.90),
|
||||
EntityMatch(entity=Term(type=IRI, iri="http://trustgraph.ai/e/neural-networks"), score=0.85)
|
||||
]
|
||||
return client
|
||||
|
||||
|
|
@ -130,7 +131,7 @@ class TestGraphRagIntegration:
|
|||
# 2. Should query graph embeddings to find relevant entities
|
||||
mock_graph_embeddings_client.query.assert_called_once()
|
||||
call_args = mock_graph_embeddings_client.query.call_args
|
||||
assert call_args.kwargs['vectors'] == [[0.1, 0.2, 0.3, 0.4, 0.5]]
|
||||
assert call_args.kwargs['vector'] == [[0.1, 0.2, 0.3, 0.4, 0.5]]
|
||||
assert call_args.kwargs['limit'] == entity_limit
|
||||
assert call_args.kwargs['user'] == user
|
||||
assert call_args.kwargs['collection'] == collection
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue