--------------- helper functions --------------- normalizeMessages converts a fantasy.Prompt into a slice of normalizedMessage values with bounded part metadata.
(prompt fantasy.Prompt)
| 724 | // normalizeMessages converts a fantasy.Prompt into a slice of |
| 725 | // normalizedMessage values with bounded part metadata. |
| 726 | func normalizeMessages(prompt fantasy.Prompt) []normalizedMessage { |
| 727 | msgs := make([]normalizedMessage, 0, len(prompt)) |
| 728 | for _, m := range prompt { |
| 729 | msgs = append(msgs, normalizedMessage{ |
| 730 | Role: string(m.Role), |
| 731 | Parts: normalizeMessageParts(m.Content), |
| 732 | }) |
| 733 | } |
| 734 | return msgs |
| 735 | } |
| 736 | |
| 737 | // boundText truncates s to MaxMessagePartTextLength runes, appending |
| 738 | // an ellipsis if truncation occurs. |
no test coverage detected