hiagent-api 2.3.2__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/PKG-INFO +1 -1
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/chat.py +140 -16
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/chat_types.py +125 -1
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/eva.py +89 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/eva_types.py +68 -25
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/workflow_types.py +1 -1
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/pyproject.toml +1 -1
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/.gitignore +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/README.md +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/__init__.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/base.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/knowledgebase.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/knowledgebase_types.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/observe.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/observe_types.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/tool.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/tool_types.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/up.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/up_types.py +0 -0
- {hiagent_api-2.3.2 → hiagent_api-2.4.0}/hiagent_api/workflow.py +0 -0
|
@@ -21,24 +21,72 @@ from volcengine.ServiceInfo import ServiceInfo
|
|
|
21
21
|
|
|
22
22
|
from hiagent_api.base import AppAPIMixin, Service
|
|
23
23
|
from hiagent_api.chat_types import (
|
|
24
|
+
AgentErrorChatEvent,
|
|
24
25
|
AgentIntentionChatEvent,
|
|
25
26
|
AgentJumpChatEvent,
|
|
26
27
|
AgentTakeOverChatEvent,
|
|
27
28
|
AgentThoughtChatEvent,
|
|
28
29
|
AgentThoughtEndChatEvent,
|
|
29
30
|
AgentThoughtUpdateChatEvent,
|
|
31
|
+
AsyncResumeAppWorkflowRequest,
|
|
32
|
+
AsyncResumeAppWorkflowResponse,
|
|
30
33
|
BlockingChatResponse,
|
|
34
|
+
CancelConversationTopRequest,
|
|
35
|
+
ChatAgainRequest,
|
|
36
|
+
ChatContinueRequest,
|
|
31
37
|
ChatEvent,
|
|
32
38
|
ChatRequest,
|
|
39
|
+
ClearLongMemoryRequest,
|
|
40
|
+
ClearMessageRequest,
|
|
33
41
|
CreateConversationRequest,
|
|
34
42
|
CreateConversationResponse,
|
|
43
|
+
DeepSearchExtractionChatEvent,
|
|
44
|
+
DeepSearchExtractionEndChatEvent,
|
|
45
|
+
DeepSearchExtractionStartChatEvent,
|
|
46
|
+
DeepSearchQueryChatEvent,
|
|
47
|
+
DeepSearchQueryEndChatEvent,
|
|
48
|
+
DeepSearchQueryStartChatEvent,
|
|
49
|
+
DeepSearchThinkChatEvent,
|
|
50
|
+
DeepSearchThinkEndChatEvent,
|
|
51
|
+
DeepSearchThinkStartChatEvent,
|
|
52
|
+
DeleteConversationRequest,
|
|
53
|
+
DeleteLongMemoryRequest,
|
|
54
|
+
DeleteMessageRequest,
|
|
55
|
+
EmptyResponse,
|
|
56
|
+
EventTriggerWebhookResponse,
|
|
57
|
+
FeedbackRequest,
|
|
58
|
+
FlowCostWorkflowEvent,
|
|
59
|
+
FlowEndChatEvent,
|
|
60
|
+
FlowEndWorkflowEvent,
|
|
61
|
+
FlowErrorWorkflowEvent,
|
|
62
|
+
FlowInterruptedWorkflowEvent,
|
|
63
|
+
FlowStartChatEvent,
|
|
64
|
+
FlowStartWorkflowEvent,
|
|
35
65
|
GetAppConfigPreviewRequest,
|
|
36
66
|
GetAppConfigPreviewResponse,
|
|
67
|
+
GetAppUserVariablesRequest,
|
|
68
|
+
GetAppUserVariablesResponse,
|
|
69
|
+
GetConversationInputsRequest,
|
|
70
|
+
GetConversationInputsResponse,
|
|
71
|
+
GetConversationListRequest,
|
|
72
|
+
GetConversationListResponse,
|
|
73
|
+
GetConversationMessageRequest,
|
|
74
|
+
GetConversationMessageResponse,
|
|
75
|
+
GetMessageInfoRequest,
|
|
76
|
+
GetMessageInfoResponse,
|
|
77
|
+
GetOpeningConfigOpenRequest,
|
|
78
|
+
GetOpeningConfigOpenResponse,
|
|
79
|
+
GetSuggestedQuestionsRequest,
|
|
80
|
+
GetSuggestedQuestionsResponse,
|
|
37
81
|
InterruptedChatEvent,
|
|
38
82
|
KnowledgeGraphRetrieveChatEvent,
|
|
39
83
|
KnowledgeGraphRetrieveEndChatEvent,
|
|
40
84
|
KnowledgeRetrieveChatEvent,
|
|
41
85
|
KnowledgeRetrieveEndChatEvent,
|
|
86
|
+
ListLongMemoryRequest,
|
|
87
|
+
ListLongMemoryResponse,
|
|
88
|
+
ListOauth2TokenRequest,
|
|
89
|
+
ListOauth2TokenResponse,
|
|
42
90
|
LongTermMemoryRetrieveChatEvent,
|
|
43
91
|
LongTermMemoryRetrieveEndChatEvent,
|
|
44
92
|
MessageChatEvent,
|
|
@@ -46,12 +94,34 @@ from hiagent_api.chat_types import (
|
|
|
46
94
|
MessageEndChatEvent,
|
|
47
95
|
MessageFailedChatEvent,
|
|
48
96
|
MessageOutputEndChatEvent,
|
|
97
|
+
MessageOutputEndWorkflowEvent,
|
|
49
98
|
MessageOutputStartChatEvent,
|
|
99
|
+
MessageOutputStartWorkflowEvent,
|
|
50
100
|
MessageStartChatEvent,
|
|
101
|
+
MessageWorkflowEvent,
|
|
51
102
|
QARetrieveChatEvent,
|
|
103
|
+
QueryAppMessageOauthStatusOpenRequest,
|
|
104
|
+
QueryAppMessageOauthStatusResponse,
|
|
105
|
+
QueryAppSkillAsyncTaskRequest,
|
|
106
|
+
QueryAppSkillAsyncTaskResponse,
|
|
107
|
+
QueryRunAppProcessRequest,
|
|
108
|
+
QueryRunAppProcessResponse,
|
|
109
|
+
QueryTriggerRunRecordsRequest,
|
|
110
|
+
QueryTriggerRunRecordsResponse,
|
|
111
|
+
RunAppWorkflowRequest,
|
|
112
|
+
RunAppWorkflowResponse,
|
|
113
|
+
SetAppUserVariablesRequest,
|
|
114
|
+
SetConversationTopRequest,
|
|
115
|
+
SetMessageAnswerUsedRequest,
|
|
116
|
+
StopMessageRequest,
|
|
52
117
|
StreamingChatEventType,
|
|
118
|
+
StreamingWorkflowEventType,
|
|
53
119
|
SuggestionChatEvent,
|
|
54
120
|
SuggestionCostChatEvent,
|
|
121
|
+
SyncResumeAppWorkflowRequest,
|
|
122
|
+
SyncResumeAppWorkflowResponse,
|
|
123
|
+
SyncRunAppWorkflowRequest,
|
|
124
|
+
SyncRunAppWorkflowResponse,
|
|
55
125
|
TerminologyRetrieveChatEvent,
|
|
56
126
|
TerminologyRetrieveEndChatEvent,
|
|
57
127
|
ThinkMessageChatEvent,
|
|
@@ -59,23 +129,13 @@ from hiagent_api.chat_types import (
|
|
|
59
129
|
ThinkMessageOutputStartChatEvent,
|
|
60
130
|
ToolMessageChatEvent,
|
|
61
131
|
ToolMessageOutputEndChatEvent,
|
|
132
|
+
ToolMessageOutputEndWorkflowEvent,
|
|
62
133
|
ToolMessageOutputStartChatEvent,
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
SyncRunAppWorkflowRequest, SyncRunAppWorkflowResponse, QueryRunAppProcessRequest, QueryRunAppProcessResponse,
|
|
69
|
-
ListOauth2TokenRequest, ListOauth2TokenResponse, EventTriggerWebhookResponse, ChatContinueRequest,
|
|
70
|
-
ListLongMemoryRequest, ListLongMemoryResponse, UpdateLongMemoryRequest, DeleteLongMemoryRequest,
|
|
71
|
-
ClearLongMemoryRequest, AsyncResumeAppWorkflowRequest, AsyncResumeAppWorkflowResponse, SetConversationTopRequest,
|
|
72
|
-
CancelConversationTopRequest, QueryAppSkillAsyncTaskRequest, QueryAppSkillAsyncTaskResponse,
|
|
73
|
-
SyncResumeAppWorkflowRequest, SyncResumeAppWorkflowResponse, WorkflowEvent, StreamingWorkflowEventType,
|
|
74
|
-
FlowStartWorkflowEvent, FlowEndWorkflowEvent, FlowErrorWorkflowEvent, ToolMessageOutputEndWorkflowEvent,
|
|
75
|
-
ToolMessageOutputStartWorkflowEvent, ToolMessageWorkflowEvent, FlowCostWorkflowEvent, FlowInterruptedWorkflowEvent,
|
|
76
|
-
MessageOutputStartWorkflowEvent, MessageOutputEndWorkflowEvent, MessageWorkflowEvent, GetAppUserVariablesRequest,
|
|
77
|
-
GetAppUserVariablesResponse, SetAppUserVariablesRequest, QueryTriggerRunRecordsRequest,
|
|
78
|
-
QueryTriggerRunRecordsResponse,
|
|
134
|
+
ToolMessageOutputStartWorkflowEvent,
|
|
135
|
+
ToolMessageWorkflowEvent,
|
|
136
|
+
UpdateConversationRequest,
|
|
137
|
+
UpdateLongMemoryRequest,
|
|
138
|
+
WorkflowEvent,
|
|
79
139
|
)
|
|
80
140
|
|
|
81
141
|
|
|
@@ -849,6 +909,46 @@ class ChatService(Service, AppAPIMixin):
|
|
|
849
909
|
by_alias=True,
|
|
850
910
|
)
|
|
851
911
|
|
|
912
|
+
def query_message_oauth_status(
|
|
913
|
+
self, app_key: str, req: QueryAppMessageOauthStatusOpenRequest
|
|
914
|
+
) -> QueryAppMessageOauthStatusResponse:
|
|
915
|
+
return QueryAppMessageOauthStatusResponse.model_validate_json(
|
|
916
|
+
self._post(
|
|
917
|
+
app_key, "query_message_oauth_status", req.model_dump(by_alias=True)
|
|
918
|
+
),
|
|
919
|
+
by_alias=True,
|
|
920
|
+
)
|
|
921
|
+
|
|
922
|
+
async def aquery_message_oauth_status(
|
|
923
|
+
self, app_key: str, req: QueryAppMessageOauthStatusOpenRequest
|
|
924
|
+
) -> QueryAppMessageOauthStatusResponse:
|
|
925
|
+
return QueryAppMessageOauthStatusResponse.model_validate_json(
|
|
926
|
+
await self._apost(
|
|
927
|
+
app_key, "query_message_oauth_status", req.model_dump(by_alias=True)
|
|
928
|
+
),
|
|
929
|
+
by_alias=True,
|
|
930
|
+
)
|
|
931
|
+
|
|
932
|
+
def get_opening_config(
|
|
933
|
+
self, app_key: str, req: GetOpeningConfigOpenRequest
|
|
934
|
+
) -> GetOpeningConfigOpenResponse:
|
|
935
|
+
return GetOpeningConfigOpenResponse.model_validate_json(
|
|
936
|
+
self._post(
|
|
937
|
+
app_key, "get_opening_config", req.model_dump(by_alias=True)
|
|
938
|
+
),
|
|
939
|
+
by_alias=True,
|
|
940
|
+
)
|
|
941
|
+
|
|
942
|
+
async def aget_opening_config(
|
|
943
|
+
self, app_key: str, req: GetOpeningConfigOpenRequest
|
|
944
|
+
) -> GetOpeningConfigOpenResponse:
|
|
945
|
+
return GetOpeningConfigOpenResponse.model_validate_json(
|
|
946
|
+
await self._apost(
|
|
947
|
+
app_key, "get_opening_config", req.model_dump(by_alias=True)
|
|
948
|
+
),
|
|
949
|
+
by_alias=True,
|
|
950
|
+
)
|
|
951
|
+
|
|
852
952
|
|
|
853
953
|
def parse_chat_event(event_data: dict) -> Optional[ChatEvent]:
|
|
854
954
|
match event_data["event"]:
|
|
@@ -916,6 +1016,30 @@ def parse_chat_event(event_data: dict) -> Optional[ChatEvent]:
|
|
|
916
1016
|
return ThinkMessageOutputEndChatEvent.model_validate(event_data)
|
|
917
1017
|
case StreamingChatEventType.think_message:
|
|
918
1018
|
return ThinkMessageChatEvent.model_validate(event_data)
|
|
1019
|
+
case StreamingChatEventType.agent_error:
|
|
1020
|
+
return AgentErrorChatEvent.model_validate(event_data)
|
|
1021
|
+
case StreamingChatEventType.deep_search_think_start:
|
|
1022
|
+
return DeepSearchThinkStartChatEvent.model_validate(event_data)
|
|
1023
|
+
case StreamingChatEventType.deep_search_think_end:
|
|
1024
|
+
return DeepSearchThinkEndChatEvent.model_validate(event_data)
|
|
1025
|
+
case StreamingChatEventType.deep_search_think:
|
|
1026
|
+
return DeepSearchThinkChatEvent.model_validate(event_data)
|
|
1027
|
+
case StreamingChatEventType.deep_search_query_start:
|
|
1028
|
+
return DeepSearchQueryStartChatEvent.model_validate(event_data)
|
|
1029
|
+
case StreamingChatEventType.deep_search_query_end:
|
|
1030
|
+
return DeepSearchQueryEndChatEvent.model_validate(event_data)
|
|
1031
|
+
case StreamingChatEventType.deep_search_query:
|
|
1032
|
+
return DeepSearchQueryChatEvent.model_validate(event_data)
|
|
1033
|
+
case StreamingChatEventType.deep_search_extraction_start:
|
|
1034
|
+
return DeepSearchExtractionStartChatEvent.model_validate(event_data)
|
|
1035
|
+
case StreamingChatEventType.deep_search_extraction_end:
|
|
1036
|
+
return DeepSearchExtractionEndChatEvent.model_validate(event_data)
|
|
1037
|
+
case StreamingChatEventType.deep_search_extraction:
|
|
1038
|
+
return DeepSearchExtractionChatEvent.model_validate(event_data)
|
|
1039
|
+
case StreamingChatEventType.flow_start:
|
|
1040
|
+
return FlowStartChatEvent.model_validate(event_data)
|
|
1041
|
+
case StreamingChatEventType.flow_end:
|
|
1042
|
+
return FlowEndChatEvent.model_validate(event_data)
|
|
919
1043
|
|
|
920
1044
|
return None
|
|
921
1045
|
|
|
@@ -137,7 +137,7 @@ class GetAppConfigPreviewResponse(BaseSchema):
|
|
|
137
137
|
validation_alias="OpenMessage",
|
|
138
138
|
default="",
|
|
139
139
|
)
|
|
140
|
-
open_query: str = Field(
|
|
140
|
+
open_query: list[str] = Field(
|
|
141
141
|
description="open query",
|
|
142
142
|
validation_alias="OpenQuery",
|
|
143
143
|
default="",
|
|
@@ -399,19 +399,35 @@ class StreamingChatEventType(StrEnum):
|
|
|
399
399
|
think_message_output_start = "think_message_output_start"
|
|
400
400
|
think_message = "think_message"
|
|
401
401
|
think_message_output_end = "think_message_output_end"
|
|
402
|
+
agent_error = "agent_error"
|
|
403
|
+
deep_search_think_start = "deep_search_think_start"
|
|
404
|
+
deep_search_think = "deep_search_think"
|
|
405
|
+
deep_search_think_end = "deep_search_think_end"
|
|
406
|
+
deep_search_query_start = "deep_search_query_start"
|
|
407
|
+
deep_search_query = "deep_search_query"
|
|
408
|
+
deep_search_query_end = "deep_search_query_end"
|
|
409
|
+
deep_search_extraction_start = "deep_search_extraction_start"
|
|
410
|
+
deep_search_extraction = "deep_search_extraction"
|
|
411
|
+
deep_search_extraction_end = "deep_search_extraction_end"
|
|
412
|
+
flow_start = "flow_start"
|
|
413
|
+
flow_end = "flow_end"
|
|
402
414
|
|
|
403
415
|
|
|
404
416
|
class ChatEvent(BaseSchema):
|
|
405
417
|
event: str = Field(
|
|
418
|
+
default="",
|
|
406
419
|
description="event",
|
|
407
420
|
)
|
|
408
421
|
task_id: str = Field(
|
|
422
|
+
default="",
|
|
409
423
|
description="task id",
|
|
410
424
|
)
|
|
411
425
|
id: str = Field(
|
|
426
|
+
default="",
|
|
412
427
|
description="id",
|
|
413
428
|
)
|
|
414
429
|
conversation_id: str = Field(
|
|
430
|
+
default="",
|
|
415
431
|
description="conversation id",
|
|
416
432
|
)
|
|
417
433
|
created_at: int = Field(
|
|
@@ -768,6 +784,43 @@ class ThinkMessageChatEvent(ChatEvent):
|
|
|
768
784
|
|
|
769
785
|
class ThinkMessageOutputEndChatEvent(ChatEvent): ...
|
|
770
786
|
|
|
787
|
+
class AgentErrorChatEvent(ChatEvent):
|
|
788
|
+
error_msg: str = Field(
|
|
789
|
+
description="error message",
|
|
790
|
+
)
|
|
791
|
+
|
|
792
|
+
class DeepSearchThinkStartChatEvent(ChatEvent): ...
|
|
793
|
+
|
|
794
|
+
class DeepSearchThinkChatEvent(ChatEvent):
|
|
795
|
+
content: str = Field(
|
|
796
|
+
description="think content",
|
|
797
|
+
)
|
|
798
|
+
|
|
799
|
+
class DeepSearchThinkEndChatEvent(ChatEvent): ...
|
|
800
|
+
|
|
801
|
+
class DeepSearchQueryStartChatEvent(ChatEvent): ...
|
|
802
|
+
|
|
803
|
+
class DeepSearchQueryChatEvent(ChatEvent):
|
|
804
|
+
content: str = Field(
|
|
805
|
+
description="query content",
|
|
806
|
+
)
|
|
807
|
+
|
|
808
|
+
class DeepSearchQueryEndChatEvent(ChatEvent): ...
|
|
809
|
+
|
|
810
|
+
class DeepSearchExtractionStartChatEvent(ChatEvent): ...
|
|
811
|
+
|
|
812
|
+
class DeepSearchExtractionChatEvent(ChatEvent):
|
|
813
|
+
content: str = Field(
|
|
814
|
+
description="extraction content",
|
|
815
|
+
)
|
|
816
|
+
|
|
817
|
+
class DeepSearchExtractionEndChatEvent(ChatEvent): ...
|
|
818
|
+
|
|
819
|
+
class FlowStartChatEvent(ChatEvent):
|
|
820
|
+
run_id: str
|
|
821
|
+
|
|
822
|
+
class FlowEndChatEvent(ChatEvent):
|
|
823
|
+
run_id: str
|
|
771
824
|
|
|
772
825
|
class ChatAgainRequest(BaseSchema):
|
|
773
826
|
app_key: str = Field(
|
|
@@ -824,6 +877,7 @@ class GetConversationListResponse(BaseSchema):
|
|
|
824
877
|
default=[],
|
|
825
878
|
)
|
|
826
879
|
|
|
880
|
+
|
|
827
881
|
class GetConversationInputsRequest(BaseSchema):
|
|
828
882
|
app_key: str = Field(
|
|
829
883
|
description="app key",
|
|
@@ -2008,6 +2062,7 @@ class TriggerConfig(BaseSchema):
|
|
|
2008
2062
|
default=[],
|
|
2009
2063
|
)
|
|
2010
2064
|
|
|
2065
|
+
|
|
2011
2066
|
class TriggerRunRecord(BaseSchema):
|
|
2012
2067
|
run_id: str = Field(
|
|
2013
2068
|
description="run id",
|
|
@@ -2067,3 +2122,72 @@ class QueryTriggerRunRecordsResponse(BaseSchema):
|
|
|
2067
2122
|
validation_alias="records",
|
|
2068
2123
|
default=[],
|
|
2069
2124
|
)
|
|
2125
|
+
|
|
2126
|
+
|
|
2127
|
+
class GetOpeningConfigOpenRequest(BaseSchema):
|
|
2128
|
+
app_key: str = Field(
|
|
2129
|
+
description="app key",
|
|
2130
|
+
serialization_alias="AppKey",
|
|
2131
|
+
)
|
|
2132
|
+
user_id: str = Field(
|
|
2133
|
+
description="user id",
|
|
2134
|
+
serialization_alias="UserID",
|
|
2135
|
+
)
|
|
2136
|
+
user_type: Optional[str] = Field(
|
|
2137
|
+
description="user type, App:openapi user;IAM:hiagent user;Visitor:web user;Lark:lark user;Wechat: wechat user",
|
|
2138
|
+
serialization_alias="UserType",
|
|
2139
|
+
default=None,
|
|
2140
|
+
)
|
|
2141
|
+
app_conversation_id: str = Field(
|
|
2142
|
+
description="conversation id",
|
|
2143
|
+
serialization_alias="AppConversationID",
|
|
2144
|
+
default="",
|
|
2145
|
+
)
|
|
2146
|
+
|
|
2147
|
+
|
|
2148
|
+
class OpeningConfig(BaseSchema):
|
|
2149
|
+
opening_text: Optional[str] = Field(
|
|
2150
|
+
description="opening text",
|
|
2151
|
+
validation_alias="OpeningText",
|
|
2152
|
+
default="",
|
|
2153
|
+
)
|
|
2154
|
+
opening_questions: list[str] = Field(
|
|
2155
|
+
description="opening questions",
|
|
2156
|
+
validation_alias="OpeningQuestions",
|
|
2157
|
+
default=[],
|
|
2158
|
+
)
|
|
2159
|
+
opening_enabled: bool = Field(
|
|
2160
|
+
description="opening enabled",
|
|
2161
|
+
validation_alias="OpeningEnabled",
|
|
2162
|
+
default=False,
|
|
2163
|
+
)
|
|
2164
|
+
|
|
2165
|
+
|
|
2166
|
+
class GetOpeningConfigOpenResponse(BaseSchema):
|
|
2167
|
+
opening_config: Optional[OpeningConfig] = Field(
|
|
2168
|
+
description="opening config",
|
|
2169
|
+
validation_alias="OpeningConfig",
|
|
2170
|
+
default=None,
|
|
2171
|
+
)
|
|
2172
|
+
|
|
2173
|
+
|
|
2174
|
+
class QueryAppMessageOauthStatusOpenRequest(BaseSchema):
|
|
2175
|
+
app_key: str = Field(
|
|
2176
|
+
description="app key",
|
|
2177
|
+
serialization_alias="AppKey",
|
|
2178
|
+
)
|
|
2179
|
+
user_id: str = Field(
|
|
2180
|
+
description="user id",
|
|
2181
|
+
serialization_alias="UserID",
|
|
2182
|
+
)
|
|
2183
|
+
message_id: str = Field(
|
|
2184
|
+
description="message id",
|
|
2185
|
+
serialization_alias="MessageID",
|
|
2186
|
+
)
|
|
2187
|
+
|
|
2188
|
+
|
|
2189
|
+
class QueryAppMessageOauthStatusResponse(BaseSchema):
|
|
2190
|
+
status: str = Field(
|
|
2191
|
+
description="status: NOT_FOUND, PROCESSING, SUCCEED, STOPPED, FINISHED",
|
|
2192
|
+
validation_alias="Status"
|
|
2193
|
+
)
|
|
@@ -124,6 +124,34 @@ class EvaService(Service):
|
|
|
124
124
|
{},
|
|
125
125
|
{},
|
|
126
126
|
),
|
|
127
|
+
"PauseEvaTask": ApiInfo(
|
|
128
|
+
"POST",
|
|
129
|
+
"/",
|
|
130
|
+
{"Action": "PauseEvaTask", "Version": "2025-02-01"},
|
|
131
|
+
{},
|
|
132
|
+
{},
|
|
133
|
+
),
|
|
134
|
+
"DeleteEvaTask": ApiInfo(
|
|
135
|
+
"POST",
|
|
136
|
+
"/",
|
|
137
|
+
{"Action": "DeleteEvaTask", "Version": "2025-02-01"},
|
|
138
|
+
{},
|
|
139
|
+
{},
|
|
140
|
+
),
|
|
141
|
+
"RetryEvaTask": ApiInfo(
|
|
142
|
+
"POST",
|
|
143
|
+
"/",
|
|
144
|
+
{"Action": "RetryEvaTask", "Version": "2025-02-01"},
|
|
145
|
+
{},
|
|
146
|
+
{},
|
|
147
|
+
),
|
|
148
|
+
"UpdateEvaTask": ApiInfo(
|
|
149
|
+
"POST",
|
|
150
|
+
"/",
|
|
151
|
+
{"Action": "UpdateEvaTask", "Version": "2025-02-01"},
|
|
152
|
+
{},
|
|
153
|
+
{},
|
|
154
|
+
),
|
|
127
155
|
}
|
|
128
156
|
return api_info
|
|
129
157
|
|
|
@@ -217,6 +245,66 @@ class EvaService(Service):
|
|
|
217
245
|
self.__request("GetEvaTask", request.model_dump())
|
|
218
246
|
)
|
|
219
247
|
|
|
248
|
+
def PauseEvaTask(
|
|
249
|
+
self, request: eva_types.PauseEvaTaskRequest
|
|
250
|
+
) -> eva_types.EmptyResponse:
|
|
251
|
+
"""Pause evaluation task
|
|
252
|
+
|
|
253
|
+
Args:
|
|
254
|
+
request: Pause evaluation task request parameters
|
|
255
|
+
|
|
256
|
+
Returns:
|
|
257
|
+
EmptyResponse: Operation response
|
|
258
|
+
"""
|
|
259
|
+
return eva_types.EmptyResponse.model_validate(
|
|
260
|
+
self.__request("PauseEvaTask", request.model_dump())
|
|
261
|
+
)
|
|
262
|
+
|
|
263
|
+
def DeleteEvaTask(
|
|
264
|
+
self, request: eva_types.DeleteEvaTaskRequest
|
|
265
|
+
) -> eva_types.EmptyResponse:
|
|
266
|
+
"""Delete evaluation task
|
|
267
|
+
|
|
268
|
+
Args:
|
|
269
|
+
request: Delete evaluation task request parameters
|
|
270
|
+
|
|
271
|
+
Returns:
|
|
272
|
+
EmptyResponse: Operation response
|
|
273
|
+
"""
|
|
274
|
+
return eva_types.EmptyResponse.model_validate(
|
|
275
|
+
self.__request("DeleteEvaTask", request.model_dump())
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
def RetryEvaTask(
|
|
279
|
+
self, request: eva_types.RetryEvaTaskRequest
|
|
280
|
+
) -> eva_types.EmptyResponse:
|
|
281
|
+
"""Retry evaluation task
|
|
282
|
+
|
|
283
|
+
Args:
|
|
284
|
+
request: Retry evaluation task request parameters
|
|
285
|
+
|
|
286
|
+
Returns:
|
|
287
|
+
EmptyResponse: Operation response
|
|
288
|
+
"""
|
|
289
|
+
return eva_types.EmptyResponse.model_validate(
|
|
290
|
+
self.__request("RetryEvaTask", request.model_dump())
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
def UpdateEvaTask(
|
|
294
|
+
self, request: eva_types.UpdateEvaTaskRequest
|
|
295
|
+
) -> eva_types.EmptyResponse:
|
|
296
|
+
"""Update evaluation task
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
request: Update evaluation task request parameters
|
|
300
|
+
|
|
301
|
+
Returns:
|
|
302
|
+
EmptyResponse: Operation response
|
|
303
|
+
"""
|
|
304
|
+
return eva_types.EmptyResponse.model_validate(
|
|
305
|
+
self.__request("UpdateEvaTask", request.model_dump())
|
|
306
|
+
)
|
|
307
|
+
|
|
220
308
|
def CreateEvaRuleset(
|
|
221
309
|
self, params: eva_types.CreateEvaRulesetRequest
|
|
222
310
|
) -> eva_types.CreateEvaRulesetResponse:
|
|
@@ -305,6 +393,7 @@ class EvaService(Service):
|
|
|
305
393
|
logger.debug(
|
|
306
394
|
f"Error code: {error_info.get('Code', 'N/A')}, Message: {error_info.get('Message', 'N/A')}"
|
|
307
395
|
)
|
|
396
|
+
Exception(f"Error code: {error_info.get('Code', 'N/A')}, Message: {error_info.get('Message', 'N/A')}")
|
|
308
397
|
except Exception:
|
|
309
398
|
pass
|
|
310
399
|
|
|
@@ -42,6 +42,8 @@ class EvaTaskStatus(str, Enum):
|
|
|
42
42
|
FAILED = "Failed" # Failed
|
|
43
43
|
CANCELLING = "Cancelling" # Cancelling
|
|
44
44
|
CANCELLED = "Cancelled" # Task cancelled
|
|
45
|
+
PAUSED = "Paused" # Task paused
|
|
46
|
+
PAUSING = "Pausing" # Task pausing
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
# New CellContent related types
|
|
@@ -57,7 +59,6 @@ class ColumnSchemaType(str, Enum):
|
|
|
57
59
|
"""Schema type"""
|
|
58
60
|
|
|
59
61
|
TEXT = "Text"
|
|
60
|
-
STRING = "String"
|
|
61
62
|
MULTI_CONTENT = "MultiContent"
|
|
62
63
|
|
|
63
64
|
|
|
@@ -922,6 +923,36 @@ class EvaTaskItemTarget(BaseModel):
|
|
|
922
923
|
title="Is Deleted", description="Whether it has been deleted"
|
|
923
924
|
)
|
|
924
925
|
|
|
926
|
+
class EvaTaskStatusItem(BaseModel):
|
|
927
|
+
"""Task status item"""
|
|
928
|
+
StartedAt: Optional[str] = Field(
|
|
929
|
+
default=None, title="Task Start Time", description="Task start time"
|
|
930
|
+
)
|
|
931
|
+
CompletedAt: Optional[str] = Field(
|
|
932
|
+
default=None, title="Task End Time", description="Task end time"
|
|
933
|
+
)
|
|
934
|
+
Duration: int = Field(
|
|
935
|
+
title="Task Execution Duration",
|
|
936
|
+
description="Task execution duration in milliseconds",
|
|
937
|
+
)
|
|
938
|
+
CostTokens: Optional[int] = Field(
|
|
939
|
+
default=None,
|
|
940
|
+
title="Task Completion Token Cost",
|
|
941
|
+
description="Tokens consumed for task completion",
|
|
942
|
+
)
|
|
943
|
+
Progress: Optional[EvaTaskItemProgress] = Field(
|
|
944
|
+
default=None, title="Task Progress", description="Task progress"
|
|
945
|
+
)
|
|
946
|
+
Status: EvaTaskStatus = Field(title="Task Status", description="Task status")
|
|
947
|
+
StatusMessage: Optional[str] = Field(
|
|
948
|
+
default=None,
|
|
949
|
+
title="Task Status Description",
|
|
950
|
+
description="Task status description",
|
|
951
|
+
)
|
|
952
|
+
class EmptyResponse(BaseModel):
|
|
953
|
+
"""EEmpty response"""
|
|
954
|
+
|
|
955
|
+
pass
|
|
925
956
|
|
|
926
957
|
class EvaTaskItem(BaseModel):
|
|
927
958
|
"""Evaluation task details"""
|
|
@@ -948,30 +979,7 @@ class EvaTaskItem(BaseModel):
|
|
|
948
979
|
title="Task Evaluation Targets",
|
|
949
980
|
description="Task evaluation targets",
|
|
950
981
|
)
|
|
951
|
-
|
|
952
|
-
default=None, title="Task Start Time", description="Task start time"
|
|
953
|
-
)
|
|
954
|
-
CompletedAt: Optional[str] = Field(
|
|
955
|
-
default=None, title="Task End Time", description="Task end time"
|
|
956
|
-
)
|
|
957
|
-
Duration: int = Field(
|
|
958
|
-
title="Task Execution Duration",
|
|
959
|
-
description="Task execution duration in milliseconds",
|
|
960
|
-
)
|
|
961
|
-
CostTokens: Optional[int] = Field(
|
|
962
|
-
default=None,
|
|
963
|
-
title="Task Completion Token Cost",
|
|
964
|
-
description="Tokens consumed for task completion",
|
|
965
|
-
)
|
|
966
|
-
Progress: Optional[EvaTaskItemProgress] = Field(
|
|
967
|
-
default=None, title="Task Progress", description="Task progress"
|
|
968
|
-
)
|
|
969
|
-
Status: EvaTaskStatus = Field(title="Task Status", description="Task status")
|
|
970
|
-
StatusMessage: Optional[str] = Field(
|
|
971
|
-
default=None,
|
|
972
|
-
title="Task Status Description",
|
|
973
|
-
description="Task status description",
|
|
974
|
-
)
|
|
982
|
+
ResultTaskStatus: EvaTaskStatusItem = Field(title="Task Result Status", description="Task Result Status")
|
|
975
983
|
CreatedAt: str = Field(title="Created At", description="Creation time")
|
|
976
984
|
UpdatedAt: str = Field(title="Updated At", description="Update time")
|
|
977
985
|
CreatedBy: str = Field(title="Created By", description="Creator")
|
|
@@ -991,6 +999,41 @@ class GetEvaTaskRequest(BaseModel):
|
|
|
991
999
|
# GetEvaTaskResponse 就是 EvaTaskItem
|
|
992
1000
|
GetEvaTaskResponse = EvaTaskItem
|
|
993
1001
|
|
|
1002
|
+
class UpdateEvaTaskRequest(BaseModel):
|
|
1003
|
+
"""Update evaluation task request"""
|
|
1004
|
+
|
|
1005
|
+
WorkspaceID: str = Field(title="Workspace ID", description="Workspace ID")
|
|
1006
|
+
TaskID: str = Field(title="Task ID", description="Task ID")
|
|
1007
|
+
Description: Optional[str] = Field(
|
|
1008
|
+
default=None, title="Task Description", description="Task Description"
|
|
1009
|
+
)
|
|
1010
|
+
Status: Optional[EvaTaskStatus] = Field(
|
|
1011
|
+
default=None, title="Task Status", description="Task Status"
|
|
1012
|
+
)
|
|
1013
|
+
|
|
1014
|
+
class DeleteEvaTaskRequest(BaseModel):
|
|
1015
|
+
"""Delete evaluation task request"""
|
|
1016
|
+
|
|
1017
|
+
WorkspaceID: str = Field(title="Workspace ID", description="Workspace ID")
|
|
1018
|
+
TaskID: str = Field(title="Task ID", description="Task ID")
|
|
1019
|
+
|
|
1020
|
+
class PauseEvaTaskRequest(BaseModel):
|
|
1021
|
+
"""Pause evaluation task request"""
|
|
1022
|
+
|
|
1023
|
+
WorkspaceID: str = Field(title="Workspace ID", description="Workspace ID")
|
|
1024
|
+
TaskID: str = Field(title="Task ID", description="Task ID")
|
|
1025
|
+
|
|
1026
|
+
class RetryOption(BaseModel):
|
|
1027
|
+
"""Retry evaluation task option"""
|
|
1028
|
+
ResultEvaluate: bool = Field(title="Retry Rule Evaluate", description="Retry Rule Evaluate")
|
|
1029
|
+
|
|
1030
|
+
class RetryEvaTaskRequest(BaseModel):
|
|
1031
|
+
"""Retry evaluation task request"""
|
|
1032
|
+
|
|
1033
|
+
WorkspaceID: str = Field(title="Workspace ID", description="Workspace ID")
|
|
1034
|
+
TaskID: str = Field(title="Task ID", description="Task ID")
|
|
1035
|
+
Option: RetryOption = Field(title="Retry Option", description="Retry Option")
|
|
1036
|
+
|
|
994
1037
|
|
|
995
1038
|
class ListColumnsResponse(BaseModel):
|
|
996
1039
|
"""Get evaluation dataset column list response"""
|
|
@@ -170,7 +170,7 @@ class RunWorkflowResponse(BaseSchema):
|
|
|
170
170
|
description="运行状态, success, stopped, failed, interrupted, processing",
|
|
171
171
|
)
|
|
172
172
|
output: str = Field(description="end 节点的输出,是一个 json 字符串")
|
|
173
|
-
cost_ms: int = Field(description="耗时", validation_alias="costMs")
|
|
173
|
+
cost_ms: int = Field(description="耗时", validation_alias="costMs", default=0)
|
|
174
174
|
|
|
175
175
|
|
|
176
176
|
class AsyncRunWorkflowResponse(BaseSchema):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|