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.07k stars 1.71k forks source link

[Feature][proxy adapter] This happens when the openai api started by vllm is having a conversation. #1651

Open ArboterJams opened 2 months ago

ArboterJams commented 2 months ago

Search before asking

Description

20240620-191334

在大模型回答中出现<|im_end|><|im_start|>user类似的文字

Use case

想询问一下该如何修改代码可以让大模型回答保持正常

Related issues

No response

Feature Priority

None

Are you willing to submit PR?

Aries-ckt commented 2 months ago

/assign @fangyinc

Kain-90 commented 1 month ago

自己手动尝试新增一行代码

file: dbgpt/model/proxy/llms/chatgpt.py

async def chatgpt_generate_stream(
    model: ProxyModel, tokenizer, params, device, context_len=2048
):
    client: OpenAILLMClient = model.proxy_llm_client
    context = ModelRequestContext(stream=True, user_name=params.get("user_name"))
    request = ModelRequest.build_request(
        client.default_model,
        messages=params["messages"],
        temperature=params.get("temperature"),
        context=context,
        max_new_tokens=params.get("max_new_tokens"),
++      stop="<|im_end|>"
    )
    async for r in client.generate_stream(request):
        yield r
github-actions[bot] commented 1 week ago

This issue has been marked as stale, because it has been over 30 days without any activity.