together

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateEmbeddingRequest

type CreateEmbeddingRequest struct {
	Model string           `json:"model"`
	Input *EmbeddingInputs `json:"input"`
}

func (*CreateEmbeddingRequest) JSON

func (c *CreateEmbeddingRequest) JSON() (string, error)

type CreateEmbeddingResponse

type CreateEmbeddingResponse struct {
	Object    string            `json:"object"`
	Data      []EmbeddingResult `json:"data"`
	Model     string            `json:"model"`
	RequestID string            `json:"request_id"`
}

type EmbeddingInputs

type EmbeddingInputs struct {
	Input  string
	Inputs []string
}

func (*EmbeddingInputs) MarshalJSON

func (e *EmbeddingInputs) MarshalJSON() ([]byte, error)

type EmbeddingResult

type EmbeddingResult struct {
	Object    string    `json:"object"`
	Embedding []float32 `json:"embedding"`
	Index     int       `json:"index"`
}

type Option

type Option func(p *TogetherAIClient) error

func WithAPIToken

func WithAPIToken(apiToken string) Option

func WithDefaultHeaders

func WithDefaultHeaders(headers map[string]string) Option

func WithDefaultModel

func WithDefaultModel(model embeddings.EmbeddingModel) Option

func WithEnvAPIKey

func WithEnvAPIKey() Option

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

func WithMaxBatchSize

func WithMaxBatchSize(size int) Option

type TogetherAIClient

type TogetherAIClient struct {
	BaseAPI        string
	APIToken       string
	DefaultModel   embeddings.EmbeddingModel
	MaxBatchSize   int
	DefaultHeaders map[string]string
	Client         *http.Client
}

func NewTogetherClient

func NewTogetherClient(opts ...Option) (*TogetherAIClient, error)

func (*TogetherAIClient) CreateEmbedding

type TogetherEmbeddingFunction

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

func NewTogetherEmbeddingFunction

func NewTogetherEmbeddingFunction(opts ...Option) (*TogetherEmbeddingFunction, error)

func (*TogetherEmbeddingFunction) EmbedDocuments

func (e *TogetherEmbeddingFunction) EmbedDocuments(ctx context.Context, documents []string) ([]embeddings.Embedding, error)

func (*TogetherEmbeddingFunction) EmbedQuery

func (e *TogetherEmbeddingFunction) EmbedQuery(ctx context.Context, document string) (embeddings.Embedding, error)

Jump to

Keyboard shortcuts

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