vikingdb

package
v1.0.190 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Vector        = "vector"
	Int64         = "int64"
	ListInt64     = "list<int64>"
	String        = "string"
	ListString    = "list<string>"
	Float32       = "float32"
	Bool          = "bool"
	Text          = "text"
	Sparse_Vector = "sparse_vector"

	L2          = "l2"
	IP          = "ip"
	COSINE      = "cosine"
	FLAT        = "flat"
	HNSW        = "hnsw"
	IVF         = "ivf"
	DiskANN     = "DiskANN"
	HNSW_HYBRID = "hnsw_hybrid"
	Float       = "float"
	Int8        = "int8"
	Fix16       = "fix16"
	PQ          = "pq"

	Asc  = "asc"
	Desc = "desc"

	Custom = "custom"
	Auto   = "auto"

	Data_Import   = "data_import"
	Filter_Delete = "filter_delete"

	MAX_RETRIES         = 3
	INITIAL_RETRY_DELAY = 0.5
	MAX_RETRY_DELAY     = 8.0

	Init      = "init"
	Queued    = "queued"
	Running   = "running"
	Done      = "done"
	Fail      = "fail"
	Confirm   = "confirm"
	Confirmed = "confirmed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Collection

type Collection struct {
	CollectionName  string
	Fields          []Field
	VikingDBService *VikingDBService
	PrimaryKey      string
	Indexes         []*Index
	Description     string
	Stat            map[string]interface{}
	CreateTime      string
	UpdateTime      string
	UpdatePerson    string
}

func (*Collection) AsyncUpsertData added in v1.0.177

func (collection *Collection) AsyncUpsertData(data interface{}) error

func (*Collection) DeleteData

func (collection *Collection) DeleteData(id interface{}) error

func (*Collection) FetchData

func (collection *Collection) FetchData(id interface{}) ([]*Data, error)

func (*Collection) UpsertData

func (collection *Collection) UpsertData(data interface{}, opts ...ParamOption) error

type Data

type Data struct {
	Id        interface{}
	Fields    map[string]interface{}
	Timestamp interface{}
	TTL       int64
	Score     float64
	Text      string
}

type EmbModel

type EmbModel struct {
	ModelName string
	Params    map[string]interface{}
}

type Field

type Field struct {
	FieldName    string
	FieldType    string
	DefaultVal   interface{}
	Dim          int64
	IsPrimaryKey bool
	PipelineName string
}

type Index

type Index struct {
	CollectionName  string
	IndexName       string
	Description     string
	VectorIndex     *VectorIndexParams
	ScalarIndex     interface{}
	Stat            string
	VikingDBService *VikingDBService
	CpuQuota        int64
	PartitionBy     string
	CreateTime      string
	UpdateTime      string
	UpdatePerson    string
	IndexCost       interface{}
	ShardCount      int64
	ShardPolicy     string
	// contains filtered or unexported fields
}

func (*Index) FetchData

func (index *Index) FetchData(id interface{}, searchOptions *SearchOptions) ([]*Data, error)

func (*Index) Search

func (index *Index) Search(order interface{}, searchOptions *SearchOptions) ([]*Data, error)

func (*Index) SearchById

func (index *Index) SearchById(id interface{}, searchOptions *SearchOptions) ([]*Data, error)

func (*Index) SearchByText

func (index *Index) SearchByText(text TextObject, searchOptions *SearchOptions) ([]*Data, error)

func (*Index) SearchByVector

func (index *Index) SearchByVector(vector []float64, searchOptions *SearchOptions) ([]*Data, error)

type IndexOptions

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

func NewIndexOptions

func NewIndexOptions() *IndexOptions

func (*IndexOptions) SetCpuQuota

func (indexOptions *IndexOptions) SetCpuQuota(cpuQuota int64) *IndexOptions

func (*IndexOptions) SetDescription

func (indexOptions *IndexOptions) SetDescription(description string) *IndexOptions

func (*IndexOptions) SetPartitionBy

func (indexOptions *IndexOptions) SetPartitionBy(partitionBy string) *IndexOptions

func (*IndexOptions) SetScalarIndex

func (indexOptions *IndexOptions) SetScalarIndex(scalarIndex []string) *IndexOptions

func (*IndexOptions) SetShardCount added in v1.0.134

func (indexOptions *IndexOptions) SetShardCount(shardCount int64) *IndexOptions

func (*IndexOptions) SetShardPolicy added in v1.0.176

func (indexOptions *IndexOptions) SetShardPolicy(shardPolicy string) *IndexOptions

func (*IndexOptions) SetVectorIndex

func (indexOptions *IndexOptions) SetVectorIndex(vectorIndex *VectorIndexParams) *IndexOptions

type ParamOption added in v1.0.181

type ParamOption func(*ParamOptions)

func WithAsyncUpsert added in v1.0.181

func WithAsyncUpsert(yes bool) ParamOption

type ParamOptions added in v1.0.181

type ParamOptions struct {
	AsyncUpsert bool
}

type RawData

type RawData struct {
	DataType string
	Text     string
	Image    string
}

type ScalarOrder

type ScalarOrder struct {
	FieldName string
	Order     string
}

type SearchOptions

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

func NewSearchOptions

func NewSearchOptions() *SearchOptions

func (*SearchOptions) SetDenseWeight added in v1.0.154

func (searchOptions *SearchOptions) SetDenseWeight(dense_weight float64) *SearchOptions

func (*SearchOptions) SetFilter

func (searchOptions *SearchOptions) SetFilter(filter map[string]interface{}) *SearchOptions

func (*SearchOptions) SetLimit

func (searchOptions *SearchOptions) SetLimit(limit int64) *SearchOptions

func (*SearchOptions) SetOutputFields

func (searchOptions *SearchOptions) SetOutputFields(outputFields []string) *SearchOptions

func (*SearchOptions) SetPartition

func (searchOptions *SearchOptions) SetPartition(partition string) *SearchOptions

func (*SearchOptions) SetRetry added in v1.0.186

func (searchOptions *SearchOptions) SetRetry(retry bool) *SearchOptions

func (*SearchOptions) SetSparseVectors added in v1.0.154

func (searchOptions *SearchOptions) SetSparseVectors(sparse_vectors map[string]interface{}) *SearchOptions

type Task added in v1.0.184

type Task struct {
	CollectionName string
	CreateTime     string
	ProcessInfo    map[string]interface{}
	TaskID         string
	TaskParams     map[string]interface{}
	TaskStatus     string
	TaskType       string
	UpdatePerson   string
	UpdateTime     string
}

type TextObject

type TextObject struct {
	Text   string
	Url    string
	Base64 interface{}
}

type UpdateCollectionOptions

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

func NewUpdateCollectionOptions

func NewUpdateCollectionOptions() *UpdateCollectionOptions

func (*UpdateCollectionOptions) SetDescription

func (updateCollectionOptions *UpdateCollectionOptions) SetDescription(description string) *UpdateCollectionOptions

func (*UpdateCollectionOptions) SetFields

func (updateCollectionOptions *UpdateCollectionOptions) SetFields(fields []Field) *UpdateCollectionOptions

type UpdateIndexOptions added in v1.0.134

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

func NewUpdateIndexOptions added in v1.0.134

func NewUpdateIndexOptions() *UpdateIndexOptions

func (*UpdateIndexOptions) SetCpuQuota added in v1.0.134

func (updateIndexOptions *UpdateIndexOptions) SetCpuQuota(cpuQuota int64) *UpdateIndexOptions

func (*UpdateIndexOptions) SetDescription added in v1.0.134

func (updateIndexOptions *UpdateIndexOptions) SetDescription(description string) *UpdateIndexOptions

func (*UpdateIndexOptions) SetScalarIndex added in v1.0.134

func (updateIndexOptions *UpdateIndexOptions) SetScalarIndex(scalarIndex []string) *UpdateIndexOptions

func (*UpdateIndexOptions) SetShardCount added in v1.0.150

func (updateIndexOptions *UpdateIndexOptions) SetShardCount(shardCount int64) *UpdateIndexOptions

type VectorIndexParams

type VectorIndexParams struct {
	IndexType string
	Distance  string
	Quant     string
	HnswM     int64
	HnswCef   int64
	HnswSef   int64
}

type VectorOrder

type VectorOrder struct {
	Vector interface{}
	Id     interface{}
}

type VikingDBService

type VikingDBService struct {
	Client *base.Client
}

func NewVikingDBService

func NewVikingDBService(host string, region string, ak string, sk string, scheme string) *VikingDBService

func (*VikingDBService) BatchRerank added in v1.0.146

func (vikingDBService *VikingDBService) BatchRerank(datas []map[string]interface{}) ([]float64, error)

func (*VikingDBService) CreateCollection

func (vikingDBService *VikingDBService) CreateCollection(collectionName string, fields []Field, description string) (*Collection, error)

func (*VikingDBService) CreateIndex

func (vikingDBService *VikingDBService) CreateIndex(collectionName string, indexName string, indexOptions *IndexOptions) (*Index, error)

func (*VikingDBService) CreateTask added in v1.0.184

func (vikingDBService *VikingDBService) CreateTask(taskType string, taskParams map[string]interface{}) (string, error)

func (*VikingDBService) DoRequest

func (vikingDBService *VikingDBService) DoRequest(ctx context.Context, api string, query url.Values, body string) (map[string]interface{}, error)

func (*VikingDBService) DropCollection

func (vikingDBService *VikingDBService) DropCollection(collectionName string) error

func (*VikingDBService) DropIndex

func (vikingDBService *VikingDBService) DropIndex(collectionName string, indexName string) error

func (*VikingDBService) DropTask added in v1.0.184

func (vikingDBService *VikingDBService) DropTask(taskID string) error

func (*VikingDBService) Embedding

func (vikingDBService *VikingDBService) Embedding(embModel EmbModel, rawData interface{}) ([][]float64, error)

func (*VikingDBService) EmbeddingV2 added in v1.0.154

func (vikingDBService *VikingDBService) EmbeddingV2(embModel EmbModel, rawData interface{}) (map[string]interface{}, error)

func (*VikingDBService) GetCollection

func (vikingDBService *VikingDBService) GetCollection(collectionName string) (*Collection, error)

func (*VikingDBService) GetIndex

func (vikingDBService *VikingDBService) GetIndex(collectionName string, indexName string) (*Index, error)

func (*VikingDBService) GetTask added in v1.0.184

func (vikingDBService *VikingDBService) GetTask(taskID string) (*Task, error)

func (*VikingDBService) ListCollections

func (vikingDBService *VikingDBService) ListCollections() ([]*Collection, error)

func (*VikingDBService) ListIndexes

func (vikingDBService *VikingDBService) ListIndexes(collectionName string) ([]*Index, error)

func (*VikingDBService) ListTasks added in v1.0.184

func (vikingDBService *VikingDBService) ListTasks() ([]*Task, error)

func (*VikingDBService) Rerank added in v1.0.138

func (vikingDBService *VikingDBService) Rerank(query string, content string, title string) (float64, error)

func (*VikingDBService) SetConnectionTimeout added in v1.0.150

func (vikingDBService *VikingDBService) SetConnectionTimeout(connectionTimeout int64)

func (*VikingDBService) SetHeader added in v1.0.137

func (vikingDBService *VikingDBService) SetHeader(header map[string]string)

func (*VikingDBService) UpdateCollection

func (vikingDBService *VikingDBService) UpdateCollection(collectionName string, updateCollectionOptions *UpdateCollectionOptions) error

func (*VikingDBService) UpdateIndex added in v1.0.134

func (vikingDBService *VikingDBService) UpdateIndex(collectionName string, indexName string, updateIndexOptions *UpdateIndexOptions) error

func (*VikingDBService) UpdateTask added in v1.0.187

func (vikingDBService *VikingDBService) UpdateTask(taskID string, taskStatus string) error

Jump to

Keyboard shortcuts

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