localai

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

TODO: this is a duplicate of LocalAI/core/store/client.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteRequest

type DeleteRequest struct {
	Keys [][]float32 `json:"keys"`
}

type FindRequest

type FindRequest struct {
	TopK int       `json:"topk"`
	Key  []float32 `json:"key"`
}

type FindResponse

type FindResponse struct {
	Keys         [][]float32 `json:"keys"`
	Values       []string    `json:"values"`
	Similarities []float32   `json:"similarities"`
}

type GetRequest

type GetRequest struct {
	Keys [][]float32 `json:"keys"`
}

type GetResponse

type GetResponse struct {
	Keys   [][]float32 `json:"keys"`
	Values []string    `json:"values"`
}

type SetRequest

type SetRequest struct {
	Keys   [][]float32 `json:"keys"`
	Values []string    `json:"values"`
}

Define request and response struct formats based on the API documentation

type StoreClient

type StoreClient struct {
	BaseURL  string
	APIToken string
	Client   *http.Client
}

Define a struct to hold your store API client

func NewStoreClient

func NewStoreClient(baseUrl, apiToken string) *StoreClient

Constructor for StoreClient

func (*StoreClient) Delete

func (c *StoreClient) Delete(req DeleteRequest) error

Implement Delete method

func (*StoreClient) Find

func (c *StoreClient) Find(req FindRequest) (*FindResponse, error)

Implement Find method

func (*StoreClient) Get

func (c *StoreClient) Get(req GetRequest) (*GetResponse, error)

Implement Get method

func (*StoreClient) Set

func (c *StoreClient) Set(req SetRequest) error

Implement Set method

Jump to

Keyboard shortcuts

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