graphkit

package
v10.0.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package graphkit provides an HTTP client for graphiti_svc, the knowledge graph service. It supports entity search, recall, Cypher queries, entity graphs, timelines, and path traversal.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is an HTTP client for graphiti_svc.

func NewClient

func NewClient(baseURL string, opts ...ClientOption) *Client

NewClient creates a new graphiti_svc client. Default timeout is 5 seconds.

func (*Client) Cypher

func (c *Client) Cypher(ctx context.Context, query string, params map[string]any) (*CypherResult, error)

Cypher executes a Cypher query against the knowledge graph.

func (*Client) EntityGraph

func (c *Client) EntityGraph(ctx context.Context, entityName string, opts ...GraphOption) (*GraphResult, error)

EntityGraph returns the graph neighborhood of an entity.

func (*Client) EntityTimeline

func (c *Client) EntityTimeline(ctx context.Context, entityName string) ([]TimelineEntry, error)

EntityTimeline returns the temporal event history for an entity.

func (*Client) Paths

func (c *Client) Paths(ctx context.Context, from, to string, opts ...PathOption) ([]Path, error)

Paths finds paths between two entities in the knowledge graph.

func (*Client) Recall

func (c *Client) Recall(ctx context.Context, query string, at *time.Time) ([]SearchResult, error)

Recall retrieves entities from the knowledge graph, optionally at a specific point in time.

func (*Client) Search

func (c *Client) Search(ctx context.Context, query string) ([]SearchResult, error)

Search queries the knowledge graph and returns matching entities.

type ClientOption

type ClientOption func(*Client)

ClientOption configures a Client.

func WithTenant

func WithTenant(id string) ClientOption

WithTenant sets the tenant ID for all requests.

func WithTimeout

func WithTimeout(d time.Duration) ClientOption

WithTimeout sets the HTTP client timeout.

type CypherResult

type CypherResult struct {
	Columns []string `json:"columns"`
	Rows    [][]any  `json:"rows"`
}

CypherResult represents the result of a Cypher query.

type GraphOption

type GraphOption func(*graphParams)

GraphOption configures an EntityGraph call.

func Depth

func Depth(n int) GraphOption

Depth sets the traversal depth for the graph query.

type GraphResult

type GraphResult struct {
	Name          string        `json:"name"`
	Relationships []string      `json:"relationships"`
	Neighbors     []GraphResult `json:"neighbors"`
}

GraphResult represents an entity and its neighborhood in the graph.

type Path

type Path struct {
	Nodes []string `json:"nodes"`
	Edges []string `json:"edges"`
	Hops  int      `json:"hops"`
}

Path represents a traversal path between two entities.

type PathOption

type PathOption func(*pathParams)

PathOption configures a Paths call.

func MaxHops

func MaxHops(n int) PathOption

MaxHops sets the maximum number of hops for path traversal.

type SearchResult

type SearchResult struct {
	EntityName    string   `json:"entity_name"`
	Relationships []string `json:"relationships"`
	Confidence    float64  `json:"confidence"`
	Context       string   `json:"context"`
}

SearchResult represents a search hit from the knowledge graph.

type TimelineEntry

type TimelineEntry struct {
	Timestamp    time.Time `json:"timestamp"`
	Relationship string    `json:"relationship"`
	Entity       string    `json:"entity"`
	Action       string    `json:"action"`
}

TimelineEntry represents a temporal event for an entity.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL