-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] completions接口是否支持传入提示词模版id? #5136
Comments
@edwardlzh 你好!我是Dosu,一个可以帮助你解决bug、回答问题和成为贡献者的机器人。在等待人类维护者的期间,我将会尽力帮助你。 The To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
|
To configure and pass parameters in the
Here is an example of how to configure the request using the openai SDK: base_url = "http://127.0.0.1:7861/knowledge_base/local_kb/samples"
data = {
"model": "qwen2-instruct",
"messages": [
{"role": "user", "content": "你好"},
{"role": "assistant", "content": "你好,我是人工智能大模型"},
{"role": "user", "content": "如何高质量提问?"},
],
"stream": True,
"temperature": 0.7,
"extra_body": {
"top_k": 3,
"score_threshold": 2.0,
"return_direct": True,
"prompt_name": "your_prompt_template_name", # Specify your prompt template name here
"mode": "local_kb", # Specify the retrieval mode
"kb_name": "your_knowledge_base_name" # Specify the knowledge base name
},
}
import openai
client = openai.Client(base_url=base_url, api_key="EMPTY")
resp = client.chat.completions.create(**data)
for r in resp:
print(r) This setup allows you to pass the To continue talking to Dosu, mention @dosu. Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other |
没很看懂你需求,可以建议用dify看看能不能满足需求 |
@948024326 你好,是这样的,我之前是通过/chat/kb_chat接口的prompt_name来选择配置文件中的提示词的,所以我理解prompt_name是一个key,来找到prompt_settings.yaml中配置的提示词模版。现在我切到/chat/chat/completions接口了,如果还是使用prompt_name这种功能(根据prompt_name自动匹配prompt_settings.yaml中配置的提示词模版)该怎么做?completions接口好像不支持prompt_name了 |
问题描述 / Problem Description
kb_chat接口支持传入prompt_name,completions接口呢?
复现问题的步骤 / Steps to Reproduce
我正在使用知识库对话(手动传入参数)的方式调用completions接口,在请求根节点下加prompt_name或者在tool_input中加好像都不支持。
预期的结果 / Expected Result
知识库对话(手动传入参数)的方式调用completions接口,支持传prompt_name,并能找到配置文件中的提示词模版
实际结果 / Actual Result
好像不生效
环境信息 / Environment Information
@948024326
The text was updated successfully, but these errors were encountered: