360 Secure SkillHub
360 安全技能中心

Chemvision

通过本地 HTTP 服务调用 PubChem、OPSIN 数据源,提供化学名称到分子结构(SMILES、分子式、分子量)、SMILES 解析、GHS 安全信息和反应物数据查询,并可将分子结构图与化学方程式渲染为图片发送给用户;需要 Agent 先启动服务并按步骤调用工具。

panda-lsy
panda-lsy
热度 23.98
最近更新 2026-07-04 13:54:48
分类:知识依赖:代码执行 / 联网浏览搜索 / 读写文件 / 第三方 API应用场景:概念解释 / 研究 / 图像生成

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add chemvision-skill
Metadata
name
chemvision
description
Use this skill when the user asks about chemistry — chemical names, molecular structures (SMILES), molecular formulas, molecular weights, safety information (GHS hazards), or chemical reaction predictions. Supports Chinese and English chemical names, IUPAC names, and common names. Calls PubChem and OPSIN real chemistry databases to reduce LLM hallucinations. Returns molecular structure images and chemical equation renderings.
metadata
{"skill_version":"3.3.0","tags":["AIPC","chemistry","agent","tool-calling","pubchem"]}

ChemVision AI 化学家

化学数据查询服务 — PubChem + OPSIN 真实数据库,分子结构图 + 化学方程式渲染。

When to Use

  • Chemical compound queries (name → structure, SMILES → info)
  • Safety / GHS hazard information
  • Chemical reaction prediction (Agent answers, tools provide data)
  • Molecular structure image rendering

Step 0: Ensure Service Is Running

cd {this_skill_dir} && python manage.py status

Port note: Default port is 8899. If occupied, the service auto-selects the next free port (8900, 8901...). Run python manage.py status to see the actual port. The service uses CHEMVISION_PORT env var (not SERVER_PORT) to avoid conflicts with the Agent host process.

If not running: python manage.py start To stop: python manage.py stop

Step 1: Call Tools

POST to http://localhost:8899/api/tools/call.

name_to_structure

curl -s -X POST http://localhost:8899/api/tools/call \
  -H "Content-Type: application/json" \
  -d '{"tool_name":"name_to_structure","arguments":{"name":"苯甲酸"}}'

Returns SMILES, formula, weight, svg_url.

Important: Tools only accept English names. If the user asks in Chinese, Agent must translate to English first, then call the tool. Example: "苯甲酸" → "benzoic acid".

inspect_smiles

curl -s -X POST http://localhost:8899/api/tools/call \
  -H "Content-Type: application/json" \
  -d '{"tool_name":"inspect_smiles","arguments":{"smiles":"CCO"}}'

safety_info

curl -s -X POST http://localhost:8899/api/tools/call \
  -H "Content-Type: application/json" \
  -d '{"tool_name":"safety_info","arguments":{"query":"benzene"}}'

predict_reaction

Queries chemical data for reactants. Agent should answer the reaction itself.

curl -s -X POST http://localhost:8899/api/tools/call \
  -H "Content-Type: application/json" \
  -d '{"tool_name":"predict_reaction","arguments":{"reactants":"acetic acid + ethanol"}}'

Step 2: Show Results

Molecular structure

  1. Open svg_url from tool result in browser
  2. Screenshot → save file
  3. Send to user: send_file_to_user(file_path="xxx.png", caption="分子结构图")

Chemical equation

After answering a reaction, render the equation:

  1. Open in browser: http://localhost:8899/api/formula/{equation}
  2. Screenshot → save file
  3. Send to user: send_file_to_user(file_path="xxx.png", caption="化学方程式")

Equation format rules:

  • Subscripts automatic: H2O, CH3COOH, Ca(OH)2
  • Superscripts: Fe^{2+}, SO4^{2-}
  • Arrows: -> (one way), <=> (equilibrium)
  • Conditions: [加热], [催化剂] (shown above/below arrow)
  • Example: CH3COOH+C2H5OH<=>[浓硫酸][加热]CH3COOC2H5+H2O

Fallback

If predict_reaction fails, the Agent answers directly using its own chemistry knowledge, then renders the equation via /api/formula/.

Notes

  • Pure data tools — NO LLM dependency, ALL reasoning by Agent
  • All data from PubChem/OPSIN real databases
  • Local only — chemistry data never leaves the machine
  • Swagger UI: http://localhost:8899/docs