veadk-python 0.2.2__py3-none-any.whl → 0.2.4__py3-none-any.whl
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.
Potentially problematic release.
This version of veadk-python might be problematic. Click here for more details.
- veadk/agent.py +3 -13
- veadk/agents/loop_agent.py +55 -0
- veadk/agents/parallel_agent.py +60 -0
- veadk/agents/sequential_agent.py +55 -0
- veadk/cli/cli_deploy.py +11 -0
- veadk/cli/cli_web.py +27 -0
- veadk/evaluation/adk_evaluator/__init__.py +4 -0
- veadk/evaluation/adk_evaluator/adk_evaluator.py +170 -217
- veadk/evaluation/base_evaluator.py +26 -20
- veadk/evaluation/deepeval_evaluator/deepeval_evaluator.py +8 -5
- veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/app.py +37 -7
- veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/run.sh +2 -6
- veadk/integrations/ve_faas/ve_faas.py +5 -1
- veadk/runner.py +55 -5
- veadk/tracing/base_tracer.py +25 -200
- veadk/tracing/telemetry/{metrics/__init__.py → attributes/attributes.py} +16 -0
- veadk/tracing/telemetry/attributes/extractors/common_attributes_extractors.py +71 -0
- veadk/tracing/telemetry/attributes/extractors/llm_attributes_extractors.py +392 -0
- veadk/tracing/telemetry/attributes/extractors/tool_attributes_extractors.py +70 -0
- veadk/tracing/telemetry/attributes/extractors/types.py +75 -0
- veadk/tracing/telemetry/exporters/apmplus_exporter.py +97 -38
- veadk/tracing/telemetry/exporters/base_exporter.py +10 -10
- veadk/tracing/telemetry/exporters/cozeloop_exporter.py +20 -13
- veadk/tracing/telemetry/exporters/inmemory_exporter.py +46 -32
- veadk/tracing/telemetry/exporters/tls_exporter.py +18 -12
- veadk/tracing/telemetry/opentelemetry_tracer.py +102 -102
- veadk/tracing/telemetry/telemetry.py +149 -0
- veadk/types.py +6 -1
- veadk/utils/misc.py +1 -1
- veadk/utils/patches.py +25 -0
- veadk/version.py +1 -1
- veadk_python-0.2.4.dist-info/METADATA +345 -0
- veadk_python-0.2.4.dist-info/RECORD +122 -0
- veadk/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/__pycache__/agent.cpython-310.pyc +0 -0
- veadk/__pycache__/config.cpython-310.pyc +0 -0
- veadk/__pycache__/consts.cpython-310.pyc +0 -0
- veadk/__pycache__/runner.cpython-310.pyc +0 -0
- veadk/__pycache__/types.cpython-310.pyc +0 -0
- veadk/__pycache__/version.cpython-310.pyc +0 -0
- veadk/a2a/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/a2a/__pycache__/agent_card.cpython-310.pyc +0 -0
- veadk/a2a/__pycache__/remote_ve_agent.cpython-310.pyc +0 -0
- veadk/a2a/__pycache__/ve_a2a_server.cpython-310.pyc +0 -0
- veadk/a2a/__pycache__/ve_agent_executor.cpython-310.pyc +0 -0
- veadk/cli/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/cli/__pycache__/cli.cpython-310.pyc +0 -0
- veadk/cli/__pycache__/cli_deploy.cpython-310.pyc +0 -0
- veadk/cli/__pycache__/cli_init.cpython-310.pyc +0 -0
- veadk/cli/__pycache__/cli_prompt.cpython-310.pyc +0 -0
- veadk/cli/__pycache__/cli_studio.cpython-310.pyc +0 -0
- veadk/cli/__pycache__/cli_web.cpython-310.pyc +0 -0
- veadk/cli/__pycache__/main.cpython-310.pyc +0 -0
- veadk/cloud/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/cloud/__pycache__/cloud_agent_engine.cpython-310.pyc +0 -0
- veadk/cloud/__pycache__/cloud_app.cpython-310.pyc +0 -0
- veadk/database/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/database/__pycache__/base_database.cpython-310.pyc +0 -0
- veadk/database/__pycache__/database_adapter.cpython-310.pyc +0 -0
- veadk/database/__pycache__/database_factory.cpython-310.pyc +0 -0
- veadk/database/__pycache__/local_database.cpython-310.pyc +0 -0
- veadk/database/kv/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/database/relational/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/database/vector/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/database/vector/__pycache__/opensearch_vector_database.cpython-310.pyc +0 -0
- veadk/database/vector/__pycache__/type.cpython-310.pyc +0 -0
- veadk/database/viking/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/evaluation/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/evaluation/__pycache__/base_evaluator.cpython-310.pyc +0 -0
- veadk/evaluation/__pycache__/eval_set_file_loader.cpython-310.pyc +0 -0
- veadk/evaluation/__pycache__/eval_set_recorder.cpython-310.pyc +0 -0
- veadk/evaluation/__pycache__/types.cpython-310.pyc +0 -0
- veadk/evaluation/adk_evaluator/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/evaluation/deepeval_evaluator/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/evaluation/deepeval_evaluator/__pycache__/deepeval_evaluator.cpython-310.pyc +0 -0
- veadk/evaluation/utils/__pycache__/prometheus.cpython-310.pyc +0 -0
- veadk/integrations/ve_apig/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/integrations/ve_apig/__pycache__/apig.cpython-310.pyc +0 -0
- veadk/integrations/ve_apig/__pycache__/ve_apig.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/__pycache__/types.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/__pycache__/ve_faas.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/__pycache__/ve_faas_utils.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/__pycache__/vefaas.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/__pycache__/vefaas_utils.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/__pycache__/agent.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/__pycache__/app.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/__pycache__/studio_app.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/{{ cookiecutter.app_name|replace('-', '_') }}/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/{{ cookiecutter.app_name|replace('-', '_') }}/__pycache__/agent.cpython-310.pyc +0 -0
- veadk/integrations/ve_prompt_pilot/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/integrations/ve_prompt_pilot/__pycache__/agentpilot.cpython-310.pyc +0 -0
- veadk/knowledgebase/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/knowledgebase/__pycache__/knowledgebase.cpython-310.pyc +0 -0
- veadk/knowledgebase/__pycache__/knowledgebase_database_adapter.cpython-310.pyc +0 -0
- veadk/memory/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/memory/__pycache__/long_term_memory.cpython-310.pyc +0 -0
- veadk/memory/__pycache__/memory_database_adapter.cpython-310.pyc +0 -0
- veadk/memory/__pycache__/short_term_memory.cpython-310.pyc +0 -0
- veadk/memory/__pycache__/short_term_memory_processor.cpython-310.pyc +0 -0
- veadk/prompts/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/prompts/__pycache__/agent_default_prompt.cpython-310.pyc +0 -0
- veadk/prompts/__pycache__/prompt_memory_processor.cpython-310.pyc +0 -0
- veadk/prompts/__pycache__/prompt_optimization.cpython-310.pyc +0 -0
- veadk/tools/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/tools/__pycache__/demo_tools.cpython-310.pyc +0 -0
- veadk/tools/__pycache__/load_knowledgebase_tool.cpython-310.pyc +0 -0
- veadk/tools/builtin_tools/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/tools/builtin_tools/__pycache__/lark.cpython-310.pyc +0 -0
- veadk/tools/builtin_tools/__pycache__/vesearch.cpython-310.pyc +0 -0
- veadk/tools/builtin_tools/__pycache__/web_search.cpython-310.pyc +0 -0
- veadk/tools/sandbox/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/tracing/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/tracing/__pycache__/base_tracer.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/__pycache__/opentelemetry_tracer.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/exporters/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/exporters/__pycache__/apiserver_exporter.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/exporters/__pycache__/apmplus_exporter.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/exporters/__pycache__/base_exporter.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/exporters/__pycache__/cozeloop_exporter.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/exporters/__pycache__/inmemory_exporter.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/exporters/__pycache__/tls_exporter.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/metrics/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/metrics/__pycache__/opentelemetry_metrics.cpython-310.pyc +0 -0
- veadk/tracing/telemetry/metrics/opentelemetry_metrics.py +0 -73
- veadk/utils/__pycache__/__init__.cpython-310.pyc +0 -0
- veadk/utils/__pycache__/logger.cpython-310.pyc +0 -0
- veadk/utils/__pycache__/mcp_utils.cpython-310.pyc +0 -0
- veadk/utils/__pycache__/misc.cpython-310.pyc +0 -0
- veadk/utils/__pycache__/patches.cpython-310.pyc +0 -0
- veadk/utils/__pycache__/volcengine_sign.cpython-310.pyc +0 -0
- veadk_python-0.2.2.dist-info/METADATA +0 -144
- veadk_python-0.2.2.dist-info/RECORD +0 -213
- {veadk_python-0.2.2.dist-info → veadk_python-0.2.4.dist-info}/WHEEL +0 -0
- {veadk_python-0.2.2.dist-info → veadk_python-0.2.4.dist-info}/entry_points.txt +0 -0
- {veadk_python-0.2.2.dist-info → veadk_python-0.2.4.dist-info}/licenses/LICENSE +0 -0
- {veadk_python-0.2.2.dist-info → veadk_python-0.2.4.dist-info}/top_level.txt +0 -0
veadk/agent.py
CHANGED
|
@@ -40,6 +40,7 @@ from veadk.prompts.agent_default_prompt import DEFAULT_DESCRIPTION, DEFAULT_INST
|
|
|
40
40
|
from veadk.tracing.base_tracer import BaseTracer
|
|
41
41
|
from veadk.utils.logger import get_logger
|
|
42
42
|
from veadk.utils.patches import patch_asyncio
|
|
43
|
+
from veadk.version import VERSION
|
|
43
44
|
|
|
44
45
|
patch_asyncio()
|
|
45
46
|
logger = get_logger(__name__)
|
|
@@ -60,7 +61,6 @@ class Agent(LlmAgent):
|
|
|
60
61
|
instruction: str = DEFAULT_INSTRUCTION
|
|
61
62
|
"""The instruction for the agent, such as principles of function calling."""
|
|
62
63
|
|
|
63
|
-
# factory
|
|
64
64
|
model_name: str = getenv("MODEL_AGENT_NAME", DEFAULT_MODEL_AGENT_NAME)
|
|
65
65
|
"""The name of the model for agent running."""
|
|
66
66
|
|
|
@@ -113,16 +113,9 @@ class Agent(LlmAgent):
|
|
|
113
113
|
|
|
114
114
|
self.tools.append(load_memory)
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
self.before_model_callback = []
|
|
118
|
-
self.after_model_callback = []
|
|
119
|
-
self.after_tool_callback = []
|
|
120
|
-
for tracer in self.tracers:
|
|
121
|
-
self.before_model_callback.append(tracer.tracer_hook_before_model)
|
|
122
|
-
self.after_model_callback.append(tracer.tracer_hook_after_model)
|
|
123
|
-
self.after_tool_callback.append(tracer.tracer_hook_after_tool)
|
|
116
|
+
logger.info(f"VeADK version: {VERSION}")
|
|
124
117
|
|
|
125
|
-
logger.info(f"
|
|
118
|
+
logger.info(f"{self.__class__.__name__} `{self.name}` init done.")
|
|
126
119
|
logger.debug(
|
|
127
120
|
f"Agent: {self.model_dump(include={'name', 'model_name', 'model_api_base', 'tools', 'serve_url'})}"
|
|
128
121
|
)
|
|
@@ -221,9 +214,6 @@ class Agent(LlmAgent):
|
|
|
221
214
|
session_service=session_service,
|
|
222
215
|
memory_service=self.long_term_memory,
|
|
223
216
|
)
|
|
224
|
-
if getattr(self, "tracers", None):
|
|
225
|
-
for tracer in self.tracers:
|
|
226
|
-
tracer.set_app_name(app_name)
|
|
227
217
|
|
|
228
218
|
logger.info(f"Begin to process prompt {prompt}")
|
|
229
219
|
# run
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from google.adk.agents import LoopAgent as GoogleADKLoopAgent
|
|
18
|
+
from google.adk.agents.base_agent import BaseAgent
|
|
19
|
+
from pydantic import ConfigDict, Field
|
|
20
|
+
from typing_extensions import Any
|
|
21
|
+
|
|
22
|
+
from veadk.prompts.agent_default_prompt import DEFAULT_DESCRIPTION, DEFAULT_INSTRUCTION
|
|
23
|
+
from veadk.tracing.base_tracer import BaseTracer
|
|
24
|
+
from veadk.utils.logger import get_logger
|
|
25
|
+
from veadk.utils.patches import patch_asyncio
|
|
26
|
+
|
|
27
|
+
patch_asyncio()
|
|
28
|
+
logger = get_logger(__name__)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class LoopAgent(GoogleADKLoopAgent):
|
|
32
|
+
"""Loop Agent with Volcengine capabilities."""
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
|
|
35
|
+
"""The model config"""
|
|
36
|
+
|
|
37
|
+
name: str = "veLoopAgent"
|
|
38
|
+
"""The name of the agent."""
|
|
39
|
+
|
|
40
|
+
description: str = DEFAULT_DESCRIPTION
|
|
41
|
+
"""The description of the agent. This will be helpful in A2A scenario."""
|
|
42
|
+
|
|
43
|
+
instruction: str = DEFAULT_INSTRUCTION
|
|
44
|
+
"""The instruction for the agent, such as principles of function calling."""
|
|
45
|
+
|
|
46
|
+
sub_agents: list[BaseAgent] = Field(default_factory=list, exclude=True)
|
|
47
|
+
"""The sub agents provided to agent."""
|
|
48
|
+
|
|
49
|
+
tracers: list[BaseTracer] = []
|
|
50
|
+
"""The tracers provided to agent."""
|
|
51
|
+
|
|
52
|
+
def model_post_init(self, __context: Any) -> None:
|
|
53
|
+
super().model_post_init(None) # for sub_agents init
|
|
54
|
+
|
|
55
|
+
logger.info(f"{self.__class__.__name__} `{self.name}` init done.")
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from google.adk.agents import ParallelAgent as GoogleADKParallelAgent
|
|
18
|
+
from google.adk.agents.base_agent import BaseAgent
|
|
19
|
+
from pydantic import ConfigDict, Field
|
|
20
|
+
from typing_extensions import Any
|
|
21
|
+
|
|
22
|
+
from veadk.prompts.agent_default_prompt import DEFAULT_DESCRIPTION, DEFAULT_INSTRUCTION
|
|
23
|
+
from veadk.tracing.base_tracer import BaseTracer
|
|
24
|
+
from veadk.utils.logger import get_logger
|
|
25
|
+
from veadk.utils.patches import patch_asyncio
|
|
26
|
+
|
|
27
|
+
patch_asyncio()
|
|
28
|
+
logger = get_logger(__name__)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class ParallelAgent(GoogleADKParallelAgent):
|
|
32
|
+
"""LLM-based Agent with Volcengine capabilities."""
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
|
|
35
|
+
"""The model config"""
|
|
36
|
+
|
|
37
|
+
name: str = "veParallelAgent"
|
|
38
|
+
"""The name of the agent."""
|
|
39
|
+
|
|
40
|
+
description: str = DEFAULT_DESCRIPTION
|
|
41
|
+
"""The description of the agent. This will be helpful in A2A scenario."""
|
|
42
|
+
|
|
43
|
+
instruction: str = DEFAULT_INSTRUCTION
|
|
44
|
+
"""The instruction for the agent, such as principles of function calling."""
|
|
45
|
+
|
|
46
|
+
sub_agents: list[BaseAgent] = Field(default_factory=list, exclude=True)
|
|
47
|
+
"""The sub agents provided to agent."""
|
|
48
|
+
|
|
49
|
+
tracers: list[BaseTracer] = []
|
|
50
|
+
"""The tracers provided to agent."""
|
|
51
|
+
|
|
52
|
+
def model_post_init(self, __context: Any) -> None:
|
|
53
|
+
super().model_post_init(None) # for sub_agents init
|
|
54
|
+
|
|
55
|
+
if self.tracers:
|
|
56
|
+
logger.warning(
|
|
57
|
+
"Enable tracing in ParallelAgent may cause OpenTelemetry context error. Issue see https://github.com/google/adk-python/issues/1670"
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
logger.info(f"{self.__class__.__name__} `{self.name}` init done.")
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from google.adk.agents import SequentialAgent as GoogleADKSequentialAgent
|
|
18
|
+
from google.adk.agents.base_agent import BaseAgent
|
|
19
|
+
from pydantic import ConfigDict, Field
|
|
20
|
+
from typing_extensions import Any
|
|
21
|
+
|
|
22
|
+
from veadk.prompts.agent_default_prompt import DEFAULT_DESCRIPTION, DEFAULT_INSTRUCTION
|
|
23
|
+
from veadk.tracing.base_tracer import BaseTracer
|
|
24
|
+
from veadk.utils.logger import get_logger
|
|
25
|
+
from veadk.utils.patches import patch_asyncio
|
|
26
|
+
|
|
27
|
+
patch_asyncio()
|
|
28
|
+
logger = get_logger(__name__)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class SequentialAgent(GoogleADKSequentialAgent):
|
|
32
|
+
"""Sequential Agent with Volcengine capabilities."""
|
|
33
|
+
|
|
34
|
+
model_config = ConfigDict(arbitrary_types_allowed=True, extra="allow")
|
|
35
|
+
"""The model config"""
|
|
36
|
+
|
|
37
|
+
name: str = "veSequentialAgent"
|
|
38
|
+
"""The name of the agent."""
|
|
39
|
+
|
|
40
|
+
description: str = DEFAULT_DESCRIPTION
|
|
41
|
+
"""The description of the agent. This will be helpful in A2A scenario."""
|
|
42
|
+
|
|
43
|
+
instruction: str = DEFAULT_INSTRUCTION
|
|
44
|
+
"""The instruction for the agent, such as principles of function calling."""
|
|
45
|
+
|
|
46
|
+
sub_agents: list[BaseAgent] = Field(default_factory=list, exclude=True)
|
|
47
|
+
"""The sub agents provided to agent."""
|
|
48
|
+
|
|
49
|
+
tracers: list[BaseTracer] = []
|
|
50
|
+
"""The tracers provided to agent."""
|
|
51
|
+
|
|
52
|
+
def model_post_init(self, __context: Any) -> None:
|
|
53
|
+
super().model_post_init(None) # for sub_agents init
|
|
54
|
+
|
|
55
|
+
logger.info(f"{self.__class__.__name__} `{self.name}` init done.")
|
veadk/cli/cli_deploy.py
CHANGED
|
@@ -131,6 +131,17 @@ def deploy(
|
|
|
131
131
|
"No requirements.txt found in the user project, we will use a default one."
|
|
132
132
|
)
|
|
133
133
|
|
|
134
|
+
# avoid upload user's config.yaml
|
|
135
|
+
if (user_proj_abs_path / "config.yaml").exists():
|
|
136
|
+
logger.warning(
|
|
137
|
+
f"Find a config.yaml in {user_proj_abs_path}/config.yaml, we will not upload it by default."
|
|
138
|
+
)
|
|
139
|
+
shutil.move(agent_dir / "config.yaml", Path(TEMP_PATH) / tmp_dir_name)
|
|
140
|
+
else:
|
|
141
|
+
logger.info(
|
|
142
|
+
"No config.yaml found in the user project. Some environment variables may not be set."
|
|
143
|
+
)
|
|
144
|
+
|
|
134
145
|
# load
|
|
135
146
|
logger.debug(
|
|
136
147
|
f"Load deploy module from {Path(TEMP_PATH) / tmp_dir_name / 'deploy.py'}"
|
veadk/cli/cli_web.py
CHANGED
|
@@ -102,6 +102,32 @@ def _get_memory(
|
|
|
102
102
|
return short_term_memory, long_term_memory
|
|
103
103
|
|
|
104
104
|
|
|
105
|
+
def patch_adkwebserver_disable_openapi():
|
|
106
|
+
"""
|
|
107
|
+
Monkey patch AdkWebServer.get_fast_api to remove openapi.json route.
|
|
108
|
+
"""
|
|
109
|
+
import google.adk.cli.adk_web_server
|
|
110
|
+
from fastapi.routing import APIRoute
|
|
111
|
+
from starlette.routing import Route
|
|
112
|
+
|
|
113
|
+
original_get_fast_api = google.adk.cli.adk_web_server.AdkWebServer.get_fast_api_app
|
|
114
|
+
|
|
115
|
+
def wrapped_get_fast_api(self, *args, **kwargs):
|
|
116
|
+
app = original_get_fast_api(self, *args, **kwargs)
|
|
117
|
+
|
|
118
|
+
paths = ["/openapi.json", "/docs", "/redoc"]
|
|
119
|
+
new_routes = []
|
|
120
|
+
for route in app.router.routes:
|
|
121
|
+
if isinstance(route, (APIRoute, Route)) and route.path in paths:
|
|
122
|
+
continue
|
|
123
|
+
new_routes.append(route)
|
|
124
|
+
app.router.routes = new_routes
|
|
125
|
+
|
|
126
|
+
return app
|
|
127
|
+
|
|
128
|
+
google.adk.cli.adk_web_server.AdkWebServer.get_fast_api_app = wrapped_get_fast_api
|
|
129
|
+
|
|
130
|
+
|
|
105
131
|
@click.command()
|
|
106
132
|
@click.option("--host", default="127.0.0.1", help="Host to run the web server on")
|
|
107
133
|
def web(host: str) -> None:
|
|
@@ -145,6 +171,7 @@ def web(host: str) -> None:
|
|
|
145
171
|
import google.adk.cli.adk_web_server
|
|
146
172
|
|
|
147
173
|
google.adk.cli.adk_web_server.AdkWebServer.__init__ = init_for_veadk
|
|
174
|
+
patch_adkwebserver_disable_openapi()
|
|
148
175
|
|
|
149
176
|
import google.adk.cli.cli_tools_click as cli_tools_click
|
|
150
177
|
|
|
@@ -11,3 +11,7 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
from .adk_evaluator import ADKEvaluator
|
|
16
|
+
|
|
17
|
+
__all__ = ["ADKEvaluator"]
|