68 lines
1.3 KiB
Go
68 lines
1.3 KiB
Go
package domain
|
|
|
|
import "context"
|
|
|
|
type LLMModelDetail struct {
|
|
ParentModel string `json:"parent_model"`
|
|
Format string `json:"format"`
|
|
Family string `json:"family"`
|
|
Families []string `json:"families"`
|
|
ParameterSize string `json:"parameter_size"`
|
|
QuantizationLevel string `json:"quantization_level"`
|
|
}
|
|
|
|
type LLMModel struct {
|
|
Name string `json:"name"`
|
|
Model string `json:"model"`
|
|
ModifiedAt int64 `json:"modified_at"`
|
|
Size int64 `json:"size"`
|
|
Digest string `json:"digest"`
|
|
Detail *LLMModelDetail `json:"detail"`
|
|
}
|
|
|
|
type Message struct {
|
|
Role string
|
|
Content string
|
|
ToolCalls []ToolCall
|
|
ToolCallID string
|
|
|
|
//Reasoning *Reasoning
|
|
}
|
|
|
|
type Tool struct {
|
|
}
|
|
|
|
type ToolCall struct {
|
|
}
|
|
|
|
type Chunk struct {
|
|
Content string
|
|
}
|
|
|
|
type StreamParams struct {
|
|
Tools []*Tool
|
|
OnChunk func(chunk *Chunk)
|
|
OnDebug func()
|
|
}
|
|
|
|
type Role string
|
|
|
|
const (
|
|
RoleSystem Role = "system"
|
|
RoleUser Role = "user"
|
|
RoleAssistant Role = "assistant"
|
|
RoleTool Role = "tool"
|
|
)
|
|
|
|
type LLMEngine interface {
|
|
ListProviderTypes() []Item
|
|
ListModelsFromProvider(ctx context.Context, provider *Provider) ([]string, error)
|
|
Stream(
|
|
ctx context.Context,
|
|
provider *Provider,
|
|
modelID string,
|
|
params *StreamParams,
|
|
messages []*Message,
|
|
) error
|
|
}
|