<!-- .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. --------- Co-authored-by: Igor Ilic <30923996+dexters1@users.noreply.github.com> Co-authored-by: Igor Ilic <igorilic03@gmail.com>
26 lines
829 B
Python
26 lines
829 B
Python
from pydantic import BaseModel
|
|
from typing import Optional, Any, Dict
|
|
|
|
|
|
class Edge(BaseModel):
|
|
"""
|
|
Represents edge metadata for relationships between DataPoints.
|
|
|
|
This class is used to define edge properties like weight when creating
|
|
relationships between DataPoints using tuple syntax:
|
|
|
|
Example:
|
|
# Single weight (backward compatible)
|
|
has_items: (Edge(weight=0.5), list[Item])
|
|
|
|
# Multiple weights
|
|
has_items: (Edge(weights={"strength": 0.8, "confidence": 0.9, "importance": 0.7}), list[Item])
|
|
|
|
# Mixed usage
|
|
has_items: (Edge(weight=0.5, weights={"confidence": 0.9}), list[Item])
|
|
"""
|
|
|
|
weight: Optional[float] = None
|
|
weights: Optional[Dict[str, float]] = None
|
|
relationship_type: Optional[str] = None
|
|
properties: Optional[Dict[str, Any]] = None
|