Skip to main content

EZ way for api calling

Project description

Chat-to-Excel 智能表格分析工具

通过大模型(如通义千问)自动解析Excel文本数据,支持检索增强生成(RAG)、智能分析、结果保存与Prompt配置本地保存,支持 PDF 知识库构建和智能问答生成。


📌 近期更新

Prompt配置持久化 🔄

  • 自动保存:每次通过info_collect()设置的prompt参数,将自动保存至本地prompt_tomb目录
  • 按名称隔离:通过name参数创建不同实例角色,调取本地相应的prompt参数,实现多组独立配置共存
  • 断点续用:重启程序时自动加载同名实例的历史配置,无需重复输入参数
  • 灵活管理:通过例如info_collect(param='prompt')prompt属性可单独修改特定参数,保留其他配置不变
  • 细粒度控制:支持通过chat(temperature=0.7)单独调整任意参数,保持其他配置不变。支持temperature、top_p、frequency_penalty
  • PDF 知识库构建:通过P_RAGKnowledgeBase将本地pdf文件转为向量数据库
  • 检索增强生成(RAG):内置P_RAGRetriever实现从知识库中找出与用户问题最相关信息的组件
  • 根据知识库的智能问答:chat(kb,top_k)实现外挂知识库的智能问答

🚀 主要功能

1. 大模型交互

  • 支持各类大模型(默认qwen-plus)
  • 多线程并发处理(自动适配CPU核心数)

2. 灵活分析模式

  • 全量分析:处理完整数据集
  • 抽样调试:通过data_sample()抽取小样本测试Prompt效果
  • 单/多字段:支持单列独立分析或多列联合分析

3、检索增强生成(RAG)

  • PDF知识库构建:支持通过PDF文档构建领域知识库
  • 语义检索增强:基于FAISS向量数据库实现毫秒级语义检索
  • 上下文感知:自动将相关文档片段注入大模型上下文
  • 混合推理:结合企业知识库与通用模型能力进行决策

3. 结果输出

  • 自动插入分析结果列
  • 保留原始数据结构
  • 支持xlsx格式导出

使用示例(外挂数据库版,若不需要数据库,则无视第一步和obj.chat方法中的kb参数)

根据本地pdf搭建向量数据库

kb = P_RAGKnowledgeBase(),embedding_model_name默认为all-MiniLM-L6-v2,也可修改 kb.build_from_pdf(r"pdf_file_path") # 替换为你的PDF路径

初始化助理

name = '客服质检-客服处理方法流程' API_KEY = 'your_api_key' BASE_URL = 'your_base_url' obj = P_chat_to_excel(name,API_KEY,BASE_URL)

导入数据

obj.excel_info(path = r'excel_file_path',column=['COLUMN1','COLUMN2']) # 替换为你的excel路径和目标字段名

抽取小样本测试

obj.data_sample(10) # 抽取10条

配置prompt等相关信息

obj.info_collect()

针对样本数据智能问答并本地保存结果至excel

obj.chat(sample = True,temperature=0.2,top_p=0.7,kb=kb,top_k=3)

根据在样本上的输出效果修改prompt

obj.prompt = '''string''' # 替换为prompt的改善版本

若结果尚可,则保留原本配置,跑全量数据

obj.chat(sample = False,temperature=0.2,top_p=0.7,kb=kb,top_k=3)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

p_chat_to_excel-16.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

p_chat_to_excel-16.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file p_chat_to_excel-16.0.tar.gz.

File metadata

  • Download URL: p_chat_to_excel-16.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for p_chat_to_excel-16.0.tar.gz
Algorithm Hash digest
SHA256 69c6cb8d693ee06a28f7835321c853ef8e9817526ce1bce6cc908340449d769f
MD5 120562744cacc7a07d65060aa02183b9
BLAKE2b-256 5347a1a1193b3c771e068e745add399053c95ab6a9e42e115306c5389371ce77

See more details on using hashes here.

File details

Details for the file p_chat_to_excel-16.0-py3-none-any.whl.

File metadata

  • Download URL: p_chat_to_excel-16.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for p_chat_to_excel-16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ad9847f462c8a38e613837ddb25c64c2d7f5801fc981ac3a20018a9578dbfb70
MD5 964f105d1ff05876e5c51d3c9bc04824
BLAKE2b-256 70ec62d4a08e1525d41ff3f5f66221716dac5e1b5e23de0298226508c7ac938d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page