eosphoros-ai / DB-GPT

AI Native Data App Development framework with AWEL(Agentic Workflow Expression Language) and Agents
http://docs.dbgpt.cn
MIT License
13.59k stars 1.82k forks source link

[Bug] [ModuleNotFoundError] No module named 'dbgpt.serve' v0.6.1 #2097

Open Appointat opened 2 days ago

Appointat commented 2 days ago

Search before asking

Operating system information

MacOS(x86)

Python version information

3.10

DB-GPT version

latest release (v0.6.1)

Related scenes

Installation Information

Device information

MacOS M2 pip install dbgpt (version is v0.6.1)

Models information

gpt-4o, want to use tool calling.

What happened

me % python dual_agent.py

Traceback (most recent call last): File "/dual_agent.py", line 4, in from dbgpt.agent import AgentContext, AgentMemory, LLMConfig, UserProxyAgent File "/Applications/miniconda3/envs/_env/lib/python3.10/site-packages/dbgpt/agent/init.py", line 18, in from .core.plan import # noqa: F401, F403 File "/Applications/miniconda3/envs/****_env/lib/python3.10/site-packages/dbgpt/agent/core/plan/init.py", line 3, in from .awel.agent_operator import ( # noqa: F401 File "/Applications/miniconda3/envs/_env/lib/python3.10/site-packages/dbgpt/agent/core/plan/awel/agent_operator.py", line 25, in from dbgpt.serve.prompt.api.endpoints import get_service ModuleNotFoundError: No module named 'dbgpt.serve'

What you expected to happen

...

How to reproduce

import asyncio
import os

from dbgpt.agent import AgentContext, AgentMemory, LLMConfig, UserProxyAgent
from dbgpt.agent.expand.tool_assistant_agent import ToolAssistantAgent
from dbgpt.agent.resource import ToolPack, tool
from dbgpt.model.proxy.llms.chatgpt import OpenAILLMClient
from pydantic import BaseModel, Field

class ArgsSchema(BaseModel):
    a: int = Field(description="The first number.")
    b: int = Field(description="The second number.")

@tool(args_schema=ArgsSchema)
def two_sum(a: int, b: int) -> int:
    """Add two numbers and return the sum."""
    return a + b

tools = ToolPack([two_sum])

async def main():
    llm_client = OpenAILLMClient(
        model_alias="gpt-4o",
        api_base=os.getenv("OPENAI_API_BASE"),
        api_key=os.getenv("OPENAI_API_KEY"),
    )

    context: AgentContext = AgentContext(
        conv_id="test123", language="en", temperature=0.5, max_new_tokens=2048
    )
    agent_memory = AgentMemory()

    user_proxy = await UserProxyAgent().bind(agent_memory).bind(context).build()

    tool_man = (
        await ToolAssistantAgent()
        .bind(context)
        .bind(LLMConfig(llm_client=llm_client))
        .bind(agent_memory)
        .bind(tools)
        .build()
    )

    await user_proxy.initiate_chat(
        recipient=tool_man,
        reviewer=user_proxy,
        message="Calculate the product of 10 and 99",
    )

    await user_proxy.initiate_chat(
        recipient=tool_man,
        reviewer=user_proxy,
        message="Count the number of files in /tmp",
    )

    print("Done!")

if __name__ == "__main__":
    asyncio.run(main())

Additional context

No module named 'dbgpt.serve'

image

Are you willing to submit PR?

Aries-ckt commented 2 days ago

it looks like from dbgpt.serve.prompt.api.endpoints import get_service problem. we will fix that soon. /assign @yhjun1026 please take a look. or downgrade your dbgpt sdk try

pip install dbgpt==0.5.10