antfly

package module
v0.0.0-...-a4c929e Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Copyright 2025 The Antfly Contributors

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions ��

func Index

func Index(ctx context.Context, docs []*ai.Document, ds *Docstore) error

Helper function to get started with indexing

func Retriever

func Retriever(g *genkit.Genkit, class string) ai.Retriever

Retriever returns the retriever for the given class.

Types

type Antfly

type Antfly struct {
	BaseURL string // Base URL of the Antfly instance.
	// contains filtered or unexported fields
}

Antfly passes configuration options to the plugin.

func (*Antfly) Init

func (w *Antfly) Init(ctx context.Context) []api.Action

Init initializes the Antfly plugin.

func (*Antfly) Name

func (w *Antfly) Name() string

Name returns the name of the plugin.

type Docstore

type Docstore struct {
	Client    *antfly.AntflyClient
	TableName string
	IndexName string
}

Docstore defines a Retriever.

func DefineRetriever

func DefineRetriever(ctx context.Context, g *genkit.Genkit, cfg IndexConfig, opts *ai.RetrieverOptions) (*Docstore, ai.Retriever, error)

DefineRetriever defines ai.Retriever that use the same class. The name uniquely identifies the Retriever in the registry.

func (*Docstore) Retrieve

func (ds *Docstore) Retrieve(ctx context.Context, req *ai.RetrieverRequest) (*ai.RetrieverResponse, error)

Retrieve implements the genkit Retriever.Retrieve method.

type IndexConfig

type IndexConfig struct {
	// The antfly table name. May not be the empty string.
	TableName string
	IndexName string
}

IndexConfig holds configuration options for a retriever. Antfly stores data in tables and indexes. Use a separate genkit Retriever for each different index.

type RetrieverOptions

type RetrieverOptions struct {
	// Maximum number of values to retrieve.
	Count int `json:"count,omitempty"`
	// Keys to retrieve from document metadata.
	MetadataKeys []string `json:"metadata_keys,omitempty"`
	// Bleve query to filter results.
	FilterQuery *query.Query `json:"-"`
	// OrderBy specificies fields to order by: ascending (false) or descending (true)
	OrderBy map[string]bool `json:"order_By,omitempty"`
}

RetrieverOptions may be passed in the Options field ai.RetrieverRequest to pass options to Antfly. The options field should be either nil or a value of type *RetrieverOptions.