Skip to content

Commit 3c5a9c9

Browse files
committed
feat: improve AgenticResponseMeta definition
1 parent 962b06f commit 3c5a9c9

File tree

6 files changed

+72
-23
lines changed

6 files changed

+72
-23
lines changed

schema/agentic_message.go

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
package schema
1818

1919
import (
20-
"github.com/cloudwego/eino/schema/anthropic"
21-
"github.com/cloudwego/eino/schema/google"
20+
"github.com/cloudwego/eino/schema/claude"
21+
"github.com/cloudwego/eino/schema/gemini"
2222
"github.com/cloudwego/eino/schema/openai"
2323
"github.com/eino-contrib/jsonschema"
2424
)
@@ -66,16 +66,16 @@ type AgenticMessage struct {
6666
}
6767

6868
type AgenticResponseMeta struct {
69-
Status *string
70-
FinishReason string
71-
7269
TokenUsage *TokenUsage
7370

74-
GoogleAdditionalMeta *google.CandidateMeta
71+
GeminiExtensions *gemini.ResponseMeta
72+
OpenAIExtensions *openai.ResponseMeta
73+
ClaudeExtensions *claude.MessageMeta
74+
Extensions any
7575
}
7676

7777
type StreamMeta struct {
78-
// Index is the index position of this block in the final response.
78+
// Index specifies the index position of this block in the final response.
7979
Index int
8080
}
8181

@@ -166,8 +166,8 @@ type UserInputFile struct {
166166
type AssistantGenText struct {
167167
Text string
168168

169-
OpenAIAnnotations []*openai.TextAnnotation
170-
AnthropicCitations []*anthropic.TextCitation
169+
OpenAIAnnotations []*openai.TextAnnotation
170+
ClaudeCitations []*claude.TextCitation
171171

172172
// Extra stores additional information.
173173
Extra map[string]any
@@ -203,7 +203,6 @@ type AssistantGenVideo struct {
203203
type Reasoning struct {
204204
// Summary is the reasoning content summary.
205205
Summary []*ReasoningSummary
206-
207206
// EncryptedContent is the encrypted reasoning content.
208207
EncryptedContent string
209208

@@ -212,19 +211,17 @@ type Reasoning struct {
212211
}
213212

214213
type ReasoningSummary struct {
215-
// Index specifies the ReasoningSummary chunk to be concatenated during streaming.
216-
Index *int
214+
// Index specifies the index position of this summary in the final Reasoning.
215+
Index int
217216

218217
Text string
219218
}
220219

221220
type FunctionToolCall struct {
222221
// CallID is the unique identifier for the tool call.
223222
CallID string
224-
225223
// Name specifies the function tool invoked.
226224
Name string
227-
228225
// Arguments is the JSON string arguments for the function tool call.
229226
Arguments string
230227

@@ -235,10 +232,8 @@ type FunctionToolCall struct {
235232
type FunctionToolResult struct {
236233
// CallID is the unique identifier for the tool call.
237234
CallID string
238-
239235
// Name specifies the function tool invoked.
240236
Name string
241-
242237
// Result is the function tool result returned by the user
243238
Result string
244239

@@ -250,15 +245,12 @@ type ServerToolCall struct {
250245
// Name specifies the server-side tool invoked.
251246
// Supplied by the model server (e.g., `web_search` for OpenAI, `googleSearch` for Gemini).
252247
Name string
253-
254248
// CallID is the unique identifier for the tool call.
255249
// Empty if not provided by the model server.
256250
CallID string
257-
258251
// Arguments are the raw inputs to the server-side tool,
259252
// supplied by the component implementer.
260253
Arguments any
261-
262254
// Extra stores additional information.
263255
Extra map[string]any
264256
}

schema/anthropic/citation.go renamed to schema/claude/citation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package anthropic
17+
package claude
1818

1919
type TextCitation struct {
2020
Type TextCitationType `json:"type"`

schema/claude/messages_meta.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* Copyright 2025 CloudWeGo Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package claude
18+
19+
type MessageMeta struct {
20+
ID string `json:"id"`
21+
StopReason string `json:"stop_reason"`
22+
}

schema/anthropic/types.go renamed to schema/claude/types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package anthropic
17+
package claude
1818

1919
type TextCitationType string
2020

schema/google/candidate_meta.go renamed to schema/gemini/response_meta.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
package google
17+
package gemini
1818

19-
type CandidateMeta struct {
19+
type ResponseMeta struct {
20+
ID string `json:"id"`
21+
FinishReason string `json:"finish_reason"`
2022
GroundingMeta *GroundingMetadata `json:"grounding_meta,omitempty"`
2123
}
2224

schema/openai/response_meta.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2025 CloudWeGo Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package openai
18+
19+
type ResponseMeta struct {
20+
ID string `json:"id"`
21+
Status string `json:"status"`
22+
Error *ResponseError `json:"error,omitempty"`
23+
IncompleteDetails *IncompleteDetails `json:"incomplete_details,omitempty"`
24+
}
25+
26+
type ResponseError struct {
27+
Code string `json:"code"`
28+
Message string `json:"message"`
29+
}
30+
31+
type IncompleteDetails struct {
32+
Reason string `json:"reason"`
33+
}

0 commit comments

Comments
 (0)