Skip to main content

AT Chat Mask

AskTable 对话数据脱敏工具 - 从真实对话记录创建演示案例,使用虚拟数据保护客户隐私

PyPI version Python 3.8+ License: MIT

功能特性

  • 📖 自动分析对话文件,提取数据结构和问题
  • 🤖 智能生成中文案例名称(基于表名和内容分析)
  • 🔧 自动生成虚拟 CSV 数据,保护客户隐私
  • 🚀 自动创建 AskTable 的 Datasource、Bot 和 Chat
  • 💬 交互式对话,灵活配置案例参数
  • 🌐 一键发布,快速生成可分享的演示链接

安装

pip install at-chat-mask

快速开始

1. 配置 API Key

创建 .env 文件:

ASKTABLE_API_KEY=your_api_key_here
ASKTABLE_API_BASE=https://api.asktable.com

2. 准备对话文件

将 AskTable 对话导出文件命名为 chat-{编号}.json 格式,例如:

  • chat-001.json
  • chat-002.json

3. 运行工具

at-chat-mask

4. 按提示操作

案例编号 [001]: 001

系统自动查找 chat-001.json 文件并分析内容

📝 自动生成案例名称
✓ 案例名称: 体育成绩数据分析
是否使用此名称? [Y/n]:

系统根据对话内容自动生成中文案例名称,可以确认使用或自定义

确认信息后,系统会自动:

  1. 生成虚拟 CSV 数据(case-001.csv)
  2. 创建 AskTable Datasource
  3. 创建 AskTable Bot(公开分享)
  4. 创建 AskTable Chat

完成后获取分享链接。

对话文件格式

文件必须命名为 chat-{编号}.json,内容为标准的 AskTable Chat 格式:

{
  "items": [
    {
      "role": "human",
      "content": {"text": "展示跳绳最好的前10名学生的详情"}
    },
    {
      "role": "ai",
      "metadata": {
        "tool_response": [{
          "sql": "SELECT ... FROM table_name ...",
          "result": "..."
        }]
      }
    }
  ]
}

API 使用

from at_chat_mask import ChatMaskAgent, CSVGenerator

# 创建 Agent
agent = ChatMaskAgent(
    api_key="your_api_key",
    api_base="https://api.asktable.com"
)

# 运行交互式流程
agent.run()

# 或者单独使用 CSV 生成器
generator = CSVGenerator()
csv_content = generator.generate_csv_from_messages(
    chat_file="chat-001.json",
    output_file="output.csv",
    num_rows=20
)

许可证

MIT License

相关链接

Metadata

Release files for at-chat-mask 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for at-chat-mask 0.3.0
File Size Uploaded
at_chat_mask-0.3.0.tar.gz 32.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for at-chat-mask 0.3.0
File Interpreter ABI Platform
at_chat_mask-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 65.8 kB

Release files / at_chat_mask-0.3.0.tar.gz

Download URL at_chat_mask-0.3.0.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
52108354ea80457b0c055a89e86b2671442620b445d012945a9014b2ca6e41a0
BLAKE2b-256 checksum
How to use checksums
6f68ab9055e892fff8607dab7326b96b6fcf2cd7f85f72c7d02f0191baf3d587
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release files / at_chat_mask-0.3.0-py3-none-any.whl

Download URL at_chat_mask-0.3.0-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41baea30087362080b76a01c7a1f709c3bdd4617dbc552631374bd352326c943
BLAKE2b-256 checksum
How to use checksums
4e3f6f2ebb1d4de604883289e2d259f07df521b9e07290ef7648923cc278def3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.7

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page