(turn memcontract.TurnRecord)
| 683 | } |
| 684 | |
| 685 | func renderMemoryExtractorPrompt(turn memcontract.TurnRecord) (string, error) { |
| 686 | tmpl, err := prompts.ParseTemplate(prompts.NameExtract, prompts.VersionV1) |
| 687 | if err != nil { |
| 688 | return "", err |
| 689 | } |
| 690 | policy, err := prompts.Load(prompts.NameWhatNotToSave, prompts.VersionV1) |
| 691 | if err != nil { |
| 692 | return "", err |
| 693 | } |
| 694 | var rendered bytes.Buffer |
| 695 | data := map[string]any{ |
| 696 | "WhatNotToSave": policy.Content, |
| 697 | "Turn": turn, |
| 698 | "Transcript": renderMemoryTranscript(turn.Snapshot), |
| 699 | } |
| 700 | if err := tmpl.Execute(&rendered, data); err != nil { |
| 701 | return "", fmt.Errorf("daemon: render memory extractor prompt: %w", err) |
| 702 | } |
| 703 | return rendered.String(), nil |
| 704 | } |
| 705 | |
| 706 | func renderMemoryTranscript(snapshot memcontract.TranscriptSnapshot) string { |
| 707 | var buf strings.Builder |
no test coverage detected