Skip to content
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

api在langchain的使用问题 #27

Open
wingeva1986 opened this issue Jun 14, 2023 · 2 comments
Open

api在langchain的使用问题 #27

wingeva1986 opened this issue Jun 14, 2023 · 2 comments

Comments

@wingeva1986
Copy link

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

@juzeon
Copy link
Owner

juzeon commented Jun 14, 2023

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

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

@wingeva1986
Copy link
Author

wingeva1986 commented Jun 15, 2023

好像是因为不支持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"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants