Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion tests/cli/test_cli_harness_open_source_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_harness_dockerfile_uses_accelerated_source_with_official_fallback() ->
in cli_harness._DOCKERFILE
)
assert "https://github.com/volcengine/veadk-python.git" in cli_harness._DOCKERFILE
assert '"./src[harness]"' in cli_harness._DOCKERFILE
assert '"./src[database,extensions,harness]"' in cli_harness._DOCKERFILE
old_package_path = "packages/" + "agentkit" + "-harness-python"
assert old_package_path not in cli_harness._DOCKERFILE

Expand Down
3 changes: 2 additions & 1 deletion tests/cli/test_studio_deploy_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ def _record_serverless_role(*args: object, **kwargs: object) -> None:
assert str(captured["requirements"]).startswith(
"./pydantic-2.12.5-py3-none-any.whl\n"
)
assert "veadk-python[database]\n" in str(captured["requirements"])
assert captured["serverless_role"] == {
"args": ("byteplus-ak", "byteplus-sk"),
"kwargs": {"session_token": "", "provider": "byteplus"},
Expand Down Expand Up @@ -1769,5 +1770,5 @@ def read(self) -> bytes:
)
assert captured["requirements"] == (
(expected_prefix or expected_common_requirements)
+ "./veadk_python-test-py3-none-any.whl\n"
+ "./veadk_python-test-py3-none-any.whl[database]\n"
)
40 changes: 40 additions & 0 deletions tests/memory/long_term_memory_backends/test_mem0_backend.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import builtins
import importlib
import sys

import pytest


def test_mem0_backend_missing_dependency_points_to_database_extra(monkeypatch):
module_name = "veadk.memory.long_term_memory_backends.mem0_backend"
sys.modules.pop(module_name, None)
real_import = builtins.__import__

def fake_import(name, globals=None, locals=None, fromlist=(), level=0):
if name == "mem0":
raise ImportError("No module named mem0")
return real_import(name, globals, locals, fromlist, level)

monkeypatch.setattr(builtins, "__import__", fake_import)
try:
with pytest.raises(ImportError) as exc_info:
importlib.import_module(module_name)
message = str(exc_info.value)
assert "veadk-python[database]" in message
assert "mem0ai>=1.0.0,<2" in message
finally:
sys.modules.pop(module_name, None)
4 changes: 3 additions & 1 deletion veadk/cli/cli_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -7894,7 +7894,9 @@ def frontend_deploy(
# 3) Build the function project (zip): run.sh launches the frontend server on
# the FaaS-assigned port; requirements.txt pulls veadk-python (ships the UI).
requirements = (
f"veadk-python=={veadk_version}\n" if veadk_version else "veadk-python\n"
f"veadk-python[database]=={veadk_version}\n"
if veadk_version
else "veadk-python[database]\n"
)
# 3b) Resolve the serverless APIG gateway: use --gateway-name if given, else
# reuse an existing serverless gateway, creating one only if none exists.
Expand Down
2 changes: 1 addition & 1 deletion veadk/cli/cli_harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
done; \\
test -d src/veadk
RUN uv pip install --system --index-url https://mirrors.aliyun.com/pypi/simple/ \\
"./src[harness]" fastapi "uvicorn[standard]"
"./src[database,extensions,harness]" fastapi "uvicorn[standard]"
EXPOSE 8000
CMD ["python", "-m", "uvicorn", "veadk.cloud.harness_app.app:app", "--host", "0.0.0.0", "--port", "8000"]
"""
Expand Down
7 changes: 3 additions & 4 deletions veadk/cli/studio_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,9 @@ def build_local_studio_requirements(
)

shutil.rmtree(package_dir / "wheel-source", ignore_errors=True)
requirements = "".join(
f"./{name}\n"
for name in (*(path.name for path in dependencies), wheels[0].name)
)
requirement_lines = [f"./{path.name}" for path in dependencies]
requirement_lines.append(f"./{wheels[0].name}[database]")
requirements = "".join(f"{line}\n" for line in requirement_lines)
return requirements


Expand Down
4 changes: 2 additions & 2 deletions veadk/cloud/harness_app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ WORKDIR /app

# `[extensions]` pulls llama-index / redis / opensearch, required when the
# KNOWLEDGEBASE_TYPE or LONG_TERM_MEMORY_TYPE env vars enable those components.
# (Viking / MySQL / PostgreSQL backends are already in the base dependencies.)
# `[database]` pulls optional database SDKs, including mem0ai for mem0 memory.
RUN apt-get update && apt-get install -y --no-install-recommends git && \
pip3 install --no-cache-dir "veadk-python[extensions] @ git+https://github.com/volcengine/veadk-python.git" && \
pip3 install --no-cache-dir "veadk-python[database,extensions] @ git+https://github.com/volcengine/veadk-python.git" && \
apt-get purge -y git && apt-get autoremove -y && \
apt-get clean && rm -rf /var/lib/apt/lists/*

Expand Down
11 changes: 8 additions & 3 deletions veadk/memory/long_term_memory_backends/mem0_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,16 @@
try:
from mem0 import MemoryClient

except ImportError:
except ImportError as e:
logger.error(
"Failed to import mem0 or dotenv. Please install them with 'pip install mem0 '"
"Failed to import mem0. Install mem0 support with "
'`pip install "veadk-python[database]"` or '
'`pip install "mem0ai>=1.0.0,<2"`.'
)
raise ImportError("Required packages not installed: mem0")
raise ImportError(
"LongTermMemory backend 'mem0' requires veadk-python[database] "
"(mem0ai>=1.0.0,<2)."
) from e


class Mem0LTMBackend(BaseLongTermMemoryBackend):
Expand Down
Loading