client

package
v0.4.10-gateway.4 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AskDir added in v0.1.3

func HashPath added in v0.1.6

func HashPath(path string) string

Types

type Client

type Client interface {
	CreateDataset(ctx context.Context, datasetID string) (*index.Dataset, error)
	DeleteDataset(ctx context.Context, datasetID string) error
	GetDataset(ctx context.Context, datasetID string) (*index.Dataset, error)
	ListDatasets(ctx context.Context) ([]types.Dataset, error)
	Ingest(ctx context.Context, datasetID string, data []byte, opts datastore.IngestOpts) ([]string, error)
	IngestPaths(ctx context.Context, datasetID string, opts *IngestPathsOpts, paths ...string) (int, error) // returns number of files ingested
	AskDirectory(ctx context.Context, path string, query string, opts *IngestPathsOpts, ropts *datastore.RetrieveOpts) (*dstypes.RetrievalResponse, error)
	PrunePath(ctx context.Context, datasetID string, path string, keep []string) ([]index.File, error)
	DeleteDocuments(ctx context.Context, datasetID string, documentIDs ...string) error
	Retrieve(ctx context.Context, datasetIDs []string, query string, opts datastore.RetrieveOpts) (*dstypes.RetrievalResponse, error)
	ExportDatasets(ctx context.Context, path string, datasets ...string) error
	ImportDatasets(ctx context.Context, path string, datasets ...string) error
	UpdateDataset(ctx context.Context, dataset index.Dataset, opts *datastore.UpdateDatasetOpts) (*index.Dataset, error)
}

type DefaultClient

type DefaultClient struct {
	ServerURL string
}

func NewDefaultClient

func NewDefaultClient(serverURL string) *DefaultClient

func (*DefaultClient) AskDirectory added in v0.1.3

func (c *DefaultClient) AskDirectory(ctx context.Context, path string, query string, opts *IngestPathsOpts, ropts *datastore.RetrieveOpts) (*dstypes.RetrievalResponse, error)

func (*DefaultClient) CreateDataset

func (c *DefaultClient) CreateDataset(_ context.Context, datasetID string) (*index.Dataset, error)

func (*DefaultClient) DeleteDataset

func (c *DefaultClient) DeleteDataset(_ context.Context, datasetID string) error

func (*DefaultClient) DeleteDocuments

func (c *DefaultClient) DeleteDocuments(_ context.Context, datasetID string, documentIDs ...string) error

func (*DefaultClient) ExportDatasets added in v0.1.7

func (c *DefaultClient) ExportDatasets(ctx context.Context, path string, datasets ...string) error

func (*DefaultClient) GetDataset

func (c *DefaultClient) GetDataset(_ context.Context, datasetID string) (*index.Dataset, error)

func (*DefaultClient) ImportDatasets added in v0.1.7

func (c *DefaultClient) ImportDatasets(ctx context.Context, path string, datasets ...string) error

func (*DefaultClient) Ingest

func (c *DefaultClient) Ingest(_ context.Context, datasetID string, data []byte, opts datastore.IngestOpts) ([]string, error)

func (*DefaultClient) IngestPaths

func (c *DefaultClient) IngestPaths(ctx context.Context, datasetID string, opts *IngestPathsOpts, paths ...string) (int, error)

func (*DefaultClient) ListDatasets

func (c *DefaultClient) ListDatasets(_ context.Context) ([]types.Dataset, error)

func (*DefaultClient) PrunePath added in v0.4.3

func (c *DefaultClient) PrunePath(ctx context.Context, datasetID string, path string, keep []string) ([]index.File, error)

func (*DefaultClient) Retrieve

func (c *DefaultClient) Retrieve(_ context.Context, datasetIDs []string, query string, opts datastore.RetrieveOpts) (*dstypes.RetrievalResponse, error)

func (*DefaultClient) UpdateDataset added in v0.1.8

func (c *DefaultClient) UpdateDataset(ctx context.Context, dataset index.Dataset, opts *datastore.UpdateDatasetOpts) (*index.Dataset, error)

type IngestPathsOpts

type IngestPathsOpts struct {
	IgnoreExtensions     []string
	Concurrency          int
	Recursive            bool
	TextSplitterOpts     *textsplitter.TextSplitterOpts
	IngestionFlows       []flows.IngestionFlow
	IgnoreFile           string
	IncludeHidden        bool
	NoCreateDataset      bool
	IsDuplicateFuncName  string
	Prune                bool // Prune deleted files
	ErrOnUnsupportedFile bool
}

type StandaloneClient

type StandaloneClient struct {
	*datastore.Datastore
}

func NewStandaloneClient

func NewStandaloneClient(ds *datastore.Datastore) (*StandaloneClient, error)

func (*StandaloneClient) AskDirectory added in v0.1.3

func (c *StandaloneClient) AskDirectory(ctx context.Context, path string, query string, opts *IngestPathsOpts, ropts *datastore.RetrieveOpts) (*dstypes.RetrievalResponse, error)

func (*StandaloneClient) CreateDataset

func (c *StandaloneClient) CreateDataset(ctx context.Context, datasetID string) (*index.Dataset, error)

func (*StandaloneClient) DeleteDataset

func (c *StandaloneClient) DeleteDataset(ctx context.Context, datasetID string) error

func (*StandaloneClient) DeleteDocuments

func (c *StandaloneClient) DeleteDocuments(ctx context.Context, datasetID string, documentIDs ...string) error

func (*StandaloneClient) ExportDatasets added in v0.1.7

func (c *StandaloneClient) ExportDatasets(ctx context.Context, path string, datasets ...string) error

func (*StandaloneClient) GetDataset

func (c *StandaloneClient) GetDataset(ctx context.Context, datasetID string) (*index.Dataset, error)

func (*StandaloneClient) ImportDatasets added in v0.1.7

func (c *StandaloneClient) ImportDatasets(ctx context.Context, path string, datasets ...string) error

func (*StandaloneClient) Ingest

func (c *StandaloneClient) Ingest(ctx context.Context, datasetID string, data []byte, opts datastore.IngestOpts) ([]string, error)

func (*StandaloneClient) IngestPaths

func (c *StandaloneClient) IngestPaths(ctx context.Context, datasetID string, opts *IngestPathsOpts, paths ...string) (int, error)

func (*StandaloneClient) ListDatasets

func (c *StandaloneClient) ListDatasets(ctx context.Context) ([]types.Dataset, error)

func (*StandaloneClient) PrunePath added in v0.4.3

func (c *StandaloneClient) PrunePath(ctx context.Context, datasetID string, path string, keep []string) ([]index.File, error)

func (*StandaloneClient) Retrieve

func (c *StandaloneClient) Retrieve(ctx context.Context, datasetIDs []string, query string, opts datastore.RetrieveOpts) (*dstypes.RetrievalResponse, error)

func (*StandaloneClient) UpdateDataset added in v0.1.8

func (c *StandaloneClient) UpdateDataset(ctx context.Context, dataset index.Dataset, opts *datastore.UpdateDatasetOpts) (*index.Dataset, error)

Jump to

Keyboard shortcuts

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