fix(tools): centralize shared LLM note constants
This commit is contained in:
parent
9b4efddd9b
commit
743cd3602b
2 changed files with 8 additions and 8 deletions
|
|
@ -8,8 +8,8 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
handledToolLLMNote = "The requested output has already been delivered to the user in the current chat. Do not call send_file or any other delivery tool again. If you reply, provide only a brief confirmation."
|
HandledToolLLMNote = "The requested output has already been delivered to the user in the current chat. Do not call send_file or any other delivery tool again. If you reply, provide only a brief confirmation."
|
||||||
artifactPathsLLMNote = "Use `send_file` with one of these paths to send it to the user, or use file/exec tools to save it inside the workspace if requested."
|
ArtifactPathsLLMNote = "Use `send_file` with one of these paths to send it to the user, or use file/exec tools to save it inside the workspace if requested."
|
||||||
)
|
)
|
||||||
|
|
||||||
// ToolResult represents the structured return value from tool execution.
|
// ToolResult represents the structured return value from tool execution.
|
||||||
|
|
@ -73,14 +73,14 @@ func (tr *ToolResult) ContentForLLM() string {
|
||||||
}
|
}
|
||||||
if tr.ResponseHandled {
|
if tr.ResponseHandled {
|
||||||
if content == "" {
|
if content == "" {
|
||||||
return handledToolLLMNote
|
return HandledToolLLMNote
|
||||||
}
|
}
|
||||||
if !strings.Contains(content, handledToolLLMNote) {
|
if !strings.Contains(content, HandledToolLLMNote) {
|
||||||
content += "\n" + handledToolLLMNote
|
content += "\n" + HandledToolLLMNote
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if len(tr.ArtifactTags) > 0 {
|
if len(tr.ArtifactTags) > 0 {
|
||||||
artifactNote := "Local artifact paths: " + strings.Join(tr.ArtifactTags, " ") + "\n" + artifactPathsLLMNote
|
artifactNote := "Local artifact paths: " + strings.Join(tr.ArtifactTags, " ") + "\n" + ArtifactPathsLLMNote
|
||||||
if content == "" {
|
if content == "" {
|
||||||
content = artifactNote
|
content = artifactNote
|
||||||
} else if !strings.Contains(content, artifactNote) {
|
} else if !strings.Contains(content, artifactNote) {
|
||||||
|
|
|
||||||
|
|
@ -26,8 +26,8 @@ type (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
handledToolLLMNote = "The requested output has already been delivered to the user in the current chat. Do not call send_file or any other delivery tool again. If you reply, provide only a brief confirmation."
|
handledToolLLMNote = toolshared.HandledToolLLMNote
|
||||||
artifactPathsLLMNote = "Use `send_file` with one of these paths to send it to the user, or use file/exec tools to save it inside the workspace if requested."
|
artifactPathsLLMNote = toolshared.ArtifactPathsLLMNote
|
||||||
)
|
)
|
||||||
|
|
||||||
func WithToolContext(ctx context.Context, channel, chatID string) context.Context {
|
func WithToolContext(ctx context.Context, channel, chatID string) context.Context {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue