23 lines
647 B
Go
23 lines
647 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"github.com/cloudwego/eino/compose"
|
|
"github.com/cloudwego/eino/schema"
|
|
"ai_scheduler/internal/config"
|
|
"ai_scheduler/internal/domain/llm/pipeline"
|
|
)
|
|
|
|
type VisionService struct{ run compose.Runnable[[]*schema.Message, *schema.Message] }
|
|
|
|
func NewVisionService(ctx context.Context, cfg *config.Config) (*VisionService, error) {
|
|
r, err := pipeline.BuildVision(ctx, cfg)
|
|
if err != nil { return nil, err }
|
|
return &VisionService{run: r}, nil
|
|
}
|
|
|
|
func (s *VisionService) Invoke(ctx context.Context, msgs []*schema.Message) (*schema.Message, error) {
|
|
return s.run.Invoke(ctx, msgs)
|
|
}
|
|
|