Skip to content

Commit f9c43e0

Browse files
committed
support otel tool input and outputy
1 parent 88c9ac3 commit f9c43e0

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

backend/modules/observability/lib/otel/consts.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,9 @@ const (
101101
// otel attribute key
102102
const (
103103
otelAttributeModelInputTools = "gen_ai.tool.definitions" // model tools
104+
105+
otelAttributeToolInput = "gen_ai.tool.call.arguments" // tool input
106+
otelAttributeToolOutput = "gen_ai.tool.call.result"
104107
)
105108

106109
var otelMessageEventNameMap = []string{

backend/modules/observability/lib/otel/open_inference/openinference.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ func convertModelMsg(msg map[string]interface{}) map[string]interface{} {
8686
}
8787
typ, _ := mcContent["type"]
8888
text, _ := mcContent["text"]
89+
if text == nil {
90+
text, _ = mcContent["content"]
91+
}
8992
image, _ := mcContent["image_url"]
9093
part := map[string]interface{}{}
9194
switch typ {

backend/modules/observability/lib/otel/otel_convert.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
// FieldConfMap Field configuration, supports configuring data sources and export methods for fields, currently supports attribute, event, is_tag, data_type
2727
// Among them, attributes and events support configuring multiple, while tags and datatypes only support configuring one.
2828
// For AttributeKey and AttributeKeyPrefix, the field at the head has higher priority, and result will be returned once a match is found.
29-
// FOr Events, the fields have same priority, and result will be fixed by all fields.
29+
// For Events, the fields have same priority, and result will be fixed by all fields.
3030
// Other types of configurations need to be manually processed in the code.
3131
var (
3232
FieldConfMap = map[string]FieldConf{
@@ -93,6 +93,7 @@ var (
9393
springAIAttributeToolInput,
9494
otelAttributeInput,
9595
apmInput,
96+
otelAttributeToolInput,
9697
},
9798
AttributeKeyPrefix: []string{
9899
openInferenceAttributeModelInputMessages,
@@ -121,6 +122,7 @@ var (
121122
springAIAttributeToolOutput,
122123
otelAttributeOutput,
123124
apmOutput,
125+
otelAttributeToolOutput,
124126
},
125127
AttributeKeyPrefix: []string{
126128
openInferenceAttributeModelOutputMessages,

0 commit comments

Comments
 (0)