veadk-python 0.2.27__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.
Files changed (218) hide show
  1. veadk/__init__.py +37 -0
  2. veadk/a2a/__init__.py +13 -0
  3. veadk/a2a/agent_card.py +45 -0
  4. veadk/a2a/remote_ve_agent.py +390 -0
  5. veadk/a2a/utils/__init__.py +13 -0
  6. veadk/a2a/utils/agent_to_a2a.py +170 -0
  7. veadk/a2a/ve_a2a_server.py +93 -0
  8. veadk/a2a/ve_agent_executor.py +78 -0
  9. veadk/a2a/ve_middlewares.py +313 -0
  10. veadk/a2a/ve_task_store.py +37 -0
  11. veadk/agent.py +402 -0
  12. veadk/agent_builder.py +93 -0
  13. veadk/agents/loop_agent.py +68 -0
  14. veadk/agents/parallel_agent.py +72 -0
  15. veadk/agents/sequential_agent.py +64 -0
  16. veadk/auth/__init__.py +13 -0
  17. veadk/auth/base_auth.py +22 -0
  18. veadk/auth/ve_credential_service.py +203 -0
  19. veadk/auth/veauth/__init__.py +13 -0
  20. veadk/auth/veauth/apmplus_veauth.py +58 -0
  21. veadk/auth/veauth/ark_veauth.py +75 -0
  22. veadk/auth/veauth/base_veauth.py +50 -0
  23. veadk/auth/veauth/cozeloop_veauth.py +13 -0
  24. veadk/auth/veauth/opensearch_veauth.py +75 -0
  25. veadk/auth/veauth/postgresql_veauth.py +75 -0
  26. veadk/auth/veauth/prompt_pilot_veauth.py +60 -0
  27. veadk/auth/veauth/speech_veauth.py +54 -0
  28. veadk/auth/veauth/utils.py +69 -0
  29. veadk/auth/veauth/vesearch_veauth.py +62 -0
  30. veadk/auth/veauth/viking_mem0_veauth.py +91 -0
  31. veadk/cli/__init__.py +13 -0
  32. veadk/cli/cli.py +58 -0
  33. veadk/cli/cli_clean.py +87 -0
  34. veadk/cli/cli_create.py +163 -0
  35. veadk/cli/cli_deploy.py +233 -0
  36. veadk/cli/cli_eval.py +215 -0
  37. veadk/cli/cli_init.py +214 -0
  38. veadk/cli/cli_kb.py +110 -0
  39. veadk/cli/cli_pipeline.py +285 -0
  40. veadk/cli/cli_prompt.py +86 -0
  41. veadk/cli/cli_update.py +106 -0
  42. veadk/cli/cli_uploadevalset.py +139 -0
  43. veadk/cli/cli_web.py +143 -0
  44. veadk/cloud/__init__.py +13 -0
  45. veadk/cloud/cloud_agent_engine.py +485 -0
  46. veadk/cloud/cloud_app.py +475 -0
  47. veadk/config.py +115 -0
  48. veadk/configs/__init__.py +13 -0
  49. veadk/configs/auth_configs.py +133 -0
  50. veadk/configs/database_configs.py +132 -0
  51. veadk/configs/model_configs.py +78 -0
  52. veadk/configs/tool_configs.py +54 -0
  53. veadk/configs/tracing_configs.py +110 -0
  54. veadk/consts.py +74 -0
  55. veadk/evaluation/__init__.py +17 -0
  56. veadk/evaluation/adk_evaluator/__init__.py +17 -0
  57. veadk/evaluation/adk_evaluator/adk_evaluator.py +302 -0
  58. veadk/evaluation/base_evaluator.py +642 -0
  59. veadk/evaluation/deepeval_evaluator/__init__.py +17 -0
  60. veadk/evaluation/deepeval_evaluator/deepeval_evaluator.py +339 -0
  61. veadk/evaluation/eval_set_file_loader.py +48 -0
  62. veadk/evaluation/eval_set_recorder.py +146 -0
  63. veadk/evaluation/types.py +65 -0
  64. veadk/evaluation/utils/prometheus.py +196 -0
  65. veadk/integrations/__init__.py +13 -0
  66. veadk/integrations/ve_apig/__init__.py +13 -0
  67. veadk/integrations/ve_apig/ve_apig.py +349 -0
  68. veadk/integrations/ve_apig/ve_apig_utils.py +332 -0
  69. veadk/integrations/ve_code_pipeline/__init__.py +13 -0
  70. veadk/integrations/ve_code_pipeline/ve_code_pipeline.py +431 -0
  71. veadk/integrations/ve_cozeloop/__init__.py +13 -0
  72. veadk/integrations/ve_cozeloop/ve_cozeloop.py +96 -0
  73. veadk/integrations/ve_cr/__init__.py +13 -0
  74. veadk/integrations/ve_cr/ve_cr.py +220 -0
  75. veadk/integrations/ve_faas/__init__.py +13 -0
  76. veadk/integrations/ve_faas/template/cookiecutter.json +15 -0
  77. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/__init__.py +13 -0
  78. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/clean.py +23 -0
  79. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/config.yaml.example +6 -0
  80. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/deploy.py +106 -0
  81. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/__init__.py +13 -0
  82. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/agent.py +25 -0
  83. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/app.py +202 -0
  84. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/requirements.txt +3 -0
  85. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/run.sh +49 -0
  86. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/{{ cookiecutter.app_name }}/__init__.py +14 -0
  87. veadk/integrations/ve_faas/template/{{cookiecutter.local_dir_name}}/src/{{ cookiecutter.app_name }}/agent.py +27 -0
  88. veadk/integrations/ve_faas/ve_faas.py +754 -0
  89. veadk/integrations/ve_faas/ve_faas_utils.py +408 -0
  90. veadk/integrations/ve_faas/web_template/cookiecutter.json +20 -0
  91. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/__init__.py +13 -0
  92. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/clean.py +23 -0
  93. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/config.yaml.example +2 -0
  94. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/deploy.py +44 -0
  95. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/Dockerfile +23 -0
  96. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/app.py +123 -0
  97. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/init_db.py +46 -0
  98. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/models.py +36 -0
  99. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/requirements.txt +4 -0
  100. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/run.sh +21 -0
  101. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/static/css/style.css +368 -0
  102. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/static/js/admin.js +0 -0
  103. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/templates/admin/dashboard.html +21 -0
  104. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/templates/admin/edit_post.html +24 -0
  105. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/templates/admin/login.html +21 -0
  106. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/templates/admin/posts.html +53 -0
  107. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/templates/base.html +45 -0
  108. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/templates/index.html +29 -0
  109. veadk/integrations/ve_faas/web_template/{{cookiecutter.local_dir_name}}/src/templates/post.html +14 -0
  110. veadk/integrations/ve_identity/__init__.py +110 -0
  111. veadk/integrations/ve_identity/auth_config.py +261 -0
  112. veadk/integrations/ve_identity/auth_mixins.py +650 -0
  113. veadk/integrations/ve_identity/auth_processor.py +385 -0
  114. veadk/integrations/ve_identity/function_tool.py +158 -0
  115. veadk/integrations/ve_identity/identity_client.py +864 -0
  116. veadk/integrations/ve_identity/mcp_tool.py +181 -0
  117. veadk/integrations/ve_identity/mcp_toolset.py +431 -0
  118. veadk/integrations/ve_identity/models.py +228 -0
  119. veadk/integrations/ve_identity/token_manager.py +188 -0
  120. veadk/integrations/ve_identity/utils.py +151 -0
  121. veadk/integrations/ve_prompt_pilot/__init__.py +13 -0
  122. veadk/integrations/ve_prompt_pilot/ve_prompt_pilot.py +85 -0
  123. veadk/integrations/ve_tls/__init__.py +13 -0
  124. veadk/integrations/ve_tls/utils.py +116 -0
  125. veadk/integrations/ve_tls/ve_tls.py +212 -0
  126. veadk/integrations/ve_tos/ve_tos.py +710 -0
  127. veadk/integrations/ve_viking_db_memory/__init__.py +13 -0
  128. veadk/integrations/ve_viking_db_memory/ve_viking_db_memory.py +308 -0
  129. veadk/knowledgebase/__init__.py +17 -0
  130. veadk/knowledgebase/backends/__init__.py +13 -0
  131. veadk/knowledgebase/backends/base_backend.py +72 -0
  132. veadk/knowledgebase/backends/in_memory_backend.py +91 -0
  133. veadk/knowledgebase/backends/opensearch_backend.py +162 -0
  134. veadk/knowledgebase/backends/redis_backend.py +172 -0
  135. veadk/knowledgebase/backends/utils.py +92 -0
  136. veadk/knowledgebase/backends/vikingdb_knowledge_backend.py +608 -0
  137. veadk/knowledgebase/entry.py +25 -0
  138. veadk/knowledgebase/knowledgebase.py +307 -0
  139. veadk/memory/__init__.py +35 -0
  140. veadk/memory/long_term_memory.py +365 -0
  141. veadk/memory/long_term_memory_backends/__init__.py +13 -0
  142. veadk/memory/long_term_memory_backends/base_backend.py +35 -0
  143. veadk/memory/long_term_memory_backends/in_memory_backend.py +67 -0
  144. veadk/memory/long_term_memory_backends/mem0_backend.py +155 -0
  145. veadk/memory/long_term_memory_backends/opensearch_backend.py +124 -0
  146. veadk/memory/long_term_memory_backends/redis_backend.py +140 -0
  147. veadk/memory/long_term_memory_backends/vikingdb_memory_backend.py +189 -0
  148. veadk/memory/short_term_memory.py +252 -0
  149. veadk/memory/short_term_memory_backends/__init__.py +13 -0
  150. veadk/memory/short_term_memory_backends/base_backend.py +31 -0
  151. veadk/memory/short_term_memory_backends/mysql_backend.py +49 -0
  152. veadk/memory/short_term_memory_backends/postgresql_backend.py +49 -0
  153. veadk/memory/short_term_memory_backends/sqlite_backend.py +55 -0
  154. veadk/memory/short_term_memory_processor.py +100 -0
  155. veadk/processors/__init__.py +26 -0
  156. veadk/processors/base_run_processor.py +120 -0
  157. veadk/prompts/__init__.py +13 -0
  158. veadk/prompts/agent_default_prompt.py +30 -0
  159. veadk/prompts/prompt_evaluator.py +20 -0
  160. veadk/prompts/prompt_memory_processor.py +55 -0
  161. veadk/prompts/prompt_optimization.py +150 -0
  162. veadk/runner.py +732 -0
  163. veadk/tools/__init__.py +13 -0
  164. veadk/tools/builtin_tools/__init__.py +13 -0
  165. veadk/tools/builtin_tools/agent_authorization.py +94 -0
  166. veadk/tools/builtin_tools/generate_image.py +23 -0
  167. veadk/tools/builtin_tools/image_edit.py +300 -0
  168. veadk/tools/builtin_tools/image_generate.py +446 -0
  169. veadk/tools/builtin_tools/lark.py +67 -0
  170. veadk/tools/builtin_tools/las.py +24 -0
  171. veadk/tools/builtin_tools/link_reader.py +66 -0
  172. veadk/tools/builtin_tools/llm_shield.py +381 -0
  173. veadk/tools/builtin_tools/load_knowledgebase.py +97 -0
  174. veadk/tools/builtin_tools/mcp_router.py +29 -0
  175. veadk/tools/builtin_tools/run_code.py +113 -0
  176. veadk/tools/builtin_tools/tts.py +253 -0
  177. veadk/tools/builtin_tools/vesearch.py +49 -0
  178. veadk/tools/builtin_tools/video_generate.py +363 -0
  179. veadk/tools/builtin_tools/web_scraper.py +76 -0
  180. veadk/tools/builtin_tools/web_search.py +83 -0
  181. veadk/tools/demo_tools.py +58 -0
  182. veadk/tools/load_knowledgebase_tool.py +149 -0
  183. veadk/tools/sandbox/__init__.py +13 -0
  184. veadk/tools/sandbox/browser_sandbox.py +37 -0
  185. veadk/tools/sandbox/code_sandbox.py +40 -0
  186. veadk/tools/sandbox/computer_sandbox.py +34 -0
  187. veadk/tracing/__init__.py +13 -0
  188. veadk/tracing/base_tracer.py +58 -0
  189. veadk/tracing/telemetry/__init__.py +13 -0
  190. veadk/tracing/telemetry/attributes/attributes.py +29 -0
  191. veadk/tracing/telemetry/attributes/extractors/common_attributes_extractors.py +180 -0
  192. veadk/tracing/telemetry/attributes/extractors/llm_attributes_extractors.py +858 -0
  193. veadk/tracing/telemetry/attributes/extractors/tool_attributes_extractors.py +152 -0
  194. veadk/tracing/telemetry/attributes/extractors/types.py +164 -0
  195. veadk/tracing/telemetry/exporters/__init__.py +13 -0
  196. veadk/tracing/telemetry/exporters/apmplus_exporter.py +558 -0
  197. veadk/tracing/telemetry/exporters/base_exporter.py +39 -0
  198. veadk/tracing/telemetry/exporters/cozeloop_exporter.py +129 -0
  199. veadk/tracing/telemetry/exporters/inmemory_exporter.py +248 -0
  200. veadk/tracing/telemetry/exporters/tls_exporter.py +139 -0
  201. veadk/tracing/telemetry/opentelemetry_tracer.py +320 -0
  202. veadk/tracing/telemetry/telemetry.py +411 -0
  203. veadk/types.py +47 -0
  204. veadk/utils/__init__.py +13 -0
  205. veadk/utils/audio_manager.py +95 -0
  206. veadk/utils/auth.py +294 -0
  207. veadk/utils/logger.py +59 -0
  208. veadk/utils/mcp_utils.py +44 -0
  209. veadk/utils/misc.py +184 -0
  210. veadk/utils/patches.py +101 -0
  211. veadk/utils/volcengine_sign.py +205 -0
  212. veadk/version.py +15 -0
  213. veadk_python-0.2.27.dist-info/METADATA +373 -0
  214. veadk_python-0.2.27.dist-info/RECORD +218 -0
  215. veadk_python-0.2.27.dist-info/WHEEL +5 -0
  216. veadk_python-0.2.27.dist-info/entry_points.txt +2 -0
  217. veadk_python-0.2.27.dist-info/licenses/LICENSE +201 -0
  218. veadk_python-0.2.27.dist-info/top_level.txt +1 -0
@@ -0,0 +1,133 @@
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 typing import TYPE_CHECKING, Optional, Any
16
+ from pydantic_settings import BaseSettings, SettingsConfigDict
17
+
18
+ if TYPE_CHECKING:
19
+ from veadk.integrations.ve_identity.identity_client import IdentityClient
20
+ else:
21
+ # For runtime, use Any to avoid circular import issues
22
+ IdentityClient = Any
23
+
24
+
25
+ class VeIdentityConfig(BaseSettings):
26
+ """Configuration for VolcEngine Identity Service.
27
+
28
+ This configuration class manages settings for Agent Identity service,
29
+ including region and endpoint information.
30
+
31
+ It also provides a global singleton IdentityClient instance to ensure:
32
+ - Credential caching is shared across the application
33
+ - HTTP connection pooling is reused
34
+ - Consistent configuration throughout the application
35
+
36
+ Attributes:
37
+ region: The VolcEngine region for Identity service.
38
+ endpoint: The endpoint URL for Identity service API.
39
+ If not provided, will be auto-generated based on region.
40
+ """
41
+
42
+ model_config = SettingsConfigDict(env_prefix="VEIDENTITY_")
43
+
44
+ region: str = "cn-beijing"
45
+ """The VolcEngine region for Identity service.
46
+ """
47
+
48
+ endpoint: str = ""
49
+ """The endpoint URL for Identity service API.
50
+
51
+ If not provided, the endpoint will be auto-generated based on the region.
52
+ """
53
+
54
+ role_session_name: str = "veadk_default_assume_role_session"
55
+ """Role session name, used to distinguish different sessions in audit logs.
56
+ """
57
+
58
+ # Global singleton IdentityClient instance
59
+ _identity_client: Optional["IdentityClient"] = None
60
+
61
+ def get_endpoint(self) -> str:
62
+ """Get the endpoint URL for Identity service.
63
+
64
+ Returns the configured endpoint if provided, otherwise generates
65
+ the endpoint based on the region.
66
+
67
+ Returns:
68
+ The endpoint URL for Identity service API.
69
+
70
+ Raises:
71
+ ValueError: If region is not supported.
72
+ """
73
+ if self.endpoint:
74
+ return self.endpoint
75
+
76
+ return f"id.{self.region}.volces.com"
77
+
78
+ def get_identity_client(
79
+ self,
80
+ access_key: Optional[str] = None,
81
+ secret_key: Optional[str] = None,
82
+ session_token: Optional[str] = None,
83
+ ) -> IdentityClient:
84
+ """Get or create the global IdentityClient instance.
85
+
86
+ This method implements a singleton pattern to ensure only one IdentityClient
87
+ instance is created per configuration. This allows:
88
+ - Credential caching to be shared across the application
89
+ - HTTP connection pooling to be reused
90
+ - Consistent configuration throughout the application
91
+
92
+ Args:
93
+ access_key: Optional VolcEngine access key. If not provided, uses env vars.
94
+ secret_key: Optional VolcEngine secret key. If not provided, uses env vars.
95
+ session_token: Optional VolcEngine session token. If not provided, uses env vars.
96
+
97
+ Returns:
98
+ The global IdentityClient instance.
99
+
100
+ Examples:
101
+ ```python
102
+ from veadk.config import settings
103
+
104
+ # Get the global identity client
105
+ identity_client = settings.veidentity.get_identity_client()
106
+
107
+ # Use it to get workload tokens
108
+ token = identity_client.get_workload_access_token(
109
+ workload_name="my_workload",
110
+ user_id="user123"
111
+ )
112
+ ```
113
+ """
114
+ # Lazy initialization: create client only when first requested
115
+ if self._identity_client is None:
116
+ from veadk.integrations.ve_identity import IdentityClient
117
+
118
+ self._identity_client = IdentityClient(
119
+ access_key=access_key,
120
+ secret_key=secret_key,
121
+ session_token=session_token,
122
+ region=self.region,
123
+ )
124
+
125
+ return self._identity_client
126
+
127
+ def reset_identity_client(self) -> None:
128
+ """Reset the global IdentityClient instance.
129
+
130
+ This forces the next call to get_identity_client() to create a new instance.
131
+ Useful for testing or when credentials need to be refreshed.
132
+ """
133
+ self._identity_client = None
@@ -0,0 +1,132 @@
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
+ import os
16
+ from functools import cached_property
17
+
18
+ from pydantic_settings import BaseSettings, SettingsConfigDict
19
+
20
+ from veadk.consts import DEFAULT_TOS_BUCKET_NAME
21
+ from veadk.integrations.ve_tos.ve_tos import VeTOS
22
+
23
+
24
+ class OpensearchConfig(BaseSettings):
25
+ model_config = SettingsConfigDict(env_prefix="DATABASE_OPENSEARCH_")
26
+
27
+ host: str = ""
28
+
29
+ port: int = 9200
30
+
31
+ username: str = ""
32
+
33
+ password: str = ""
34
+
35
+ secret_token: str = ""
36
+
37
+
38
+ class MysqlConfig(BaseSettings):
39
+ model_config = SettingsConfigDict(env_prefix="DATABASE_MYSQL_")
40
+
41
+ host: str = ""
42
+
43
+ user: str = ""
44
+
45
+ password: str = ""
46
+
47
+ database: str = ""
48
+
49
+ charset: str = "utf8"
50
+
51
+ secret_token: str = ""
52
+ """STS token for MySQL auth, not supported yet."""
53
+
54
+
55
+ class PostgreSqlConfig(BaseSettings):
56
+ model_config = SettingsConfigDict(env_prefix="DATABASE_POSTGRESQL_")
57
+
58
+ host: str = ""
59
+
60
+ port: int = 5432
61
+
62
+ user: str = ""
63
+
64
+ password: str = ""
65
+
66
+ database: str = ""
67
+
68
+ secret_token: str = ""
69
+
70
+
71
+ class RedisConfig(BaseSettings):
72
+ model_config = SettingsConfigDict(env_prefix="DATABASE_REDIS_")
73
+
74
+ host: str = ""
75
+
76
+ port: int = 6379
77
+
78
+ username: str | None = None
79
+
80
+ password: str = ""
81
+
82
+ db: int = 0
83
+
84
+ secret_token: str = ""
85
+ """STS token for Redis auth, not supported yet."""
86
+
87
+
88
+ class Mem0Config(BaseSettings):
89
+ model_config = SettingsConfigDict(env_prefix="DATABASE_MEM0_")
90
+
91
+ api_key: str = ""
92
+ """Mem0 API key"""
93
+
94
+ api_key_id: str = ""
95
+
96
+ project_id: str = ""
97
+
98
+ base_url: str = "" # "https://api.mem0.ai/v1"
99
+
100
+
101
+ class VikingKnowledgebaseConfig(BaseSettings):
102
+ model_config = SettingsConfigDict(env_prefix="DATABASE_VIKING_")
103
+
104
+ project: str = "default"
105
+ """User project in Volcengine console web."""
106
+
107
+ region: str = "cn-beijing"
108
+
109
+
110
+ class TOSConfig(BaseSettings):
111
+ model_config = SettingsConfigDict(env_prefix="DATABASE_TOS_")
112
+
113
+ endpoint: str = "tos-cn-beijing.volces.com"
114
+
115
+ region: str = "cn-beijing"
116
+
117
+ @cached_property
118
+ def bucket(self) -> str:
119
+ _bucket = os.getenv("DATABASE_TOS_BUCKET") or DEFAULT_TOS_BUCKET_NAME
120
+
121
+ VeTOS(bucket_name=_bucket).create_bucket()
122
+ return _bucket
123
+
124
+
125
+ class NormalTOSConfig(BaseSettings):
126
+ model_config = SettingsConfigDict(env_prefix="DATABASE_TOS_")
127
+
128
+ endpoint: str = "tos-cn-beijing.volces.com"
129
+
130
+ region: str = "cn-beijing"
131
+
132
+ bucket: str
@@ -0,0 +1,78 @@
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
+ import os
16
+ from functools import cached_property
17
+
18
+ from pydantic_settings import BaseSettings, SettingsConfigDict
19
+
20
+ from veadk.auth.veauth.ark_veauth import get_ark_token
21
+ from veadk.consts import (
22
+ DEFAULT_MODEL_AGENT_API_BASE,
23
+ DEFAULT_MODEL_AGENT_NAME,
24
+ DEFAULT_MODEL_AGENT_PROVIDER,
25
+ )
26
+
27
+
28
+ class ModelConfig(BaseSettings):
29
+ model_config = SettingsConfigDict(env_prefix="MODEL_AGENT_")
30
+
31
+ name: str = DEFAULT_MODEL_AGENT_NAME
32
+ """Model name for agent reasoning."""
33
+
34
+ provider: str = DEFAULT_MODEL_AGENT_PROVIDER
35
+ """Model provider for LiteLLM initialization."""
36
+
37
+ api_base: str = DEFAULT_MODEL_AGENT_API_BASE
38
+ """The api base of the model for agent reasoning."""
39
+
40
+ @cached_property
41
+ def api_key(self) -> str:
42
+ return os.getenv("MODEL_AGENT_API_KEY") or get_ark_token()
43
+
44
+
45
+ class EmbeddingModelConfig(BaseSettings):
46
+ model_config = SettingsConfigDict(env_prefix="MODEL_EMBEDDING_")
47
+
48
+ name: str = "doubao-embedding-text-240715"
49
+ """Model name for embedding."""
50
+
51
+ dim: int = 2560
52
+ """Embedding dim is different from different models."""
53
+
54
+ api_base: str = "https://ark.cn-beijing.volces.com/api/v3/"
55
+ """The api base of the model for embedding."""
56
+
57
+ @cached_property
58
+ def api_key(self) -> str:
59
+ return (
60
+ os.getenv("MODEL_EMBEDDING_API_KEY")
61
+ or os.getenv("MODEL_AGENT_API_KEY") # try to use agent's model api key
62
+ or get_ark_token()
63
+ )
64
+
65
+
66
+ class NormalEmbeddingModelConfig(BaseSettings):
67
+ model_config = SettingsConfigDict(env_prefix="MODEL_EMBEDDING_")
68
+
69
+ name: str = "doubao-embedding-text-240715"
70
+ """Model name for embedding."""
71
+
72
+ dim: int = 2560
73
+ """Embedding dim is different from different models."""
74
+
75
+ api_base: str = "https://ark.cn-beijing.volces.com/api/v3/"
76
+ """The api base of the model for embedding."""
77
+
78
+ api_key: str
@@ -0,0 +1,54 @@
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
+ import os
16
+ from functools import cached_property
17
+
18
+ from pydantic import BaseModel, Field
19
+ from pydantic_settings import BaseSettings, SettingsConfigDict
20
+
21
+ from veadk.auth.veauth.prompt_pilot_veauth import PromptPilotVeAuth
22
+ from veadk.auth.veauth.vesearch_veauth import VesearchVeAuth
23
+ from veadk.auth.veauth.speech_veauth import get_speech_token
24
+
25
+
26
+ class PromptPilotConfig(BaseModel):
27
+ @cached_property
28
+ def api_key(self) -> str:
29
+ return os.getenv("PROMPT_PILOT_API_KEY") or PromptPilotVeAuth().token
30
+
31
+
32
+ class VeSearchConfig(BaseSettings):
33
+ model_config = SettingsConfigDict(env_prefix="TOOL_VESEARCH_")
34
+
35
+ endpoint: int | str = ""
36
+
37
+ @cached_property
38
+ def api_key(self) -> str:
39
+ return os.getenv("TOOL_VESEARCH_API_KEY") or VesearchVeAuth().token
40
+
41
+
42
+ class VeSpeechConfig(BaseSettings):
43
+ model_config = SettingsConfigDict(env_prefix="TOOL_VESPEECH_")
44
+
45
+ endpoint: int | str = ""
46
+
47
+ @cached_property
48
+ def api_key(self) -> str:
49
+ return os.getenv("TOOL_VESPEECH_API_KEY") or get_speech_token()
50
+
51
+
52
+ class BuiltinToolConfigs(BaseModel):
53
+ vesearch: VeSearchConfig = Field(default_factory=VeSearchConfig)
54
+ vespeech: VeSpeechConfig = Field(default_factory=VeSpeechConfig)
@@ -0,0 +1,110 @@
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
+ import os
16
+ from functools import cached_property
17
+
18
+ from pydantic import Field
19
+ from pydantic_settings import BaseSettings, SettingsConfigDict
20
+
21
+ from veadk.auth.veauth.apmplus_veauth import get_apmplus_token
22
+ from veadk.consts import (
23
+ DEFAULT_APMPLUS_OTEL_EXPORTER_ENDPOINT,
24
+ DEFAULT_APMPLUS_OTEL_EXPORTER_SERVICE_NAME,
25
+ DEFAULT_COZELOOP_OTEL_EXPORTER_ENDPOINT,
26
+ DEFAULT_COZELOOP_SPACE_NAME,
27
+ DEFAULT_TLS_OTEL_EXPORTER_ENDPOINT,
28
+ DEFAULT_TLS_OTEL_EXPORTER_REGION,
29
+ )
30
+ from veadk.integrations.ve_cozeloop.ve_cozeloop import VeCozeloop
31
+ from veadk.integrations.ve_tls.ve_tls import VeTLS
32
+
33
+
34
+ class APMPlusConfig(BaseSettings):
35
+ otel_exporter_endpoint: str = Field(
36
+ default=DEFAULT_APMPLUS_OTEL_EXPORTER_ENDPOINT,
37
+ alias="OBSERVABILITY_OPENTELEMETRY_APMPLUS_ENDPOINT",
38
+ )
39
+
40
+ otel_exporter_service_name: str = Field(
41
+ default=DEFAULT_APMPLUS_OTEL_EXPORTER_SERVICE_NAME,
42
+ alias="OBSERVABILITY_OPENTELEMETRY_APMPLUS_SERVICE_NAME",
43
+ )
44
+
45
+ @cached_property
46
+ def otel_exporter_api_key(self) -> str:
47
+ return (
48
+ os.getenv("OBSERVABILITY_OPENTELEMETRY_APMPLUS_API_KEY")
49
+ or get_apmplus_token()
50
+ )
51
+
52
+
53
+ class CozeloopConfig(BaseSettings):
54
+ otel_exporter_endpoint: str = Field(
55
+ default=DEFAULT_COZELOOP_OTEL_EXPORTER_ENDPOINT,
56
+ alias="OBSERVABILITY_OPENTELEMETRY_COZELOOP_ENDPOINT",
57
+ )
58
+
59
+ otel_exporter_api_key: str = Field(
60
+ default="", alias="OBSERVABILITY_OPENTELEMETRY_COZELOOP_API_KEY"
61
+ )
62
+
63
+ # TODO: auto fetching via AK/SK pair
64
+ # @cached_property
65
+ # def otel_exporter_api_key(self) -> str:
66
+ # pass
67
+
68
+ @cached_property
69
+ def otel_exporter_space_id(self) -> str:
70
+ workspace_id = os.getenv(
71
+ "OBSERVABILITY_OPENTELEMETRY_COZELOOP_SERVICE_NAME", ""
72
+ )
73
+
74
+ if not workspace_id:
75
+ # create a default one
76
+ workspace_id = VeCozeloop(self.otel_exporter_api_key).create_workspace(
77
+ workspace_name=DEFAULT_COZELOOP_SPACE_NAME
78
+ )
79
+
80
+ return workspace_id
81
+
82
+
83
+ class TLSConfig(BaseSettings):
84
+ otel_exporter_endpoint: str = Field(
85
+ default=DEFAULT_TLS_OTEL_EXPORTER_ENDPOINT,
86
+ alias="OBSERVABILITY_OPENTELEMETRY_TLS_ENDPOINT",
87
+ )
88
+
89
+ otel_exporter_region: str = Field(
90
+ default=DEFAULT_TLS_OTEL_EXPORTER_REGION,
91
+ alias="OBSERVABILITY_OPENTELEMETRY_TLS_REGION",
92
+ )
93
+
94
+ @cached_property
95
+ def otel_exporter_topic_id(self) -> str:
96
+ _topic_id = (
97
+ os.getenv("OBSERVABILITY_OPENTELEMETRY_TLS_SERVICE_NAME")
98
+ or VeTLS().get_trace_topic_id()
99
+ )
100
+ return _topic_id
101
+
102
+
103
+ class PrometheusConfig(BaseSettings):
104
+ model_config = SettingsConfigDict(env_prefix="OBSERVABILITY_PROMETHEUS_")
105
+
106
+ pushgateway_url: str = ""
107
+
108
+ pushgateway_username: str = ""
109
+
110
+ pushgateway_password: str = ""
veadk/consts.py ADDED
@@ -0,0 +1,74 @@
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
+ import time
16
+
17
+ from veadk.utils.misc import getenv
18
+ from veadk.version import VERSION
19
+
20
+ DEFAULT_AGENT_NAME = "veAgent"
21
+
22
+ DEFAULT_MODEL_AGENT_NAME = "doubao-seed-1-6-250615"
23
+ DEFAULT_MODEL_AGENT_PROVIDER = "openai"
24
+ DEFAULT_MODEL_AGENT_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
25
+ DEFAULT_MODEL_EXTRA_CONFIG = {
26
+ "extra_headers": {
27
+ "x-is-encrypted": getenv("MODEL_AGENT_ENCRYPTED", "true"),
28
+ "veadk-source": "veadk",
29
+ "veadk-version": VERSION,
30
+ "User-Agent": f"VeADK/{VERSION}",
31
+ "X-Client-Request-Id": f"veadk/{VERSION}",
32
+ },
33
+ "extra_body": {
34
+ "caching": {
35
+ "type": getenv("MODEL_AGENT_CACHING", "enabled"),
36
+ },
37
+ # "thinking": {
38
+ # "type": "disabled"
39
+ # },
40
+ "expire_at": int(time.time()) + 3600, # expire after 1 hour
41
+ },
42
+ }
43
+
44
+ DEFAULT_APMPLUS_OTEL_EXPORTER_ENDPOINT = "http://apmplus-cn-beijing.volces.com:4317"
45
+ DEFAULT_APMPLUS_OTEL_EXPORTER_SERVICE_NAME = "veadk_tracing"
46
+
47
+ DEFAULT_COZELOOP_OTEL_EXPORTER_ENDPOINT = (
48
+ "https://api.coze.cn/v1/loop/opentelemetry/v1/traces"
49
+ )
50
+
51
+ DEFAULT_TLS_OTEL_EXPORTER_ENDPOINT = "https://tls-cn-beijing.volces.com:4318/v1/traces"
52
+ DEFAULT_TLS_OTEL_EXPORTER_REGION = "cn-beijing"
53
+
54
+ DEFAULT_CR_INSTANCE_NAME = "veadk-user-instance"
55
+ DEFAULT_CR_NAMESPACE_NAME = "veadk-user-namespace"
56
+ DEFAULT_CR_REPO_NAME = "veadk-user-repo"
57
+
58
+ DEFAULT_TLS_LOG_PROJECT_NAME = "veadk-logs"
59
+ DEFAULT_TLS_TRACING_INSTANCE_NAME = "veadk-tracing"
60
+
61
+ DEFAULT_TOS_BUCKET_NAME = "ark-tutorial"
62
+
63
+ DEFAULT_COZELOOP_SPACE_NAME = "VeADK Space"
64
+
65
+ DEFAULT_IMAGE_EDIT_MODEL_NAME = "doubao-seededit-3-0-i2i-250628"
66
+ DEFAULT_IMAGE_EDIT_MODEL_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
67
+
68
+ DEFAULT_VIDEO_MODEL_NAME = "doubao-seedance-1-0-pro-250528"
69
+ DEFAULT_VIDEO_MODEL_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
70
+
71
+ DEFAULT_IMAGE_GENERATE_MODEL_NAME = "doubao-seedream-4-0-250828"
72
+ DEFAULT_IMAGE_GENERATE_MODEL_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
73
+
74
+ VEFAAS_IAM_CRIDENTIAL_PATH = "/var/run/secrets/iam/credential"
@@ -0,0 +1,17 @@
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 .eval_set_recorder import EvalSetRecorder
16
+
17
+ __all__ = ["EvalSetRecorder"]
@@ -0,0 +1,17 @@
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 .adk_evaluator import ADKEvaluator
16
+
17
+ __all__ = ["ADKEvaluator"]