51 lines
1.3 KiB
Go
51 lines
1.3 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"log"
|
|
"os"
|
|
|
|
"gitea.maximumdirect.net/eric/scriptorium"
|
|
)
|
|
|
|
func main() {
|
|
engine, err := scriptorium.NewEngine(scriptorium.Config{
|
|
PromptDir: "./examples/prompts",
|
|
ProfileDir: "./examples/profiles",
|
|
SchemaDir: "./examples/schemas",
|
|
})
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
prepared, err := engine.Prepare(context.Background(), scriptorium.RunRequest{
|
|
PromptID: "generic.markdown_summary",
|
|
Inputs: map[string]scriptorium.ArtifactRef{
|
|
"transcript": scriptorium.File("./examples/fixtures/transcript.md"),
|
|
"glossary": scriptorium.File("./examples/fixtures/glossary.yml"),
|
|
},
|
|
})
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
summary := struct {
|
|
PromptID string `json:"prompt_id"`
|
|
SelectedProfileID string `json:"selected_profile_id"`
|
|
Model string `json:"model"`
|
|
MessageCount int `json:"message_count"`
|
|
InputHashes map[string]string `json:"input_hashes"`
|
|
}{
|
|
PromptID: prepared.PromptID,
|
|
SelectedProfileID: prepared.SelectedProfileID,
|
|
Model: prepared.EffectiveModelParams.Model,
|
|
MessageCount: len(prepared.Messages),
|
|
InputHashes: prepared.InputHashes,
|
|
}
|
|
|
|
if err := json.NewEncoder(os.Stdout).Encode(summary); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
}
|