client

package
v0.0.0-...-b7aeced Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Models *openai.ModelService

	Embeddings  *openai.EmbeddingService
	Completions *openai.ChatCompletionService

	Segments    *SegmentService
	Extractions *ExtractionService

	Documents *DocumentService
	Summaries *SummaryService
}

func New

func New(url string, opts ...RequestOption) *Client

type Document

type Document = index.Document

type DocumentPage

type DocumentPage = index.Page[Document]

type DocumentService

type DocumentService struct {
	Options []RequestOption
}

func NewDocumentService

func NewDocumentService(opts ...RequestOption) *DocumentService

func (*DocumentService) Delete

func (r *DocumentService) Delete(ctx context.Context, index string, ids []string, opts ...RequestOption) error

func (*DocumentService) List

func (r *DocumentService) List(ctx context.Context, index string, opts ...RequestOption) ([]Document, error)

func (*DocumentService) New

func (r *DocumentService) New(ctx context.Context, index string, input []Document, opts ...RequestOption) ([]Document, error)

type Extraction

type Extraction struct {
	Text string `json:"text"`
}

type ExtractionRequest

type ExtractionRequest struct {
	Name   string
	Reader io.Reader
}

type ExtractionService

type ExtractionService struct {
	Options []RequestOption
}

func NewExtractionService

func NewExtractionService(opts ...RequestOption) *ExtractionService

func (*ExtractionService) New

type RequestConfig

type RequestConfig struct {
	Client *http.Client

	URL   string
	Token string
}

type RequestOption

type RequestOption = func(*RequestConfig) error

func WithClient

func WithClient(client *http.Client) RequestOption

func WithToken

func WithToken(token string) RequestOption

func WithURL

func WithURL(url string) RequestOption

type Rerank

type Rerank = api.Result

type RerankRequest

type RerankRequest = api.RerankRequest

type RerankService

type RerankService struct {
	Options []RequestOption
}

func NewRerankService

func NewRerankService(opts ...RequestOption) *RerankService

func (*RerankService) New

func (r *RerankService) New(ctx context.Context, input RerankRequest, opts ...RequestOption) ([]Rerank, error)

type Segment

type Segment = api.Segment

type SegmentRequest

type SegmentRequest struct {
	Text string `json:"text"`

	SegmentLength  *int `json:"segment_length"`
	SegmentOverlap *int `json:"segment_overlap"`
}

type SegmentService

type SegmentService struct {
	Options []RequestOption
}

func NewSegmentService

func NewSegmentService(opts ...RequestOption) *SegmentService

func (*SegmentService) New

func (r *SegmentService) New(ctx context.Context, input SegmentRequest, opts ...RequestOption) ([]Segment, error)

type Summary

type Summary struct {
	Text string `json:"content"`
}

type SummaryRequest

type SummaryRequest struct {
	Content string `json:"content"`
}

type SummaryService

type SummaryService struct {
	Options []RequestOption
}

func NewSummaryService

func NewSummaryService(opts ...RequestOption) *SummaryService

func (*SummaryService) New

func (r *SummaryService) New(ctx context.Context, body SummaryRequest, opts ...RequestOption) (*Summary, error)

Jump to

Keyboard shortcuts

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