Paramount 项目使用教程
paramount Agent accuracy measurements for LLMs 项目地址: https://gitcode.com/gh_mirrors/pa/paramount
1. 项目介绍
Paramount 是一个用于评估 AI 聊天代理准确性的开源项目。它允许专家代理评估 AI 聊天,从而实现以下功能:
- 质量保证
- 捕获地面真实数据
- 自动化回归测试
Paramount 可以在私有环境中完全离线运行,确保数据的安全性和隐私性。
2. 项目快速启动
安装
首先,使用 pip
安装 Paramount:
pip install paramount
使用示例
以下是一个简单的使用示例,展示了如何使用 Paramount 记录 AI 函数的调用:
from paramount import record
@record()
def my_ai_function(message_history, new_question):
# 输入
new_message = {'role': 'user', 'content': new_question}
updated_history = message_history + [new_message]
# LLM 调用发生在这里
return updated_history # 输出
# 多次运行 my_ai_function() 后,启动 Paramount UI 以评估结果
paramount
配置
为了成功设置 Paramount,您需要在项目根目录中添加一个 paramount.toml
配置文件。该文件将自动生成默认配置,如果它尚不存在。
[record]
enabled = true
function_url = "http://localhost:9000" # 您的 LLM API Flask 应用的 URL
[db]
type = "csv" # 也可以使用 postgres
[db.postgres]
connection_string = ""
[api]
endpoint = "http://localhost" # Paramount UI/API 的 URL 和端口
port = 9001
split_by_id = false # 如果您有多个机器人并希望按 ID 拆分
identifier_colname = ""
[ui]
meta_cols = ['recorded_at']
input_cols = ['args__message_history', 'args__new_question'] # 匹配 my_ai_function() 示例
output_cols = ['1', '2'] # 1 和 2 是示例中 llm_answer 和 llm_references 的索引
chat_list = "output__1" # 匹配输出 updated_history,必须是字典列表以显示聊天格式
chat_list_role_param = "role" # 列表中描述角色的键
chat_list_content_param = "content" # 列表中描述内容的键
3. 应用案例和最佳实践
应用案例
Paramount 可以用于以下场景:
- AI 聊天质量评估:通过记录和评估 AI 聊天,确保其准确性和一致性。
- 自动化回归测试:捕获 AI 聊天的地面真实数据,用于自动化回归测试。
最佳实践
- 配置优化:根据您的具体需求调整
paramount.toml
配置文件,以确保最佳性能和功能。 - 数据安全:在私有环境中运行 Paramount,确保数据的安全性和隐私性。
4. 典型生态项目
Paramount 可以与以下生态项目结合使用:
- Flask:用于构建 LLM API 的 Flask 应用。
- Docker:通过 Dockerfile 容器化 Paramount 服务器,简化部署过程。
- PostgreSQL:作为数据库选项,提供更强大的数据存储和管理功能。
通过结合这些生态项目,您可以构建一个完整的 AI 聊天评估和测试系统。
paramount Agent accuracy measurements for LLMs 项目地址: https://gitcode.com/gh_mirrors/pa/paramount