veadk-python 0.2.9__py3-none-any.whl → 0.2.11__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/a2a/remote_ve_agent.py +63 -6
- veadk/agent.py +10 -3
- veadk/agent_builder.py +2 -3
- veadk/auth/veauth/ark_veauth.py +43 -51
- veadk/auth/veauth/utils.py +57 -0
- veadk/cli/cli.py +2 -0
- veadk/cli/cli_kb.py +75 -0
- veadk/cli/cli_web.py +4 -0
- veadk/configs/model_configs.py +3 -3
- veadk/consts.py +9 -0
- veadk/integrations/__init__.py +13 -0
- veadk/integrations/ve_viking_db_memory/__init__.py +13 -0
- veadk/integrations/ve_viking_db_memory/ve_viking_db_memory.py +293 -0
- veadk/knowledgebase/knowledgebase.py +19 -32
- veadk/memory/__init__.py +1 -1
- veadk/memory/long_term_memory.py +40 -68
- veadk/memory/long_term_memory_backends/base_backend.py +4 -2
- veadk/memory/long_term_memory_backends/in_memory_backend.py +8 -6
- veadk/memory/long_term_memory_backends/mem0_backend.py +25 -10
- veadk/memory/long_term_memory_backends/opensearch_backend.py +40 -36
- veadk/memory/long_term_memory_backends/redis_backend.py +59 -46
- veadk/memory/long_term_memory_backends/vikingdb_memory_backend.py +56 -35
- veadk/memory/short_term_memory.py +12 -8
- veadk/memory/short_term_memory_backends/postgresql_backend.py +3 -1
- veadk/runner.py +42 -19
- veadk/tools/builtin_tools/generate_image.py +56 -17
- veadk/tools/builtin_tools/image_edit.py +17 -7
- veadk/tools/builtin_tools/image_generate.py +17 -7
- veadk/tools/builtin_tools/load_knowledgebase.py +97 -0
- veadk/tools/builtin_tools/video_generate.py +11 -9
- veadk/tools/builtin_tools/web_search.py +10 -3
- veadk/tools/load_knowledgebase_tool.py +12 -0
- veadk/tracing/telemetry/attributes/extractors/llm_attributes_extractors.py +5 -0
- veadk/tracing/telemetry/attributes/extractors/tool_attributes_extractors.py +7 -0
- veadk/tracing/telemetry/exporters/apmplus_exporter.py +82 -2
- veadk/tracing/telemetry/exporters/inmemory_exporter.py +8 -2
- veadk/tracing/telemetry/telemetry.py +41 -5
- veadk/utils/misc.py +6 -10
- veadk/utils/volcengine_sign.py +2 -0
- veadk/version.py +1 -1
- {veadk_python-0.2.9.dist-info → veadk_python-0.2.11.dist-info}/METADATA +4 -3
- {veadk_python-0.2.9.dist-info → veadk_python-0.2.11.dist-info}/RECORD +46 -40
- {veadk_python-0.2.9.dist-info → veadk_python-0.2.11.dist-info}/WHEEL +0 -0
- {veadk_python-0.2.9.dist-info → veadk_python-0.2.11.dist-info}/entry_points.txt +0 -0
- {veadk_python-0.2.9.dist-info → veadk_python-0.2.11.dist-info}/licenses/LICENSE +0 -0
- {veadk_python-0.2.9.dist-info → veadk_python-0.2.11.dist-info}/top_level.txt +0 -0
veadk/a2a/remote_ve_agent.py
CHANGED
|
@@ -13,21 +13,78 @@
|
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
15
|
import json
|
|
16
|
+
from typing import Literal
|
|
16
17
|
|
|
18
|
+
import httpx
|
|
17
19
|
import requests
|
|
18
20
|
from a2a.types import AgentCard
|
|
19
21
|
from google.adk.agents.remote_a2a_agent import RemoteA2aAgent
|
|
20
22
|
|
|
23
|
+
from veadk.utils.logger import get_logger
|
|
24
|
+
|
|
25
|
+
logger = get_logger(__name__)
|
|
26
|
+
|
|
21
27
|
AGENT_CARD_WELL_KNOWN_PATH = "/.well-known/agent-card.json"
|
|
22
28
|
|
|
23
29
|
|
|
30
|
+
def _convert_agent_card_dict_to_obj(agent_card_dict: dict) -> AgentCard:
|
|
31
|
+
agent_card_json_str = json.dumps(agent_card_dict, ensure_ascii=False, indent=2)
|
|
32
|
+
agent_card_object = AgentCard.model_validate_json(str(agent_card_json_str))
|
|
33
|
+
return agent_card_object
|
|
34
|
+
|
|
35
|
+
|
|
24
36
|
class RemoteVeAgent(RemoteA2aAgent):
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
37
|
+
"""Connect to remote agent on VeFaaS platform."""
|
|
38
|
+
|
|
39
|
+
def __init__(
|
|
40
|
+
self,
|
|
41
|
+
name: str,
|
|
42
|
+
url: str,
|
|
43
|
+
auth_token: str | None = None,
|
|
44
|
+
auth_method: Literal["header", "querystring"] | None = None,
|
|
45
|
+
):
|
|
46
|
+
if not auth_token:
|
|
47
|
+
agent_card_dict = requests.get(url + AGENT_CARD_WELL_KNOWN_PATH).json()
|
|
48
|
+
# replace agent_card_url with actual host
|
|
49
|
+
agent_card_dict["url"] = url
|
|
50
|
+
|
|
51
|
+
agent_card_object = _convert_agent_card_dict_to_obj(agent_card_dict)
|
|
52
|
+
|
|
53
|
+
logger.debug(f"Agent card of {name}: {agent_card_object}")
|
|
54
|
+
super().__init__(name=name, agent_card=agent_card_object)
|
|
55
|
+
else:
|
|
56
|
+
if auth_method == "header":
|
|
57
|
+
headers = {"Authorization": f"Bearer {auth_token}"}
|
|
58
|
+
agent_card_dict = requests.get(
|
|
59
|
+
url + AGENT_CARD_WELL_KNOWN_PATH, headers=headers
|
|
60
|
+
).json()
|
|
61
|
+
agent_card_dict["url"] = url
|
|
62
|
+
|
|
63
|
+
agent_card_object = _convert_agent_card_dict_to_obj(agent_card_dict)
|
|
64
|
+
httpx_client = httpx.AsyncClient(
|
|
65
|
+
base_url=url, headers=headers, timeout=600
|
|
66
|
+
)
|
|
28
67
|
|
|
29
|
-
|
|
68
|
+
logger.debug(f"Agent card of {name}: {agent_card_object}")
|
|
69
|
+
super().__init__(
|
|
70
|
+
name=name, agent_card=agent_card_object, httpx_client=httpx_client
|
|
71
|
+
)
|
|
72
|
+
elif auth_method == "querystring":
|
|
73
|
+
agent_card_dict = requests.get(
|
|
74
|
+
url + AGENT_CARD_WELL_KNOWN_PATH + f"?token={auth_token}"
|
|
75
|
+
).json()
|
|
76
|
+
agent_card_dict["url"] = url
|
|
30
77
|
|
|
31
|
-
|
|
78
|
+
agent_card_object = _convert_agent_card_dict_to_obj(agent_card_dict)
|
|
79
|
+
httpx_client = httpx.AsyncClient(
|
|
80
|
+
base_url=url, params={"token": auth_token}, timeout=600
|
|
81
|
+
)
|
|
32
82
|
|
|
33
|
-
|
|
83
|
+
logger.debug(f"Agent card of {name}: {agent_card_object}")
|
|
84
|
+
super().__init__(
|
|
85
|
+
name=name, agent_card=agent_card_object, httpx_client=httpx_client
|
|
86
|
+
)
|
|
87
|
+
else:
|
|
88
|
+
raise ValueError(
|
|
89
|
+
f"Unsupported auth method {auth_method}, use `header` or `querystring` instead."
|
|
90
|
+
)
|
veadk/agent.py
CHANGED
|
@@ -133,14 +133,21 @@ class Agent(LlmAgent):
|
|
|
133
133
|
)
|
|
134
134
|
|
|
135
135
|
if self.knowledgebase:
|
|
136
|
-
from veadk.tools import
|
|
136
|
+
from veadk.tools.builtin_tools.load_knowledgebase import (
|
|
137
|
+
LoadKnowledgebaseTool,
|
|
138
|
+
)
|
|
137
139
|
|
|
138
|
-
load_knowledgebase_tool
|
|
139
|
-
|
|
140
|
+
load_knowledgebase_tool = LoadKnowledgebaseTool(
|
|
141
|
+
knowledgebase=self.knowledgebase
|
|
142
|
+
)
|
|
143
|
+
self.tools.append(load_knowledgebase_tool)
|
|
140
144
|
|
|
141
145
|
if self.long_term_memory is not None:
|
|
142
146
|
from google.adk.tools import load_memory
|
|
143
147
|
|
|
148
|
+
if not load_memory.custom_metadata:
|
|
149
|
+
load_memory.custom_metadata = {}
|
|
150
|
+
load_memory.custom_metadata["backend"] = self.long_term_memory.backend
|
|
144
151
|
self.tools.append(load_memory)
|
|
145
152
|
|
|
146
153
|
logger.info(f"VeADK version: {VERSION}")
|
veadk/agent_builder.py
CHANGED
|
@@ -52,9 +52,8 @@ class AgentBuilder:
|
|
|
52
52
|
tools = []
|
|
53
53
|
if agent_config.get("tools", []):
|
|
54
54
|
for tool in agent_config["tools"]:
|
|
55
|
-
|
|
56
|
-
func_name =
|
|
57
|
-
|
|
55
|
+
name = tool["name"]
|
|
56
|
+
module_name, func_name = name.rsplit(".", 1)
|
|
58
57
|
module = importlib.import_module(module_name)
|
|
59
58
|
func = getattr(module, func_name)
|
|
60
59
|
|
veadk/auth/veauth/ark_veauth.py
CHANGED
|
@@ -14,64 +14,56 @@
|
|
|
14
14
|
|
|
15
15
|
import os
|
|
16
16
|
|
|
17
|
-
from
|
|
18
|
-
|
|
19
|
-
from veadk.auth.veauth.base_veauth import BaseVeAuth
|
|
17
|
+
from veadk.auth.veauth.utils import get_credential_from_vefaas_iam
|
|
20
18
|
from veadk.utils.logger import get_logger
|
|
21
19
|
from veadk.utils.volcengine_sign import ve_request
|
|
22
20
|
|
|
23
21
|
logger = get_logger(__name__)
|
|
24
22
|
|
|
25
23
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
self,
|
|
29
|
-
access_key: str = os.getenv("VOLCENGINE_ACCESS_KEY", ""),
|
|
30
|
-
secret_key: str = os.getenv("VOLCENGINE_SECRET_KEY", ""),
|
|
31
|
-
) -> None:
|
|
32
|
-
super().__init__(access_key, secret_key)
|
|
24
|
+
def get_ark_token(region: str = "cn-beijing") -> str:
|
|
25
|
+
logger.info("Fetching ARK token...")
|
|
33
26
|
|
|
34
|
-
|
|
27
|
+
access_key = os.getenv("VOLCENGINE_ACCESS_KEY")
|
|
28
|
+
secret_key = os.getenv("VOLCENGINE_SECRET_KEY")
|
|
29
|
+
session_token = ""
|
|
35
30
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
request_body={"ProjectName": "default", "Filter": {}},
|
|
43
|
-
action="ListApiKeys",
|
|
44
|
-
ak=self.access_key,
|
|
45
|
-
sk=self.secret_key,
|
|
46
|
-
service="ark",
|
|
47
|
-
version="2024-01-01",
|
|
48
|
-
region="cn-beijing",
|
|
49
|
-
host="open.volcengineapi.com",
|
|
50
|
-
)
|
|
51
|
-
try:
|
|
52
|
-
first_api_key_id = res["Result"]["Items"][0]["Id"]
|
|
53
|
-
except KeyError:
|
|
54
|
-
raise ValueError(f"Failed to get ARK api key list: {res}")
|
|
31
|
+
if not (access_key and secret_key):
|
|
32
|
+
# try to get from vefaas iam
|
|
33
|
+
cred = get_credential_from_vefaas_iam()
|
|
34
|
+
access_key = cred.access_key_id
|
|
35
|
+
secret_key = cred.secret_access_key
|
|
36
|
+
session_token = cred.session_token
|
|
55
37
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
38
|
+
res = ve_request(
|
|
39
|
+
request_body={"ProjectName": "default", "Filter": {}},
|
|
40
|
+
header={"X-Security-Token": session_token},
|
|
41
|
+
action="ListApiKeys",
|
|
42
|
+
ak=access_key,
|
|
43
|
+
sk=secret_key,
|
|
44
|
+
service="ark",
|
|
45
|
+
version="2024-01-01",
|
|
46
|
+
region=region,
|
|
47
|
+
host="open.volcengineapi.com",
|
|
48
|
+
)
|
|
49
|
+
try:
|
|
50
|
+
first_api_key_id = res["Result"]["Items"][0]["Id"]
|
|
51
|
+
except KeyError:
|
|
52
|
+
raise ValueError(f"Failed to get ARK api key list: {res}")
|
|
71
53
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
54
|
+
# get raw api key
|
|
55
|
+
res = ve_request(
|
|
56
|
+
request_body={"Id": first_api_key_id},
|
|
57
|
+
header={"X-Security-Token": session_token},
|
|
58
|
+
action="GetRawApiKey",
|
|
59
|
+
ak=access_key,
|
|
60
|
+
sk=secret_key,
|
|
61
|
+
service="ark",
|
|
62
|
+
version="2024-01-01",
|
|
63
|
+
region=region,
|
|
64
|
+
host="open.volcengineapi.com",
|
|
65
|
+
)
|
|
66
|
+
try:
|
|
67
|
+
return res["Result"]["ApiKey"]
|
|
68
|
+
except KeyError:
|
|
69
|
+
raise ValueError(f"Failed to get ARK api key: {res}")
|
|
@@ -0,0 +1,57 @@
|
|
|
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 json
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
from pydantic import BaseModel
|
|
19
|
+
|
|
20
|
+
from veadk.consts import VEFAAS_IAM_CRIDENTIAL_PATH
|
|
21
|
+
from veadk.utils.logger import get_logger
|
|
22
|
+
|
|
23
|
+
logger = get_logger(__name__)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class VeIAMCredential(BaseModel):
|
|
27
|
+
access_key_id: str
|
|
28
|
+
secret_access_key: str
|
|
29
|
+
session_token: str
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def get_credential_from_vefaas_iam() -> VeIAMCredential:
|
|
33
|
+
"""Get credential from VeFaaS IAM file"""
|
|
34
|
+
logger.info(
|
|
35
|
+
f"Get Volcegnine access key or secret key from environment variables failed, try to get from VeFaaS IAM file (path={VEFAAS_IAM_CRIDENTIAL_PATH})."
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
path = Path(VEFAAS_IAM_CRIDENTIAL_PATH)
|
|
39
|
+
|
|
40
|
+
if not path.exists():
|
|
41
|
+
logger.error(
|
|
42
|
+
f"Get Volcegnine access key or secret key from environment variables failed, and VeFaaS IAM file (path={VEFAAS_IAM_CRIDENTIAL_PATH}) not exists. Please check your configuration."
|
|
43
|
+
)
|
|
44
|
+
raise FileNotFoundError(
|
|
45
|
+
f"Get Volcegnine access key or secret key from environment variables failed, and VeFaaS IAM file (path={VEFAAS_IAM_CRIDENTIAL_PATH}) not exists. Please check your configuration."
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
with open(VEFAAS_IAM_CRIDENTIAL_PATH, "r") as f:
|
|
49
|
+
cred_dict = json.load(f)
|
|
50
|
+
access_key = cred_dict["access_key_id"]
|
|
51
|
+
secret_key = cred_dict["secret_access_key"]
|
|
52
|
+
session_token = cred_dict["session_token"]
|
|
53
|
+
return VeIAMCredential(
|
|
54
|
+
access_key_id=access_key,
|
|
55
|
+
secret_access_key=secret_key,
|
|
56
|
+
session_token=session_token,
|
|
57
|
+
)
|
veadk/cli/cli.py
CHANGED
|
@@ -18,6 +18,7 @@ import click
|
|
|
18
18
|
from veadk.cli.cli_deploy import deploy
|
|
19
19
|
from veadk.cli.cli_eval import eval
|
|
20
20
|
from veadk.cli.cli_init import init
|
|
21
|
+
from veadk.cli.cli_kb import kb
|
|
21
22
|
from veadk.cli.cli_pipeline import pipeline
|
|
22
23
|
from veadk.cli.cli_prompt import prompt
|
|
23
24
|
from veadk.cli.cli_web import web
|
|
@@ -39,6 +40,7 @@ veadk.add_command(prompt)
|
|
|
39
40
|
veadk.add_command(web)
|
|
40
41
|
veadk.add_command(pipeline)
|
|
41
42
|
veadk.add_command(eval)
|
|
43
|
+
veadk.add_command(kb)
|
|
42
44
|
|
|
43
45
|
if __name__ == "__main__":
|
|
44
46
|
veadk()
|
veadk/cli/cli_kb.py
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
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 pathlib import Path
|
|
16
|
+
from typing import Literal
|
|
17
|
+
|
|
18
|
+
import click
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@click.command()
|
|
22
|
+
@click.option(
|
|
23
|
+
"--backend",
|
|
24
|
+
type=click.Choice(
|
|
25
|
+
["local", "opensearch", "viking", "redis"],
|
|
26
|
+
case_sensitive=False,
|
|
27
|
+
),
|
|
28
|
+
required=True,
|
|
29
|
+
)
|
|
30
|
+
@click.option(
|
|
31
|
+
"--app_name",
|
|
32
|
+
default="",
|
|
33
|
+
help="`app_name` for init your knowledgebase",
|
|
34
|
+
)
|
|
35
|
+
@click.option(
|
|
36
|
+
"--index",
|
|
37
|
+
default="",
|
|
38
|
+
help="Knowledgebase index",
|
|
39
|
+
)
|
|
40
|
+
@click.option(
|
|
41
|
+
"--path",
|
|
42
|
+
required=True,
|
|
43
|
+
help="Knowledge file or directory path",
|
|
44
|
+
)
|
|
45
|
+
def add(
|
|
46
|
+
backend: Literal["local", "opensearch", "viking", "redis"],
|
|
47
|
+
app_name: str,
|
|
48
|
+
index: str,
|
|
49
|
+
path: str,
|
|
50
|
+
):
|
|
51
|
+
"""Add files to knowledgebase"""
|
|
52
|
+
_path = Path(path)
|
|
53
|
+
assert _path.exists(), f"Path {path} not exists. Please check your input."
|
|
54
|
+
|
|
55
|
+
from veadk.knowledgebase import KnowledgeBase
|
|
56
|
+
|
|
57
|
+
knowledgebase = KnowledgeBase(backend=backend, app_name=app_name, index=index)
|
|
58
|
+
|
|
59
|
+
if _path.is_file():
|
|
60
|
+
knowledgebase.add_from_files(files=[path])
|
|
61
|
+
elif _path.is_dir():
|
|
62
|
+
knowledgebase.add_from_directory(directory=path)
|
|
63
|
+
else:
|
|
64
|
+
raise RuntimeError(
|
|
65
|
+
"Unsupported knowledgebase file type, only support a single file and a directory."
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@click.group()
|
|
70
|
+
def kb():
|
|
71
|
+
"""VeADK Knowledgebase management"""
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
kb.add_command(add)
|
veadk/cli/cli_web.py
CHANGED
|
@@ -154,6 +154,7 @@ def web(host: str) -> None:
|
|
|
154
154
|
eval_set_results_manager: Any,
|
|
155
155
|
agents_dir: str,
|
|
156
156
|
extra_plugins: Optional[list[str]] = None,
|
|
157
|
+
**kwargs: Any,
|
|
157
158
|
):
|
|
158
159
|
self.agent_loader = agent_loader
|
|
159
160
|
self.artifact_service = artifact_service
|
|
@@ -166,6 +167,9 @@ def web(host: str) -> None:
|
|
|
166
167
|
self.runner_dict = {}
|
|
167
168
|
self.extra_plugins = extra_plugins or []
|
|
168
169
|
|
|
170
|
+
for key, value in kwargs.items():
|
|
171
|
+
setattr(self, key, value)
|
|
172
|
+
|
|
169
173
|
# parse VeADK memories
|
|
170
174
|
short_term_memory, long_term_memory = _get_memory(module_path=agents_dir)
|
|
171
175
|
self.session_service = short_term_memory.session_service
|
veadk/configs/model_configs.py
CHANGED
|
@@ -17,7 +17,7 @@ from functools import cached_property
|
|
|
17
17
|
|
|
18
18
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
19
19
|
|
|
20
|
-
from veadk.auth.veauth.ark_veauth import
|
|
20
|
+
from veadk.auth.veauth.ark_veauth import get_ark_token
|
|
21
21
|
from veadk.consts import (
|
|
22
22
|
DEFAULT_MODEL_AGENT_API_BASE,
|
|
23
23
|
DEFAULT_MODEL_AGENT_NAME,
|
|
@@ -39,7 +39,7 @@ class ModelConfig(BaseSettings):
|
|
|
39
39
|
|
|
40
40
|
@cached_property
|
|
41
41
|
def api_key(self) -> str:
|
|
42
|
-
return os.getenv("MODEL_AGENT_API_KEY") or
|
|
42
|
+
return os.getenv("MODEL_AGENT_API_KEY") or get_ark_token()
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
class EmbeddingModelConfig(BaseSettings):
|
|
@@ -56,7 +56,7 @@ class EmbeddingModelConfig(BaseSettings):
|
|
|
56
56
|
|
|
57
57
|
@cached_property
|
|
58
58
|
def api_key(self) -> str:
|
|
59
|
-
return os.getenv("MODEL_EMBEDDING_API_KEY") or
|
|
59
|
+
return os.getenv("MODEL_EMBEDDING_API_KEY") or get_ark_token()
|
|
60
60
|
|
|
61
61
|
|
|
62
62
|
class NormalEmbeddingModelConfig(BaseSettings):
|
veadk/consts.py
CHANGED
|
@@ -63,6 +63,15 @@ DEFAULT_TOS_BUCKET_NAME = "ark-tutorial"
|
|
|
63
63
|
DEFAULT_COZELOOP_SPACE_NAME = "VeADK Space"
|
|
64
64
|
|
|
65
65
|
DEFAULT_TEXT_TO_IMAGE_MODEL_NAME = "doubao-seedream-3-0-t2i-250415"
|
|
66
|
+
DEFAULT_TEXT_TO_IMAGE_MODEL_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
|
|
67
|
+
|
|
66
68
|
DEFAULT_IMAGE_EDIT_MODEL_NAME = "doubao-seededit-3-0-i2i-250628"
|
|
69
|
+
DEFAULT_IMAGE_EDIT_MODEL_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
|
|
70
|
+
|
|
67
71
|
DEFAULT_VIDEO_MODEL_NAME = "doubao-seedance-1-0-pro-250528"
|
|
72
|
+
DEFAULT_VIDEO_MODEL_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
|
|
73
|
+
|
|
68
74
|
DEFAULT_IMAGE_GENERATE_MODEL_NAME = "doubao-seedream-4-0-250828"
|
|
75
|
+
DEFAULT_IMAGE_GENERATE_MODEL_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
|
|
76
|
+
|
|
77
|
+
VEFAAS_IAM_CRIDENTIAL_PATH = "/var/run/secrets/iam/credential"
|
|
@@ -0,0 +1,13 @@
|
|
|
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.
|
|
@@ -0,0 +1,13 @@
|
|
|
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.
|