Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: mypy for all type check #10921

Merged
merged 155 commits into from
Dec 24, 2024
Merged
Changes from 1 commit
Commits
Show all changes
155 commits
Select commit Hold shift + click to select a range
aadd4eb
feat: mypy for all type check
yihong0618 Nov 21, 2024
ab4233a
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 21, 2024
df6a6a4
fix: merge main and 4195 errors left
yihong0618 Nov 21, 2024
3fae64b
fix: tiny fix and make ci happy
yihong0618 Nov 21, 2024
804c778
fix: make lockfile happy
yihong0618 Nov 21, 2024
2cc302d
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 21, 2024
c11b984
fix: wip
yihong0618 Nov 22, 2024
3d3045b
fix: lint
yihong0618 Nov 22, 2024
a14d022
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 22, 2024
2264ea8
fix: wip and less than 4000 errors 3908 now
yihong0618 Nov 22, 2024
f378c5b
fix: all import-untyped done
yihong0618 Nov 22, 2024
34c7a04
fix: wip 3608 left
yihong0618 Nov 22, 2024
234b57e
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 22, 2024
bffe75a
fix: wip 3497 left
yihong0618 Nov 22, 2024
ccad160
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 22, 2024
343794d
chore: poetry lock update
yihong0618 Nov 22, 2024
7f78f36
fix: wip 3372 left
yihong0618 Nov 23, 2024
448069a
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 23, 2024
1404c74
chore: lock file
yihong0618 Nov 23, 2024
0ab4b4a
fix: wip and will change to python3.12
yihong0618 Nov 24, 2024
e65d4f9
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 24, 2024
c245e60
fix: drop conflict
yihong0618 Nov 24, 2024
81e43f8
fix: lock version
yihong0618 Nov 24, 2024
dcf8118
fix: wip
yihong0618 Nov 25, 2024
db3103c
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 25, 2024
4eb9b57
fix: merge main
yihong0618 Nov 25, 2024
30e8810
fix: wip
yihong0618 Nov 26, 2024
da9101b
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 26, 2024
2b59110
fix: wip
yihong0618 Nov 27, 2024
97ea17a
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 27, 2024
1d9a832
fix: Xinference api_key can be None
yihong0618 Nov 27, 2024
eb61d31
fix: lint
yihong0618 Nov 27, 2024
d744934
fix: wip 3145 left
yihong0618 Nov 27, 2024
76b4953
Merge branch 'main' into hy/type_hints_all
yihong0618 Nov 27, 2024
9a20d0f
fix: wip and ignores tools and models
yihong0618 Nov 28, 2024
ec12e73
chore(pyproject.toml): Move mypy configurations to `mypy.ini`
laipz8200 Dec 1, 2024
6d2fa1c
chore(*): Remove variable types
laipz8200 Dec 1, 2024
22b697d
fix(graph_engine): Fix type error under `graph_engine`
laipz8200 Dec 1, 2024
c5ad98c
fix(app_dsl_service): Check if tenant_id is None before create App
laipz8200 Dec 1, 2024
d347b2b
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 2, 2024
ecfc89c
fix: merge
yihong0618 Dec 2, 2024
6485187
fix: update lock
yihong0618 Dec 2, 2024
fff6316
fix: update ruff check
yihong0618 Dec 2, 2024
2613302
fix: still wip
yihong0618 Dec 2, 2024
2a62300
fix: wip
yihong0618 Dec 2, 2024
e20043d
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 2, 2024
de7bbfd
fix: wip
yihong0618 Dec 2, 2024
f6ac94e
fix: wip 1336 left
yihong0618 Dec 2, 2024
6031e44
fix: Dict -> dict
yihong0618 Dec 2, 2024
59bbdfd
fix: feishu and 1256 left
yihong0618 Dec 2, 2024
760ae27
fix: wip
yihong0618 Dec 2, 2024
9172fd0
fix: wip 1180 left
yihong0618 Dec 3, 2024
e5e592b
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 3, 2024
cea8441
fix: wip 1115 left
yihong0618 Dec 4, 2024
6068803
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 4, 2024
922765c
fix: vdb error
yihong0618 Dec 4, 2024
57f041c
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 11, 2024
0870888
fix: wip
yihong0618 Dec 11, 2024
6ee7943
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 11, 2024
4202335
chore
yihong0618 Dec 11, 2024
61a9f8c
fix: wip 1100+ left....
yihong0618 Dec 11, 2024
a713d02
Merge branch 'hy/type_hints_all' of https://github.com/yihong0618/dif…
yihong0618 Dec 12, 2024
6b0665a
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 12, 2024
5c892b3
fix: less than 1000 -> 999 continue to work hope can be done every da…
yihong0618 Dec 12, 2024
3a132b9
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 12, 2024
6114942
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 13, 2024
2ffd2cb
fix: on progress 886 left
yihong0618 Dec 13, 2024
4919612
fix: wip 740 left
yihong0618 Dec 14, 2024
fb9f691
fix: process 695 left
yihong0618 Dec 14, 2024
d234486
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 14, 2024
5dc7e7a
chore: merge main
yihong0618 Dec 14, 2024
98fd95a
fix: less than 500 now
yihong0618 Dec 15, 2024
f86e05f
fix: ruff check
yihong0618 Dec 15, 2024
c6d9b9e
fix: wip less than 400 now
yihong0618 Dec 16, 2024
ef2c985
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 16, 2024
aaa5fce
fix: wip less than 400 errors 393 now
yihong0618 Dec 16, 2024
00b8f03
fix: ruff lint
yihong0618 Dec 16, 2024
4360568
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 17, 2024
ab55b4e
fix: merge
yihong0618 Dec 17, 2024
7e9ea21
fix: lock
yihong0618 Dec 17, 2024
dc98269
fix: wip 340 left
yihong0618 Dec 17, 2024
0a35a99
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 19, 2024
bad2e9b
fix: less than 300 now
yihong0618 Dec 19, 2024
a9bfa05
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 19, 2024
9bc0fa3
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 20, 2024
a9df950
fix: less than 200 now
yihong0618 Dec 20, 2024
2c89106
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 20, 2024
9821a0a
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 20, 2024
6a82272
fix: wip
yihong0618 Dec 20, 2024
e919dc8
fix: error
yihong0618 Dec 20, 2024
5b77eaa
fix
yihong0618 Dec 20, 2024
2b2dfb4
fix: less that 100 now
yihong0618 Dec 21, 2024
6b7062e
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 21, 2024
e025679
fix: merge main
yihong0618 Dec 21, 2024
7f81d6b
Revert "fix: merge"
yihong0618 Dec 21, 2024
2663b82
fix: wip 65 left
yihong0618 Dec 22, 2024
943a0ae
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 22, 2024
b9dfd0f
fix: wip 30 left
yihong0618 Dec 22, 2024
8a388a2
fix: ci import error
yihong0618 Dec 22, 2024
9b10d16
fix: lint
yihong0618 Dec 22, 2024
07dcf80
fix: done and some not sure type add FIXME
yihong0618 Dec 23, 2024
986f71b
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 23, 2024
252d538
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 23, 2024
767df75
fix: it
yihong0618 Dec 23, 2024
112f06b
ci: add mypy tests
yihong0618 Dec 23, 2024
c34002c
ci: add test for mypy
yihong0618 Dec 23, 2024
b08694d
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 23, 2024
93cc22d
fix: mypy version
yihong0618 Dec 23, 2024
36a6d12
Merge branch 'hy/type_hints_all' of https://github.com/yihong0618/dif…
yihong0618 Dec 23, 2024
95fb46c
fix: lock
yihong0618 Dec 23, 2024
057d2d1
fix: must in api files
yihong0618 Dec 23, 2024
aa4a7a6
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 23, 2024
bbb5c1b
fix: yml...
yihong0618 Dec 23, 2024
515b26b
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 23, 2024
fd42e3a
fix: mypy
yihong0618 Dec 23, 2024
cb9f238
Merge branch 'main' into hy/type_hints_all
yihong0618 Dec 23, 2024
4ca3b03
fix: super lint
yihong0618 Dec 24, 2024
ba1619b
ci: better mypy check
yihong0618 Dec 24, 2024
5256229
fix: remove unnecessary type ignore comments from computed fields
laipz8200 Dec 24, 2024
c12315b
fix: update type hints for computed fields and headers
laipz8200 Dec 24, 2024
0450409
fix: remove unnecessary type ignore comments and improve mypy command
laipz8200 Dec 24, 2024
37379ac
fix: update mypy command to use python module and remove unused pytho…
laipz8200 Dec 24, 2024
98d8c44
fix: improve document syncing logic and handle missing documents
laipz8200 Dec 24, 2024
af2a26e
fix: handle missing documents in retry indexing task and streamline e…
laipz8200 Dec 24, 2024
6686b74
fix: enhance load method with overloads for better type hinting and s…
laipz8200 Dec 24, 2024
1a9d127
fix: refactor create_clusters function to use keyword arguments for c…
laipz8200 Dec 24, 2024
15bdacc
fix: refactor update_clusters function to use named parameters for im…
laipz8200 Dec 24, 2024
49937d4
fix: remove unnecessary type ignore comment for CORS import
laipz8200 Dec 24, 2024
0deae8e
fix: update parser_api_schema return type to Mapping for improved typ…
laipz8200 Dec 24, 2024
a26560d
fix: replace computed_field decorators with property for improved cla…
laipz8200 Dec 24, 2024
1f3177c
fix: remove unnecessary type ignore comment for yaml import
laipz8200 Dec 24, 2024
8e81c22
fix: update max_active_requests to use mapped_column for improved typ…
laipz8200 Dec 24, 2024
168926b
fix: simplify return statement in AppDslService by removing unnecessa…
laipz8200 Dec 24, 2024
923dfc1
fix: streamline count statement in ConversationService for improved r…
laipz8200 Dec 24, 2024
5d5fb07
fix: remove unnecessary type hint in MessageService for improved clarity
laipz8200 Dec 24, 2024
9873f44
fix: remove unnecessary return type hints in ProviderConfiguration an…
laipz8200 Dec 24, 2024
41fac0b
feat: add explore API resources for audio, completion, conversation, …
laipz8200 Dec 24, 2024
b7c91c4
fix: enforce model_instance requirement in agent runners for improved…
laipz8200 Dec 24, 2024
5d3c3a4
fix: enhance content handling in CotCompletionAgentRunner for improve…
laipz8200 Dec 24, 2024
1aaccd7
fix: simplify return statement in get_model_credentials for improved …
laipz8200 Dec 24, 2024
690a8f0
fix: remove unnecessary type casting in FunctionCallAgentRunner for i…
laipz8200 Dec 24, 2024
88b32e9
fix: improve message handling in CotAgentRunner by enforcing type che…
laipz8200 Dec 24, 2024
fa0c4d8
fix: enforce content type validation in CotAgentRunner for improved e…
laipz8200 Dec 24, 2024
e20a2bd
fix: enhance message content handling in AppGeneratorTTSPublisher for…
laipz8200 Dec 24, 2024
0841ec1
fix: streamline conversation variable handling in AdvancedChatAppRunn…
laipz8200 Dec 24, 2024
363ac59
fix: remove unnecessary type ignores in generate_response_converter f…
laipz8200 Dec 24, 2024
edfca45
fix: update type hints to use Mapping and Sequence for improved type …
laipz8200 Dec 24, 2024
14b229d
fix: update inputs type hints to use Mapping for improved type safety
laipz8200 Dec 24, 2024
683118f
fix: update type hints in BaseAppGenerator and WorkflowAppGenerator f…
laipz8200 Dec 24, 2024
46f3a14
fix: improve invoke result handling in AppRunner for better type safe…
laipz8200 Dec 24, 2024
33759d5
fix: update type hints in WorkflowBasedAppRunner and QueueNodeSucceed…
laipz8200 Dec 24, 2024
675f8f6
fix: update type hints in AppGenerateEntity to use Sequence for files…
laipz8200 Dec 24, 2024
bafaa40
fix: update type hints in file_manager to use Mapping for improved ty…
laipz8200 Dec 24, 2024
e0c6963
fix: replace @computed_field with @property for improved clarity and …
laipz8200 Dec 24, 2024
44fe95e
fix: replace @computed_field with @property in MultiModalPromptMessag…
laipz8200 Dec 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: remove unnecessary type casting in FunctionCallAgentRunner for i…
…mproved clarity

Signed-off-by: -LAN- <laipz8200@outlook.com>
  • Loading branch information
laipz8200 committed Dec 24, 2024
commit 690a8f027c7ea8643299cc9c2026f39e6f53ae5c
12 changes: 7 additions & 5 deletions api/core/agent/fc_agent_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import logging
from collections.abc import Generator
from copy import deepcopy
from typing import Any, Optional, Union, cast
from typing import Any, Optional, Union

from core.agent.base_agent_runner import BaseAgentRunner
from core.app.apps.base_app_queue_manager import PublishFrom
Expand Down Expand Up @@ -107,9 +107,9 @@ def increase_usage(final_llm_usage_dict: dict[str, LLMUsage], usage: LLMUsage):

current_llm_usage = None

if self.stream_tool_call:
if self.stream_tool_call and isinstance(chunks, Generator):
is_first_chunk = True
for chunk in cast(Generator[LLMResultChunk, None, None], chunks):
for chunk in chunks:
if is_first_chunk:
self.queue_manager.publish(
QueueAgentThoughtEvent(agent_thought_id=agent_thought.id), PublishFrom.APPLICATION_MANAGER
Expand Down Expand Up @@ -140,8 +140,8 @@ def increase_usage(final_llm_usage_dict: dict[str, LLMUsage], usage: LLMUsage):
current_llm_usage = chunk.delta.usage

yield chunk
else:
result: LLMResult = cast(LLMResult, chunks)
elif not self.stream_tool_call and isinstance(chunks, LLMResult):
result = chunks
# check if there is any tool call
if self.check_blocking_tool_calls(result):
function_call_state = True
Expand Down Expand Up @@ -183,6 +183,8 @@ def increase_usage(final_llm_usage_dict: dict[str, LLMUsage], usage: LLMUsage):
usage=result.usage,
),
)
else:
raise RuntimeError(f"invalid chunks type: {type(chunks)}")

assistant_message = AssistantPromptMessage(content="", tool_calls=[])
if tool_calls:
Expand Down
Loading