poe-openai-proxy icon indicating copy to clipboard operation
poe-openai-proxy copied to clipboard

api在langchain的使用问题

Open wingeva1986 opened this issue 1 year ago • 2 comments

langchain支持openai官方api的调用,但不支持本项目的api,不能执行使用工具的任务,猜测是某些消息参数的问题。大佬如果有时间,麻烦看看。

wingeva1986 avatar Jun 14 '23 13:06 wingeva1986

请提供一下详细的日志和报错信息。

由于poe没法设置具体参数,例如temperature等,所以可能无法达到某些prompt与参数配合才能达到的效果。

juzeon avatar Jun 14 '23 14:06 juzeon

好像是因为不支持stop tokens机制,所以不能正常工作。

https://help.openai.com/en/articles/5072263-how-do-i-use-stop-sequences

要在OpenAI API中使用stop tokens,您可以在API请求中包含stop参数。例如,如果您想要生成一个文本提示,并在模型输出单词 "stop" 时停止生成过程,可以在API请求中包含以下参数:

python
Copy code
import openai

openai.api_key = "your_api_key"

response = openai.Completion.create(
    engine="davinci-codex",
    prompt="请问你今天过得怎么样?",
    max_tokens=50,
    n=1,
    stop=["stop"]
)
在这个例子中,API会在生成的文本中遇到 "stop" 时停止生成。您可以使用多个停止序列,只需将它们添加到stop参数中,例如:stop=["stop", "end", "finish"]

wingeva1986 avatar Jun 15 '23 14:06 wingeva1986