mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-13 04:38:00 +08:00
feat: align Go/Node DSML tool-call parsing drift tolerance and update API docs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -113,6 +113,9 @@ func TestBuildOpenAIPromptWithToolInstructionsOnlyOmitsSchemas(t *testing.T) {
|
||||
if strings.Contains(finalPrompt, "You have access to these tools") || strings.Contains(finalPrompt, "Description: search docs") || strings.Contains(finalPrompt, "Parameters:") {
|
||||
t.Fatalf("tool descriptions should be externalized, got: %q", finalPrompt)
|
||||
}
|
||||
if !strings.Contains(finalPrompt, "Treat DS2API_TOOLS.txt as the authoritative list of callable tools and schemas") {
|
||||
t.Fatalf("expected instructions-only prompt to point model at tools file, got: %q", finalPrompt)
|
||||
}
|
||||
if !strings.Contains(finalPrompt, "TOOL CALL FORMAT") || !strings.Contains(finalPrompt, "Remember: The ONLY valid way to use tools") {
|
||||
t.Fatalf("expected tool format instructions to remain in live prompt, got: %q", finalPrompt)
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ type StandardRequest struct {
|
||||
HistoryText string
|
||||
PromptTokenText string
|
||||
CurrentInputFileApplied bool
|
||||
CurrentInputFileID string
|
||||
CurrentToolsFileID string
|
||||
ToolsRaw any
|
||||
FinalPrompt string
|
||||
ToolNames []string
|
||||
|
||||
@@ -39,6 +39,8 @@ func injectToolPromptWithDescriptions(messages []map[string]any, tools []any, po
|
||||
toolPrompt := parts.Instructions
|
||||
if includeDescriptions && parts.Descriptions != "" {
|
||||
toolPrompt = parts.Descriptions + "\n\n" + toolPrompt
|
||||
} else if !includeDescriptions && parts.Descriptions != "" {
|
||||
toolPrompt = "Available tool descriptions and parameter schemas are attached in DS2API_TOOLS.txt. Treat DS2API_TOOLS.txt as the authoritative list of callable tools and schemas; use only tools and parameters listed there.\n\n" + toolPrompt
|
||||
}
|
||||
|
||||
for i := range messages {
|
||||
|
||||
Reference in New Issue
Block a user