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

请问 OAIClient 是哪个Agently 版本可以使用? #151

Open
Uerben opened this issue Aug 21, 2024 · 1 comment
Open

请问 OAIClient 是哪个Agently 版本可以使用? #151

Uerben opened this issue Aug 21, 2024 · 1 comment

Comments

@Uerben
Copy link

Uerben commented Aug 21, 2024

目前我本地安装的版本 Agently==3.0.4
agent = (
Agently.create_agent()
.set_settings("current_model", "OAIClient")
.set_settings("model.OAIClient.auth.api_key", "sk-3f10906a8c054a5a9cf0a7a4abe27e8a")
# 使用DashScope专门适配的API Base URL
.set_settings("model.OAIClient.url", "https://dashscope.aliyuncs.com/compatible-mode/v1")
# 如果需要切换模型,可参考模型清单:https://help.aliyun.com/zh/dashscope/developer-reference/openai-file-interface
.set_settings("model.OAIClient.options.model", "qwen-turbo")
)
result = (
agent
# general: agent应该知道的全局信息,通常被视作system prompt或类似位置的信息
.general("输出规定", "必须使用中文进行输出")
# role: agent自身的角色设定信息
.role({
"姓名": "Agently小助手",
"任务": "使用自己的知识为用户解答常见问题",
})
# user_info: agent需要了解的用户相关的信息
.user_info("和你对话的用户是一个只具有Python编程基础知识的入门初学者")
# abstract: 对于之前对话(尤其是较长对话)的总结信息
.abstract(None)
# chat_history: 按照OpenAI消息列格式的对话记录list
## 支持:
## [{ "role": "system", "content": "" },
## { "role": "assistant", "content": "" },
## { "role": "user", "content": "" }]
## 三种角色
.chat_history([])
# input: 和本次请求相关的输入信息
.input({
"question": "请问Python中协程和线程的关系和区别是什么?",
"reply_style_expect": "请用对编程概念零基础的人能理解的方式进行回复"
})
# info: 为本次请求提供的额外补充信息
.info("协程相关关键词", ["asyncio", "coroutine", "event loop"])
.info("线程相关关键词", ["threads", "queue"])
# instruct: 为本次请求提供的行动指导信息
.instruct([
"请使用{reply_style_expect}的回复风格,回复{question}提出的问题",
])
# output: 对本次请求的输出提出格式和内容的要求
.output({
"reply": ("str", "对{question}的直接回复"),
"next_questions": ([
("str",
"根据{reply}内容,结合{user_info}提供的用户信息," +
"给用户推荐的可以进一步提问的问题"
)], "不少于3个"),
})
# start: 用于开始本次主要交互请求
.start()
)
print(result)

执行后,Exception: [Plugin Manager] Plugin 'OAIClient' is not in the plugins runtime_ctx of module 'request' 异常。

@Maplemx
Copy link
Owner

Maplemx commented Aug 26, 2024 via email

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