Documentation
¶
Overview ¶
Package graph provides graph-based execution graph implementation for graycode-router.
Package operationsgraph projects GraycodeRouter routing and normalized generation telemetry into the portable hawk-eco graph contract.
Index ¶
- Constants
- type Export
- type Input
- type OperationEdge
- type OperationNode
- type OperationsGraph
- func (g *OperationsGraph) AddEdge(edge OperationEdge)
- func (g *OperationsGraph) AddNode(node *OperationNode)
- func (g *OperationsGraph) FindByType(nodeType string) []*OperationNode
- func (g *OperationsGraph) GetEdges() []OperationEdge
- func (g *OperationsGraph) GetNode(id string) (*OperationNode, bool)
- func (g *OperationsGraph) GetNodes() []*OperationNode
- func (g *OperationsGraph) ToGraphSpec() *graphcontracts.GraphSpec
Constants ¶
const SchemaVersion = "graycode-router.graph/v1"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Export ¶
type Export struct {
SchemaVersion string `json:"schema_version"`
GeneratedAt time.Time `json:"generated_at"`
Scope graphcontracts.Scope `json:"scope,omitempty"`
Nodes []graphcontracts.Node `json:"nodes"`
Edges []graphcontracts.Edge `json:"edges"`
Events []graphcontracts.Event `json:"events"`
}
type Input ¶
type Input struct {
Route *llmcontracts.ResolvedRoute
Usage *llmcontracts.GraycodeRouterUsage
FinishReason string
RequestID string
Content string
ToolCallCount int
ObservedAt time.Time
Scope graphcontracts.Scope
CorrelationID string
ProducerVersion string
}
type OperationEdge ¶
type OperationEdge struct {
From string `json:"from"`
To string `json:"to"`
Condition string `json:"condition,omitempty"`
Weight float64 `json:"weight"`
Attrs map[string]interface{} `json:"attrs,omitempty"`
}
OperationEdge represents an edge in the operations graph.
type OperationNode ¶
type OperationNode struct {
ID string `json:"id"`
Type string `json:"type"` // "agent", "tool", "function", "start", "end"
Name string `json:"name"`
Description string `json:"description,omitempty"`
Handler string `json:"handler,omitempty"`
Attrs map[string]interface{} `json:"attrs,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
OperationNode represents a node in the operations graph.
type OperationsGraph ¶
type OperationsGraph struct {
ID string `json:"id"`
Name string `json:"name"`
Nodes map[string]*OperationNode `json:"nodes"`
Edges []OperationEdge `json:"edges"`
Attrs map[string]interface{} `json:"attrs,omitempty"`
// contains filtered or unexported fields
}
OperationsGraph represents a graph of operations for graycode-router.
func NewOperationsGraph ¶
func NewOperationsGraph(id, name string) *OperationsGraph
NewOperationsGraph creates a new operations graph.
func (*OperationsGraph) AddEdge ¶
func (g *OperationsGraph) AddEdge(edge OperationEdge)
AddEdge adds an edge to the graph.
func (*OperationsGraph) AddNode ¶
func (g *OperationsGraph) AddNode(node *OperationNode)
AddNode adds a node to the graph.
func (*OperationsGraph) FindByType ¶
func (g *OperationsGraph) FindByType(nodeType string) []*OperationNode
FindByType finds all nodes of a specific type.
func (*OperationsGraph) GetEdges ¶
func (g *OperationsGraph) GetEdges() []OperationEdge
GetEdges returns all edges.
func (*OperationsGraph) GetNode ¶
func (g *OperationsGraph) GetNode(id string) (*OperationNode, bool)
GetNode retrieves a node by ID.
func (*OperationsGraph) GetNodes ¶
func (g *OperationsGraph) GetNodes() []*OperationNode
GetNodes returns all nodes.
func (*OperationsGraph) ToGraphSpec ¶
func (g *OperationsGraph) ToGraphSpec() *graphcontracts.GraphSpec
ToGraphSpec converts the operations graph to a portable graph spec.