From 8ff41962e1d3f744082dfa596a77c5b038b19e05 Mon Sep 17 00:00:00 2001 From: "jiangqi.rrt" Date: Fri, 6 Feb 2026 18:55:26 +0800 Subject: [PATCH 1/4] supportmsg parts tool_call --- .../lib/otel/open_inference/openinference.go | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/backend/modules/observability/lib/otel/open_inference/openinference.go b/backend/modules/observability/lib/otel/open_inference/openinference.go index 83a08bb9f..9f89c7101 100644 --- a/backend/modules/observability/lib/otel/open_inference/openinference.go +++ b/backend/modules/observability/lib/otel/open_inference/openinference.go @@ -11,9 +11,11 @@ import ( type Literal string const ( - TextLiteral Literal = "text" - ImageLiteral Literal = "image" - ImageUrlLiteral Literal = "image_url" + TextLiteral Literal = "text" + ImageLiteral Literal = "image" + ImageUrlLiteral Literal = "image_url" + ReasoningLiteral Literal = "reasoning" + ToolCallLiteral Literal = "tool_call" ) type ModelMessagePartType string @@ -78,6 +80,7 @@ func convertModelMsg(msg map[string]interface{}) map[string]interface{} { } if len(contents) > 0 { parts := make([]interface{}, 0, len(contents)) + toolCalls := make([]interface{}, 0) for _, content := range contents { if mc, ok := content.(map[string]interface{}); ok { mcContent, ok := mc["message_content"].(map[string]interface{}) @@ -102,11 +105,29 @@ func convertModelMsg(msg map[string]interface{}) map[string]interface{} { url, _ := imageMap["url"] part["image_url"] = map[string]interface{}{"url": url} } + case string(ReasoningLiteral): + modelMsg["reasoning_content"] = text + case string(ToolCallLiteral): + toolCallId, _ := mcContent["id"] + toolCallName, _ := mcContent["name"] + toolCallArguments, _ := mcContent["arguments"] + modelCall := map[string]interface{}{ + "type": "function", + "id": toolCallId, + "function": map[string]interface{}{ + "name": toolCallName, + "arguments": toolCallArguments, + }, + } + toolCalls = append(toolCalls, modelCall) default: } parts = append(parts, part) } } + if len(toolCalls) > 0 { + modelMsg["tool_calls"] = toolCalls + } if len(parts) > 0 { modelMsg["parts"] = parts } From 444e5cccf55da1486e1db8d7a061a60c84138cf7 Mon Sep 17 00:00:00 2001 From: "jiangqi.rrt" Date: Wed, 11 Feb 2026 10:46:10 +0800 Subject: [PATCH 2/4] up --- .../lib/otel/open_inference/openinference.go | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/backend/modules/observability/lib/otel/open_inference/openinference.go b/backend/modules/observability/lib/otel/open_inference/openinference.go index 9f89c7101..6ba8e1159 100644 --- a/backend/modules/observability/lib/otel/open_inference/openinference.go +++ b/backend/modules/observability/lib/otel/open_inference/openinference.go @@ -11,11 +11,12 @@ import ( type Literal string const ( - TextLiteral Literal = "text" - ImageLiteral Literal = "image" - ImageUrlLiteral Literal = "image_url" - ReasoningLiteral Literal = "reasoning" - ToolCallLiteral Literal = "tool_call" + TextLiteral Literal = "text" + ImageLiteral Literal = "image" + ImageUrlLiteral Literal = "image_url" + ReasoningLiteral Literal = "reasoning" + ToolCallLiteral Literal = "tool_call" + ToolCallResponseLiteral Literal = "tool_call_response" ) type ModelMessagePartType string @@ -120,9 +121,18 @@ func convertModelMsg(msg map[string]interface{}) map[string]interface{} { }, } toolCalls = append(toolCalls, modelCall) + part = nil + case string(ToolCallResponseLiteral): + toolCallId, _ := mcContent["id"] + toolCallResult, _ := mcContent["result"] + modelMsg["content"] = toolCallResult + modelMsg["tool_call_id"] = toolCallId + part = nil default: } - parts = append(parts, part) + if part != nil { + parts = append(parts, part) + } } } if len(toolCalls) > 0 { From b704bde7a84ce824771cd0fdd719e697eef1c6d1 Mon Sep 17 00:00:00 2001 From: "jiangqi.rrt" Date: Wed, 11 Feb 2026 11:14:30 +0800 Subject: [PATCH 3/4] up --- .../observability/lib/otel/open_inference/openinference.go | 1 + 1 file changed, 1 insertion(+) diff --git a/backend/modules/observability/lib/otel/open_inference/openinference.go b/backend/modules/observability/lib/otel/open_inference/openinference.go index 6ba8e1159..e5c5d605b 100644 --- a/backend/modules/observability/lib/otel/open_inference/openinference.go +++ b/backend/modules/observability/lib/otel/open_inference/openinference.go @@ -108,6 +108,7 @@ func convertModelMsg(msg map[string]interface{}) map[string]interface{} { } case string(ReasoningLiteral): modelMsg["reasoning_content"] = text + part = nil case string(ToolCallLiteral): toolCallId, _ := mcContent["id"] toolCallName, _ := mcContent["name"] From bfec2a39ee32560f672ba5a2e5f76793aefca555 Mon Sep 17 00:00:00 2001 From: "jiangqi.rrt" Date: Wed, 11 Feb 2026 11:42:44 +0800 Subject: [PATCH 4/4] up --- .../observability/lib/otel/open_inference/openinference.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/modules/observability/lib/otel/open_inference/openinference.go b/backend/modules/observability/lib/otel/open_inference/openinference.go index e5c5d605b..cd4158852 100644 --- a/backend/modules/observability/lib/otel/open_inference/openinference.go +++ b/backend/modules/observability/lib/otel/open_inference/openinference.go @@ -125,7 +125,10 @@ func convertModelMsg(msg map[string]interface{}) map[string]interface{} { part = nil case string(ToolCallResponseLiteral): toolCallId, _ := mcContent["id"] - toolCallResult, _ := mcContent["result"] + toolCallResult, _ := mcContent["response"] + if toolCallResult == nil { + toolCallResult, _ = mcContent["result"] + } modelMsg["content"] = toolCallResult modelMsg["tool_call_id"] = toolCallId part = nil