* Formats custom instructions with proper sectioning * @returns Formatted custom instructions string
()
| 85 | * @returns Formatted custom instructions string |
| 86 | */ |
| 87 | public formatCustomInstructions(): string | undefined { |
| 88 | if (!this.customInstructions?.trim()) { |
| 89 | return undefined |
| 90 | } |
| 91 | |
| 92 | return dedent`==== |
| 93 | USER'S CUSTOM INSTRUCTIONS |
| 94 | The following additional instructions are provided by the user. They should be followed and given precedence in case of conflicts with previous instructions. |
| 95 | |
| 96 | ${this.customInstructions.trim()} |
| 97 | ` |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Creates a streaming API request |