Skip to content

Instantly share code, notes, and snippets.

@crajah
crajah / ArangoDAOTest.scala
Created November 7, 2020 14:38
Scala Arango DB Connector
package parallelai.loop.api.dao
import java.net.URL
import com.outr.arango.CollectionType._
import com.outr.arango._
import com.outr.arango.query._
import com.outr.arango.transaction.Transaction
import io.youi.net.URL
import parallelai.loop.api.model.dto.Long
@crajah
crajah / Database.scala
Created November 7, 2020 17:50
In this example, airports, flights and airportSearch are constructed inside the Graph object. However, I want to be able to create the Graph first then create the Collection[D] on the fly.
object database extends Graph(databaseName = "graphTest") {
val airports: DocumentCollection[Airport] = vertex[Airport]
val flights: DocumentCollection[Flight] = edge[Flight]
val airportSearch: View[Airport] = view(
name = "airportSearch",
collection = airports,
analyzers = List(Analyzer.Identity),
includeAllFields = true,
fields = Airport.name -> List(Analyzer.TextEnglish)
)
from sagemaker.huggingface import HuggingFaceModel
from sagemaker.serverless import ServerlessInferenceConfig
import sagemaker
role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
'HF_MODEL_ID':'dalle-mini/dalle-mini',
'HF_TASK':'image-classification'
}
from sagemaker.huggingface import HuggingFaceModel
from sagemaker.serverless import ServerlessInferenceConfig
import sagemaker
role = sagemaker.get_execution_role()
# Hub Model configuration. https://huggingface.co/models
hub = {
'HF_MODEL_ID':'dalle-mini/dalle-mini',
'HF_TASK':'image-classification'
}
import os
import io
import boto3
import json
import csv
# Get the Endpoint name form the Environment.
ENDPOINT_NAME = os.environ['ENDPOINT_NAME']
# Make a SageMaker Runtime reference.
GraphRAG LightRAG 1.5.6 Graphiti / Zep post-graph-rag
Community detection + summaries Yes No No Yes
Bi-temporal model (validity and belief time) No No Yes Yes
Supersession inferred from document order No No No Yes
Controlled predicate vocabulary No No No Yes
Runs on PostgreSQL you already operate No partial No Yes
Transaction spanning graph and app tables No No No Yes
Detector Largest community Share of graph
Label propagation 150 entities 35%
Leiden, resolution 1.0 93 entities 21%
Leiden, resolution 2.0 74 entities 17%
post-graph-rag LightRAG 1.5.6
Characters indexed 66,345 75,751
Indexing time 3.7 min 2.0 min
Entities per 10k chars 78.8 59.4
Relations per 10k chars 101.1 55.6
Distinct edge labels 380 460
Labels ÷ relations 57% 109%
Query latency (mix / global) 8.2s / 3.1s 10.1s / 6.1s
post-graph-rag LightRAG 1.5.6
Entities 3,078 2,832
Relations 4,830 3,147
Relations per entity 1.6 1.1
Labels ÷ relations 46% 77%
Relations with stated validity 845 not modelled
Relationships superseded 8 0 — unsupported
post-graph-rag LightRAG 1.5.6
Indexing time 33.2 min 24.3 min
Entities 1,377 1,246
Relations 3,976 1,447
Relations per entity 2.9 1.2
Distinct edge labels 2,287 1,923
Labels ÷ relations 58% 133%
Entities carrying aliases 729 not modelled
Relationships superseded 13 0 — unsupported