Documentation
¶
Index ¶
- Variables
- func ApplyChunkOverlap(chunks []string, overlapSize int) []string
- func ChunkFile(filePath string, chunkSize int) ([]string, error)
- func ChunkReaderByLines(reader io.Reader, maxChunkSize int) ([]string, error)
- func ChunkStructuredFile(filePath string, maxChunkSize int) ([]string, error)
- func CreateOverlappingChunks(chunks []string, overlapSize int) []string
- func GetFileType(fileExt string) string
- type AOGAPIResponse
- type AOGEmbeddingResponse
- type AOGGenerateResponse
- type ChunkScore
- type EmbeddingData
- type EmbeddingRequest
- type EmbeddingResponse
- type EmbeddingUsage
- type EngineService
- type EngineServiceInterface
- type EngineServiceProvider
- type GenerateRequest
- type GenerateResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var RagConfig, _ = getRagConfig()
View Source
var RagPromptTemplate = `` /* 463-byte string literal not displayed */
Functions ¶
func ApplyChunkOverlap ¶
func ChunkReaderByLines ¶
ChunkReaderByLines Block by row
func ChunkStructuredFile ¶
ChunkStructuredFile
func CreateOverlappingChunks ¶
CreateOverlappingChunks create overlapping blocks from the given text block chunks: original text block overlapSize: the size of the overlap (number of characters) Return a new block with overlap
func GetFileType ¶
Types ¶
type AOGAPIResponse ¶
type AOGEmbeddingResponse ¶
type AOGGenerateResponse ¶
type ChunkScore ¶
type EmbeddingData ¶
type EmbeddingRequest ¶
type EmbeddingResponse ¶
type EmbeddingResponse struct {
Object string `json:"object"`
Embeddings [][]float32 `json:"embeddings"`
Model string `json:"model"`
Usage EmbeddingUsage `json:"usage"`
}
type EmbeddingUsage ¶
type EngineService ¶
type EngineService struct {
// contains filtered or unexported fields
}
func (*EngineService) Generate ¶
func (e *EngineService) Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
Generate Implementing non-streaming text generation
func (*EngineService) GenerateEmbedding ¶
func (e *EngineService) GenerateEmbedding(ctx context.Context, req *EmbeddingRequest) (*EmbeddingResponse, error)
GenerateEmbedding Implement vector embedding generation function
type EngineServiceInterface ¶
type EngineServiceInterface interface {
// Generate
Generate(ctx context.Context, req *GenerateRequest) (*GenerateResponse, error)
// GenerateEmbedding
GenerateEmbedding(ctx context.Context, req *EmbeddingRequest) (*EmbeddingResponse, error)
}
EngineServiceInterface Defines the core interface of the engine service
type EngineServiceProvider ¶
type EngineServiceProvider interface {
EngineServiceInterface
}
EngineServiceProvider Defines the core interface of the engine service
func NewEngineService ¶
func NewEngineService() EngineServiceProvider
NewEngineService Create a new engine service instance
type GenerateRequest ¶
type GenerateRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
Temperature float32 `json:"temperature,omitempty"`
MaxTokens int `json:"max_tokens,omitempty"`
Stream bool `json:"stream,omitempty"`
Think bool `json:"think"`
}
GenerateRequest
type GenerateResponse ¶
type GenerateResponse struct {
ID string `json:"id"`
Model string `json:"model"`
ModelName string `json:"model_name,omitempty"` // 新增字段
Content string `json:"content"`
IsComplete bool `json:"is_complete"` // 流式输出时,是否是最后一个块
Thoughts string `json:"thinking,omitempty"` // 深度思考的结果
}
GenerateResponse
Click to show internal directories.
Click to hide internal directories.