rest

package
v0.0.0-...-6a3e998 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentClient

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

AgentClient provides methods for interacting with the Agent API

func NewAgentClient

func NewAgentClient(client *RESTClient) *AgentClient

NewAgentClient creates a new Agent API client

func (*AgentClient) CreateAgent

func (c *AgentClient) CreateAgent(ctx context.Context, agent *models.Agent) error

CreateAgent creates a new agent

func (*AgentClient) DeleteAgent

func (c *AgentClient) DeleteAgent(ctx context.Context, id string) error

DeleteAgent deletes an agent by ID

func (*AgentClient) GetAgentByID

func (c *AgentClient) GetAgentByID(ctx context.Context, id string, tenantID string) (*models.Agent, error)

GetAgentByID retrieves an agent by ID

func (*AgentClient) ListAgents

func (c *AgentClient) ListAgents(ctx context.Context, tenantID string) ([]*models.Agent, error)

ListAgents retrieves all agents for a tenant

func (*AgentClient) UpdateAgent

func (c *AgentClient) UpdateAgent(ctx context.Context, agent *models.Agent) error

UpdateAgent updates an existing agent

type ClientConfig

type ClientConfig struct {
	BaseURL string
	APIKey  string
	Timeout time.Duration
	Logger  observability.Logger
}

ClientConfig holds configuration for the REST client

type ContextClient

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

ContextClient provides methods for interacting with the Context API

func NewContextClient

func NewContextClient(client *RESTClient, logger observability.Logger) *ContextClient

NewContextClient creates a new ContextClient with the provided client

func (*ContextClient) CreateContext

func (c *ContextClient) CreateContext(ctx context.Context, contextObj *models.Context) (*models.Context, error)

CreateContext creates a new context

func (*ContextClient) DeleteContext

func (c *ContextClient) DeleteContext(ctx context.Context, contextID string) error

DeleteContext deletes a context by ID

func (*ContextClient) GetContext

func (c *ContextClient) GetContext(ctx context.Context, contextID string) (*models.Context, error)

GetContext retrieves a context by ID

func (*ContextClient) ListContexts

func (c *ContextClient) ListContexts(ctx context.Context, agentID, sessionID string, options map[string]interface{}) ([]*models.Context, error)

ListContexts lists contexts with optional filtering

func (*ContextClient) SearchInContext

func (c *ContextClient) SearchInContext(ctx context.Context, contextID, query string) ([]models.ContextItem, error)

SearchInContext searches for text within a context

func (*ContextClient) SummarizeContext

func (c *ContextClient) SummarizeContext(ctx context.Context, contextID string) (string, error)

SummarizeContext generates a summary of a context

func (*ContextClient) UpdateContext

func (c *ContextClient) UpdateContext(ctx context.Context, contextID string, contextObj *models.Context, options *models.ContextUpdateOptions) (*models.Context, error)

UpdateContext updates an existing context

type Factory

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

Factory provides access to all REST API clients

func NewFactory

func NewFactory(baseURL, apiKey string, logger observability.Logger) *Factory

NewFactory creates a new REST client factory

func (*Factory) Agent

func (f *Factory) Agent() *AgentClient

Agent returns a client for the Agent API

func (*Factory) Client

func (f *Factory) Client() *RESTClient

Client returns the underlying REST client

func (*Factory) Model

func (f *Factory) Model() *ModelClient

Model returns a client for the Model API

func (*Factory) NewContextClient

func (f *Factory) NewContextClient(logger observability.Logger) *ContextClient

NewContextClient creates a new client for the Context API

func (*Factory) NewSearchClient

func (f *Factory) NewSearchClient(logger observability.Logger) *SearchClient

NewSearchClient creates a new client for the Search API

func (*Factory) Vector

func (f *Factory) Vector() *VectorClient

Vector returns a client for the Vector API

type ModelClient

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

ModelClient provides methods for interacting with the Model API

func NewModelClient

func NewModelClient(client *RESTClient) *ModelClient

NewModelClient creates a new Model API client

func (*ModelClient) CreateModel

func (c *ModelClient) CreateModel(ctx context.Context, model *models.Model) error

CreateModel creates a new model

func (*ModelClient) DeleteModel

func (c *ModelClient) DeleteModel(ctx context.Context, id string) error

DeleteModel deletes a model by ID

func (*ModelClient) GetModelByID

func (c *ModelClient) GetModelByID(ctx context.Context, id string) (*models.Model, error)

GetModelByID retrieves a model by ID

func (*ModelClient) ListModels

func (c *ModelClient) ListModels(ctx context.Context) ([]*models.Model, error)

ListModels retrieves all models

func (*ModelClient) UpdateModel

func (c *ModelClient) UpdateModel(ctx context.Context, model *models.Model) error

UpdateModel updates an existing model

type RESTClient

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

RESTClient is a client for the REST API

func NewRESTClient

func NewRESTClient(config ClientConfig) *RESTClient

NewRESTClient creates a new REST API client

func (*RESTClient) Delete

func (c *RESTClient) Delete(ctx context.Context, path string, result interface{}) error

Delete performs a DELETE request

func (*RESTClient) Get

func (c *RESTClient) Get(ctx context.Context, path string, result interface{}) error

Get performs a GET request

func (*RESTClient) Post

func (c *RESTClient) Post(ctx context.Context, path string, body interface{}, result interface{}) error

Post performs a POST request

func (*RESTClient) Put

func (c *RESTClient) Put(ctx context.Context, path string, body interface{}, result interface{}) error

Put performs a PUT request

type SearchClient

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

SearchClient provides methods for vector search operations

func NewSearchClient

func NewSearchClient(client *RESTClient, logger observability.Logger) *SearchClient

NewSearchClient creates a new SearchClient with the provided client

func (*SearchClient) GetSearchStats

func (c *SearchClient) GetSearchStats(ctx context.Context) (map[string]interface{}, error)

GetSearchStats retrieves statistics about the search index

func (*SearchClient) GetSupportedModels

func (c *SearchClient) GetSupportedModels(ctx context.Context) ([]string, error)

GetSupportedModels retrieves a list of all models with embeddings

func (*SearchClient) SearchByContentID

func (c *SearchClient) SearchByContentID(ctx context.Context, contentID string, options *embedding.SearchOptions) (*embedding.SearchResults, error)

SearchByContentID performs a "more like this" search using an existing content ID

func (*SearchClient) SearchByText

func (c *SearchClient) SearchByText(ctx context.Context, query string, options *embedding.SearchOptions) (*embedding.SearchResults, error)

SearchByText performs a vector search using text query

func (*SearchClient) SearchByVector

func (c *SearchClient) SearchByVector(ctx context.Context, vector []float32, options *embedding.SearchOptions) (*embedding.SearchResults, error)

SearchByVector performs a vector search using a pre-computed vector

type VectorClient

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

VectorClient provides methods for interacting with the Vector API

func NewVectorClient

func NewVectorClient(client *RESTClient) *VectorClient

NewVectorClient creates a new Vector API client

func (*VectorClient) DeleteContextEmbeddings

func (c *VectorClient) DeleteContextEmbeddings(ctx context.Context, contextID string) error

DeleteContextEmbeddings deletes all embeddings for a context

func (*VectorClient) DeleteEmbedding

func (c *VectorClient) DeleteEmbedding(ctx context.Context, id string) error

DeleteEmbedding deletes a single embedding by ID

func (*VectorClient) DeleteModelEmbeddings

func (c *VectorClient) DeleteModelEmbeddings(ctx context.Context, contextID string, modelID string) error

DeleteModelEmbeddings deletes all embeddings for a context and model

func (*VectorClient) GetContextEmbeddings

func (c *VectorClient) GetContextEmbeddings(ctx context.Context, contextID string) ([]*models.Vector, error)

GetContextEmbeddings retrieves all embeddings for a context

func (*VectorClient) GetEmbedding

func (c *VectorClient) GetEmbedding(ctx context.Context, id string) (*models.Vector, error)

GetEmbedding retrieves a single embedding by ID

func (*VectorClient) GetEmbeddingsByModel

func (c *VectorClient) GetEmbeddingsByModel(ctx context.Context, contextID string, modelID string) ([]*models.Vector, error)

GetEmbeddingsByModel retrieves all embeddings for a context and model

func (*VectorClient) GetSupportedModels

func (c *VectorClient) GetSupportedModels(ctx context.Context) ([]string, error)

GetSupportedModels retrieves all supported models

func (*VectorClient) SearchEmbeddings

func (c *VectorClient) SearchEmbeddings(ctx context.Context, queryEmbedding []float32, contextID string, modelID string, limit int, threshold float64) ([]*models.Vector, error)

SearchEmbeddings searches for similar embeddings

func (*VectorClient) SearchEmbeddings_Legacy

func (c *VectorClient) SearchEmbeddings_Legacy(ctx context.Context, queryEmbedding []float32, contextID string, limit int) ([]*models.Vector, error)

SearchEmbeddings_Legacy is a legacy method that searches for similar embeddings without model ID

func (*VectorClient) StoreEmbedding

func (c *VectorClient) StoreEmbedding(ctx context.Context, vector *models.Vector) error

StoreEmbedding stores a vector embedding

type WebhookClient

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

WebhookClient handles webhook processing through the REST API

func NewWebhookClient

func NewWebhookClient(client *RESTClient, config WebhookConfig, logger observability.Logger) *WebhookClient

NewWebhookClient creates a new WebhookClient with the given configuration

func (*WebhookClient) ProcessWebhook

func (c *WebhookClient) ProcessWebhook(ctx context.Context, provider string, headers http.Header, body []byte) error

ProcessWebhook handles an incoming webhook request

func (*WebhookClient) ValidateIP

func (c *WebhookClient) ValidateIP(ctx context.Context, provider string, ipAddress string) (bool, error)

ValidateIP checks if the given IP is allowed to send webhooks

type WebhookConfig

type WebhookConfig struct {
	Enabled       bool
	Secret        string
	Endpoint      string
	AllowedEvents []string
	ValidateIP    bool
	IPWhitelist   []string
}

WebhookConfig contains the configuration for webhook handling

type WebhookRequest

type WebhookRequest struct {
	Provider string              `json:"provider"`
	Headers  map[string][]string `json:"headers"`
	Body     []byte              `json:"body"`
}

WebhookRequest represents a webhook request to be processed

Jump to

Keyboard shortcuts

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