Add Scriptorium-backed LLM runtime
This commit is contained in:
@@ -3,7 +3,6 @@ package cli
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/core/artifacts"
|
||||
"gitea.maximumdirect.net/eric/notarius/internal/core/config"
|
||||
@@ -144,6 +143,23 @@ func productionLLMClientFactory(ctx context.Context, cfg config.Config, profileI
|
||||
if err := ctx.Err(); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
trimmedID := strings.TrimSpace(profileID)
|
||||
return nil, nil, fmt.Errorf("create Scriptorium-backed LLM client for profile %q: not implemented yet", trimmedID)
|
||||
assets, err := productionPromptAssets()
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
recorder := llm.NewLLMProfileRecorder()
|
||||
client, err := llm.NewScriptoriumClient(llm.ScriptoriumClientConfig{
|
||||
ProfileDir: cfg.Scriptorium.ProfileDir,
|
||||
ProfileFile: cfg.Scriptorium.ProfileFile,
|
||||
Assets: assets,
|
||||
Recorder: recorder,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("create Scriptorium-backed LLM client: %w", err)
|
||||
}
|
||||
scheduler, err := llm.NewScheduler(cfg.Concurrency.TotalLLM)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("create LLM scheduler: %w", err)
|
||||
}
|
||||
return llm.NewScheduledClient(client, scheduler), nil, nil
|
||||
}
|
||||
|
||||
@@ -445,15 +445,18 @@ func TestRunInvalidFlagsExitTwo(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestProductionLLMClientFactoryReportsPendingScriptoriumRuntime(t *testing.T) {
|
||||
func TestProductionLLMClientFactoryBuildsScriptoriumRuntime(t *testing.T) {
|
||||
cfg := config.Default()
|
||||
|
||||
_, _, err := productionLLMClientFactory(context.Background(), cfg, "mistral-small-3")
|
||||
if err == nil {
|
||||
t.Fatal("productionLLMClientFactory() error = nil, want error")
|
||||
client, profiles, err := productionLLMClientFactory(context.Background(), cfg, "mistral-small-3")
|
||||
if err != nil {
|
||||
t.Fatalf("productionLLMClientFactory() error = %v, want nil", err)
|
||||
}
|
||||
if !strings.Contains(err.Error(), "Scriptorium-backed LLM client") || !strings.Contains(err.Error(), "not implemented yet") {
|
||||
t.Fatalf("error = %q, want pending Scriptorium runtime context", err.Error())
|
||||
if client == nil {
|
||||
t.Fatal("productionLLMClientFactory() client = nil, want client")
|
||||
}
|
||||
if profiles != nil {
|
||||
t.Fatalf("productionLLMClientFactory() profiles = %#v, want runtime-reported profiles", profiles)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user