common

package
v0.0.0-...-e986fc6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateIndexIfNotExists

func CreateIndexIfNotExists(ctx context.Context, client *elasticsearch.Client, indexName string) error

CreateIndexIfNotExists 已废弃:使用 vector.VectorStore 接口替代 Deprecated: Use vector.VectorStore.IndexExists and CreateIndex instead

func DeleteDocument

func DeleteDocument(ctx context.Context, client *elasticsearch.Client, documentID string) error

DeleteDocument 删除索引中的单个文档 已废弃:使用 vector.VectorStore 接口替代 Deprecated: Use vector.VectorStore.DeleteDocument instead

func GetEmbeddingModel

func GetEmbeddingModel(ctx context.Context, cfg *openai.ChatModelConfig) (model.BaseChatModel, error)

func GetRewriteModel

func GetRewriteModel(ctx context.Context, cfg *qwen.ChatModelConfig) (model.BaseChatModel, error)

func IsURL

func IsURL(str string) bool

func NewEmbedding

func NewEmbedding(ctx context.Context, conf *config.Config) (eb embedding.Embedder, err error)

func Of

func Of[T any](v T) *T

func RemoveDuplicates

func RemoveDuplicates[T any, K comparable](slice []T, keyFunc func(T) K) []T

func SteamResponse

func SteamResponse(ctx context.Context, streamReader *schema.StreamReader[*schema.Message], docs []*schema.Document) (err error)

Types

type StreamData

type StreamData struct {
	Id       string             `json:"id"`      // 同一个消息里面的id是相同的
	Created  int64              `json:"created"` // 消息初始生成时间
	Content  string             `json:"content"` // 消息具体内容
	Document []*schema.Document `json:"document"`
}

Jump to

Keyboard shortcuts

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