Documentation
¶
Index ¶
- Constants
- Variables
- func MustExtractFlowSchema(def map[string]any) map[string]any
- func MustRegisterJSONLinesLoader(r *orchestrator.Registry)
- func MustRegisterSplitter(r *orchestrator.Registry)
- func MustRegisterTemplate(r *orchestrator.Registry)
- func MustRegisterTextLoader(r *orchestrator.Registry)
- type BoundedContainer
- type Document
- type JSONLinesLoader
- type JSONLinesLoaderBuilder
- type Metadata
- type Similarity
- type Splitter
- type SplitterBuilder
- type Template
- type TemplateBuilder
- type TextLoader
- type TextLoaderBuilder
- type Vector
Constants ¶
View Source
const TypeJSONLinesLoader = "jsonlines_loader"
View Source
const TypeSplitter = "splitter"
View Source
const TypeTemplate = "template"
View Source
const TypeTextLoader = "text_loader"
Variables ¶
View Source
var FlowSchemas map[string]map[string]any
Schemas for flows defined in llmflow.
View Source
var TaskSchemas map[string]map[string]any
Schemas for tasks defined in llmflow.
Functions ¶
func MustExtractFlowSchema ¶
MustExtractFlowSchema extracts the schema from a flow definition.
func MustRegisterJSONLinesLoader ¶
func MustRegisterJSONLinesLoader(r *orchestrator.Registry)
func MustRegisterSplitter ¶
func MustRegisterSplitter(r *orchestrator.Registry)
func MustRegisterTemplate ¶
func MustRegisterTemplate(r *orchestrator.Registry)
func MustRegisterTextLoader ¶
func MustRegisterTextLoader(r *orchestrator.Registry)
Types ¶
type BoundedContainer ¶
type BoundedContainer[E any] struct { // contains filtered or unexported fields }
BoundedContainer is a container with a bounded length.
func NewBoundedContainer ¶
func NewBoundedContainer[E any](size int) *BoundedContainer[E]
func (*BoundedContainer[E]) Append ¶
func (bc *BoundedContainer[E]) Append(item E) (isFull bool)
Append adds item to the right side of the container. It will return a boolean value indicates whether the container is full after this addition.
func (*BoundedContainer[E]) PopAll ¶
func (bc *BoundedContainer[E]) PopAll() []E
PopAll removes and returns all items from the container.
type JSONLinesLoader ¶
type JSONLinesLoader struct {
orchestrator.TaskHeader
Input struct {
ID string `json:"id"`
Filename orchestrator.Expr[string] `json:"filename"`
Content orchestrator.Expr[string] `json:"content"`
Pointer string `json:"pointer"`
BatchSize int `json:"batch_size"`
} `json:"input"`
Output struct {
Documents []*Document `json:"documents"`
}
}
func (*JSONLinesLoader) Execute ¶
func (l *JSONLinesLoader) Execute(ctx context.Context, input orchestrator.Input) (orchestrator.Output, error)
func (*JSONLinesLoader) String ¶
func (l *JSONLinesLoader) String() string
type JSONLinesLoaderBuilder ¶
type JSONLinesLoaderBuilder struct {
// contains filtered or unexported fields
}
func NewJSONLinesLoader ¶
func NewJSONLinesLoader(name string) *JSONLinesLoaderBuilder
func (*JSONLinesLoaderBuilder) Build ¶
func (b *JSONLinesLoaderBuilder) Build() orchestrator.Task
type Metadata ¶
type Metadata struct {
// The source ID of the document.
//
// Source/Document has different meanings in different scenarios. For example:
//
// 1. Document Splitting
// Source => The whole Document
// Document => Single Chunk
//
// 2. Knowledge Base
// Source => The whole Knowledge Base
// Document => Single Knowledge Point
SourceID string `json:"source_id,omitempty"`
// The user ID. Typically useful in multi-tenant scenario.
UserID string `json:"user_id,omitempty"`
// The collection name. Only useful for vector stores that support the
// concept of Collection (e.g. Milvus, Typesense).
CollectionID string `json:"collection_id,omitempty"`
}
type Similarity ¶
type Splitter ¶
type Splitter struct {
orchestrator.TaskHeader
Input struct {
Documents orchestrator.Expr[[]*Document] `json:"documents"`
SplitChars []string `json:"split_chars"`
ChunkSize int `json:"chunk_size"`
} `json:"input"`
}
func (*Splitter) Execute ¶
func (s *Splitter) Execute(ctx context.Context, input orchestrator.Input) (orchestrator.Output, error)
type SplitterBuilder ¶
type SplitterBuilder struct {
// contains filtered or unexported fields
}
func NewSplitter ¶
func NewSplitter(name string) *SplitterBuilder
func (*SplitterBuilder) Build ¶
func (b *SplitterBuilder) Build() orchestrator.Task
type Template ¶
type Template struct {
orchestrator.TaskHeader
Input struct {
Template string `json:"template"`
Args orchestrator.Expr[map[string]any] `json:"args"`
} `json:"input"`
}
Template is a leaf task that is used to render a template by applying given arguments.
func (*Template) Execute ¶
func (t *Template) Execute(ctx context.Context, input orchestrator.Input) (output orchestrator.Output, err error)
type TemplateBuilder ¶
type TemplateBuilder struct {
// contains filtered or unexported fields
}
func NewTemplate ¶
func NewTemplate(name string) *TemplateBuilder
func (*TemplateBuilder) Build ¶
func (b *TemplateBuilder) Build() orchestrator.Task
type TextLoader ¶
type TextLoader struct {
orchestrator.TaskHeader
Input struct {
ID string `json:"id"`
Filename string `json:"filename"`
} `json:"input"`
}
func (*TextLoader) Execute ¶
func (l *TextLoader) Execute(ctx context.Context, input orchestrator.Input) (orchestrator.Output, error)
func (*TextLoader) String ¶
func (l *TextLoader) String() string
type TextLoaderBuilder ¶
type TextLoaderBuilder struct {
// contains filtered or unexported fields
}
func NewTextLoader ¶
func NewTextLoader(name string) *TextLoaderBuilder
func (*TextLoaderBuilder) Build ¶
func (b *TextLoaderBuilder) Build() orchestrator.Task
Click to show internal directories.
Click to hide internal directories.
