embedding

package
v0.0.0-...-e1deba5 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TextEmbeddingV1      = "text-embedding-v1"
	TextEmbeddingAsyncV1 = "text-embedding-async-v1"
	TextEmbeddingV2      = "text-embedding-v2"
	TextEmbeddingAsyncV2 = "text-embedding-async-v2"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Embedding

type Embedding struct {
	TextIndex int       `json:"text_index"`
	Embedding []float64 `json:"embedding"`
}

type Input

type Input struct {
	Texts []string `json:"texts"`
}

type ModelEmbedding

type ModelEmbedding = string

type Output

type Output struct {
	Embeddings []Embedding `json:"embeddings"`
}

type Params

type Params struct {
	TextType string `json:"text_type"` // query or document
}

type Request

type Request struct {
	Model  string `json:"model"`
	Input  Input  `json:"input"`
	Params Params `json:"parameters"`
}

type Response

type Response struct {
	Output Output `json:"output"`
	Usgae  struct {
		TotalTokens int `json:"total_tokens"`
	} `json:"usage"`
	RequestID string `json:"request_id"`
}

func CreateEmbedding

func CreateEmbedding(ctx context.Context, req *Request, cli httpclient.IHttpClient, token string) (*Response, error)

type TextType

type TextType = string
const (
	TypeQuery    TextType = "query"
	TypeDocument TextType = "document"
)

Jump to

Keyboard shortcuts

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