Skip to content

Commit b3e0808

Browse files
author
zhengweijun
committed
Update version to 2.1.5.20250724 in pyproject.toml and __version__.py; refactor AgentsError class to inherit from BaseModel; add new tests for correction functionality in test_agents.py.
1 parent 361f779 commit b3e0808

File tree

4 files changed

+51
-13
lines changed

4 files changed

+51
-13
lines changed

pyproject.toml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "zhipuai"
3-
version = "2.1.5.20250716"
3+
version = "2.1.5.20250724"
44
description = "A SDK library for accessing big model apis from ZhipuAI"
55
authors = ["Zhipu AI"]
66
readme = "README.md"
@@ -45,15 +45,13 @@ cli = ["typer"]
4545
# An extra used to be able to add extended testing.
4646
# Please use new-line on formatting to make it easier to add new packages without
4747
# merge-conflicts
48-
extended_testing = [
49-
"langchain",
50-
]
48+
extended_testing = ["langchain"]
5149

5250
[tool.ruff.lint]
5351
select = [
54-
"E", # pycodestyle
55-
"F", # pyflakes
56-
"I", # isort
52+
"E", # pycodestyle
53+
"F", # pyflakes
54+
"I", # isort
5755
"T201", # print
5856
]
5957

@@ -66,9 +64,7 @@ indent-style = "tab"
6664
docstring-code-format = true
6765

6866
[tool.coverage.run]
69-
omit = [
70-
"tests/*",
71-
]
67+
omit = ["tests/*"]
7268

7369
[build-system]
7470
requires = ["poetry-core>=1.0.0", "poetry-plugin-pypi-mirror==0.4.2"]

tests/integration_tests/test_agents.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,46 @@ def test_completions_stream(logging_conf):
5252
print(err)
5353
except zhipuai.core._errors.APIStatusError as err:
5454
print(err)
55+
56+
def test_correction():
57+
client = ZhipuAI() # 请替换为实际API密钥
58+
59+
response = client.agents.invoke(
60+
agent_id="intelligent_education_correction_agent",
61+
messages=[
62+
{
63+
"role": "user",
64+
"content": [
65+
{
66+
"type": "image_url",
67+
"image_url": "https://b0.bdstatic.com/e24937f1f6b9c0ff6895e1012c981515.jpg"
68+
}
69+
]
70+
}
71+
]
72+
)
73+
print(response)
74+
75+
def test_correction_result(image_id,uuids,trace_id):
76+
client = ZhipuAI()
77+
78+
response = client.agents.async_result(
79+
agent_id="intelligent_education_correction_polling",
80+
custom_variables={
81+
"images": [
82+
{
83+
"image_id": image_id,
84+
"uuids": uuids
85+
}
86+
],
87+
"trace_id": trace_id
88+
}
89+
)
90+
print(response)
91+
92+
def main():
93+
test_correction()
94+
# test_correction_result(image_id,uuids,trace_id)
95+
96+
if __name__ == "__main__":
97+
main()

zhipuai/__version__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
2-
__version__ = 'v2.1.0'
1+
__version__ = 'v2.1.5.20250724'

zhipuai/types/agents/agents_completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AgentsCompletionChoice(BaseModel):
1919
finish_reason: str
2020
message: AgentsCompletionMessage
2121

22-
class AgentsError:
22+
class AgentsError(BaseModel):
2323
code: Optional[str] = None
2424
message: Optional[str] = None
2525

0 commit comments

Comments
 (0)