[PRISM] Research-pack для ПК: 18 задач, официальные источники, схемы, runner с resume
lint / hygiene (push) Failing after 43s
lint / hygiene (push) Failing after 43s
This commit is contained in:
1 parent
037f1abbb4
commit
05fd1bee6d
7 files changed
+382
No files matched your search
@@ -0,0 +1,84 @@
|
||||
# Prism Research Pack — офлайн/ПК-аудит
|
||||
|
||||
Набор для запуска **после 18:00 на ПК**. Цель: силами LLM собрать полный аудит
|
||||
официальных решений вендоров и практик, затем вернуть данные в Prism.
|
||||
|
||||
## Принцип
|
||||
|
||||
- **L1 только официальный производитель.** Дистрибьюторы/интеграторы — L2, не specs.
|
||||
- Нет цитаты → `null`, не выдумывать.
|
||||
- Один результат = один JSON.
|
||||
- Сначала аудит, потом импорт в каталог — вручную/после проверки.
|
||||
|
||||
## Структура
|
||||
|
||||
```
|
||||
research-pack/
|
||||
README.md
|
||||
tasks.jsonl # 18 задач: 10 вендоров + 8 практик
|
||||
schema-vendor.json # схема vendor audit
|
||||
schema-practice.json # схема practice audit
|
||||
prompt-vendor.md
|
||||
prompt-practice.md
|
||||
run_research.py # запуск на ПК, resume, без зависимостей
|
||||
sources/ # сюда можно положить официальные PDF/HTML (опционально)
|
||||
results/ # сюда пишутся ответы
|
||||
```
|
||||
|
||||
## Запуск
|
||||
|
||||
```bash
|
||||
cd research-pack
|
||||
python run_research.py --tasks tasks.jsonl --out results --limit 1 --dry-run
|
||||
python run_research.py --tasks tasks.jsonl --out results
|
||||
```
|
||||
|
||||
Для Ollama:
|
||||
```bash
|
||||
set LLM_PROVIDER=ollama
|
||||
set LLM_URL=http://127.0.0.1:11434
|
||||
set LLM_MODEL=qwen2.5:7b
|
||||
python run_research.py ...
|
||||
```
|
||||
|
||||
Для OpenAI-совместимого API:
|
||||
```bash
|
||||
set LLM_PROVIDER=openai
|
||||
set LLM_URL=http://127.0.0.1:8000
|
||||
set LLM_MODEL=...
|
||||
set LLM_API_KEY=...
|
||||
python run_research.py ...
|
||||
```
|
||||
|
||||
`run_research.py`:
|
||||
- пропускает уже готовые `results/<id>.json`;
|
||||
- пишет `results/<id>.json` и `results/<id>.log`;
|
||||
- `--limit N` — первые N задач;
|
||||
- `--only vendor-audiocodes` — одна задача;
|
||||
- `--dry-run` — проверить без вызова LLM.
|
||||
|
||||
## Что вернуть на хост
|
||||
|
||||
Скопировать папку `results/` в:
|
||||
```
|
||||
/root/buryan-infra/ops/combine/research-pack/results-pc-YYYYMMDD/
|
||||
```
|
||||
и сообщить. Дальше:
|
||||
1. валидация JSON по схемам;
|
||||
2. сравнение с L1-цитатами;
|
||||
3. только потом — ветки/каталог Prism.
|
||||
|
||||
## Покрытие задач
|
||||
|
||||
Вендоры: Yealink, AudioCodes, Avaya, Poly, Logitech, IVA, Hitrolink, САТЕЛ, ФЛАТ, Информтехника.
|
||||
Практики: Cisco CCW, Yealink Room Designer, Logitech Configurator, Poly, Crestron/Extron,
|
||||
Octopart/SiliconExpert, Akeneo/Pimcore, B2B CPQ.
|
||||
|
||||
## Ограничение
|
||||
|
||||
LLM без веба не сможет «посмотреть» URL. Тогда:
|
||||
- либо LLM с браузером/агентом;
|
||||
- либо положить официальные PDF/HTML в `sources/<id>/`;
|
||||
- либо прогнать вручную по ссылкам и дать тексты.
|
||||
|
||||
Никаких дистрибьюторских даташитов как источника specs.
|
||||
@@ -0,0 +1,15 @@
|
||||
# Prompt: practice audit
|
||||
|
||||
Ты — продуктовый аналитик B2B-инструментов. Разбери официальную практику/
|
||||
конфигуратор/каталог и верни строгий JSON по схеме Prism.
|
||||
|
||||
## Правила
|
||||
|
||||
1. Официальные страницы/документация; не пересказывай случайные статьи.
|
||||
2. Разделяй: механика, таксономия, UX, data model, сильные/слабые стороны.
|
||||
3. Что стоит перенять в Prism — конкретно; что не копировать — тоже.
|
||||
4. Нет факта — `unknowns`, не выдумывай.
|
||||
5. Только JSON, без markdown вокруг.
|
||||
|
||||
Схема: `schema-practice.json`.
|
||||
Задача и ссылки — ниже.
|
||||
@@ -0,0 +1,26 @@
|
||||
# Prompt: vendor audit
|
||||
|
||||
Ты — старший аналитик AV/VCS-рынка. Твоя задача — разобрать **официальные
|
||||
решения производителя** и вернуть строгий JSON по схеме Prism.
|
||||
|
||||
## Жёсткие правила
|
||||
|
||||
1. Используй **только официальный сайт производителя** (L1). Дистрибьюторы,
|
||||
интеграторы, блоги, маркетплейсы — L2, не источник specs.
|
||||
2. Каждый продукт/характеристика — с `source.url` и короткой цитатой `quote`.
|
||||
3. Если данных нет — `null`/пустой массив, **не придумывай**.
|
||||
4. Не смешивай VCS и телефонию: `domain` определяется сценарием, SIP — протокол.
|
||||
5. Не добавляй модели, которых нет на официальном сайте.
|
||||
6. Отвечай **только JSON**, без markdown вокруг.
|
||||
|
||||
## Что извлечь
|
||||
|
||||
- семейства и линейки;
|
||||
- модели: категория, роль, форм-фактор, комната, deployment (native/BYOD);
|
||||
- specs: 4K, zoom, FOV, pickup, mics, протоколы, порты;
|
||||
- аксессуары и kits, ограничения;
|
||||
- совместимость (from → to, условие);
|
||||
- как вендор продаёт/позиционирует решения.
|
||||
|
||||
Схема: `schema-vendor.json`.
|
||||
Задача и официальные ссылки — ниже.
|
||||
Executable
+138
@@ -0,0 +1,138 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Портативный runner аудита для ПК. Без внешних зависимостей."""
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
ROOT = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
|
||||
def env(name, default=""):
|
||||
return os.environ.get(name, default)
|
||||
|
||||
|
||||
def load_tasks(path):
|
||||
out = []
|
||||
with open(path, encoding="utf-8") as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if line:
|
||||
out.append(json.loads(line))
|
||||
return out
|
||||
|
||||
|
||||
def prompt(task):
|
||||
f = os.path.join(ROOT, "prompt-vendor.md" if task["kind"] == "vendor" else "prompt-practice.md")
|
||||
schema = os.path.join(ROOT, "schema-vendor.json" if task["kind"] == "vendor" else "schema-practice.json")
|
||||
p = open(f, encoding="utf-8").read()
|
||||
body = json.dumps(task, ensure_ascii=False, indent=2)
|
||||
schema_txt = open(schema, encoding="utf-8").read()[:12000]
|
||||
src = ""
|
||||
sd = os.path.join(ROOT, "sources", task["id"])
|
||||
if os.path.isdir(sd):
|
||||
chunks = []
|
||||
for name in sorted(os.listdir(sd))[:10]:
|
||||
fp = os.path.join(sd, name)
|
||||
if os.path.isfile(fp) and name.lower().endswith((".txt", ".md", ".html")):
|
||||
try:
|
||||
chunks.append("### %s\n%s" % (name, open(fp, encoding="utf-8", errors="ignore").read()[:12000]))
|
||||
except Exception:
|
||||
pass
|
||||
if chunks:
|
||||
src = "\n\n## Локальные источники\n" + "\n\n".join(chunks)
|
||||
return p + "\n\n## Задача\n```json\n" + body + "\n```\n\n## Схема ответа\n```json\n" + schema_txt + "\n```" + src
|
||||
|
||||
|
||||
def call_llm(text):
|
||||
provider = env("LLM_PROVIDER", "ollama").lower()
|
||||
base = env("LLM_URL", "http://127.0.0.1:11434").rstrip("/")
|
||||
model = env("LLM_MODEL", "qwen2.5:7b")
|
||||
key = env("LLM_API_KEY", "")
|
||||
timeout = int(env("LLM_TIMEOUT", "600"))
|
||||
if provider == "openai":
|
||||
url = base if base.endswith("/v1") else base + "/v1"
|
||||
url = url + "/chat/completions"
|
||||
body = {"model": model, "temperature": 0.2, "messages": [{"role": "user", "content": text}]}
|
||||
headers = {"Content-Type": "application/json"}
|
||||
if key:
|
||||
headers["Authorization"] = "Bearer " + key
|
||||
else:
|
||||
url = base + "/api/generate"
|
||||
body = {"model": model, "prompt": text, "stream": False, "options": {"temperature": 0.2}}
|
||||
headers = {"Content-Type": "application/json"}
|
||||
req = urllib.request.Request(url, data=json.dumps(body).encode(), headers=headers, method="POST")
|
||||
with urllib.request.urlopen(req, timeout=timeout) as r:
|
||||
data = json.loads(r.read().decode())
|
||||
if provider == "openai":
|
||||
return data["choices"][0]["message"]["content"]
|
||||
return data.get("response", "")
|
||||
|
||||
|
||||
def extract_json(text):
|
||||
text = text.strip()
|
||||
if text.startswith("```"):
|
||||
text = re.sub(r"^```[a-zA-Z]*\n?", "", text)
|
||||
text = re.sub(r"\n?```$", "", text).strip()
|
||||
try:
|
||||
return json.loads(text), None
|
||||
except Exception:
|
||||
pass
|
||||
a, b = text.find("{"), text.rfind("}")
|
||||
if a >= 0 and b > a:
|
||||
try:
|
||||
return json.loads(text[a:b + 1]), None
|
||||
except Exception as e:
|
||||
return None, str(e)
|
||||
return None, "no json"
|
||||
|
||||
|
||||
def main():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("--tasks", default=os.path.join(ROOT, "tasks.jsonl"))
|
||||
ap.add_argument("--out", default=os.path.join(ROOT, "results"))
|
||||
ap.add_argument("--limit", type=int, default=0)
|
||||
ap.add_argument("--only", default="")
|
||||
ap.add_argument("--dry-run", action="store_true")
|
||||
a = ap.parse_args()
|
||||
os.makedirs(a.out, exist_ok=True)
|
||||
tasks = load_tasks(a.tasks)
|
||||
if a.only:
|
||||
tasks = [t for t in tasks if t["id"] == a.only]
|
||||
if a.limit:
|
||||
tasks = tasks[:a.limit]
|
||||
for t in tasks:
|
||||
out = os.path.join(a.out, t["id"] + ".json")
|
||||
if os.path.exists(out):
|
||||
print("skip", t["id"])
|
||||
continue
|
||||
p = prompt(t)
|
||||
if a.dry_run:
|
||||
print("dry-run", t["id"], "prompt_chars", len(p))
|
||||
continue
|
||||
print("run", t["id"], flush=True)
|
||||
t0 = time.time()
|
||||
try:
|
||||
raw = call_llm(p)
|
||||
obj, err = extract_json(raw)
|
||||
if obj is None:
|
||||
open(os.path.join(a.out, t["id"] + ".raw.txt"), "w", encoding="utf-8").write(raw)
|
||||
print(" bad json:", err)
|
||||
continue
|
||||
obj.setdefault("id", t["id"])
|
||||
obj.setdefault("kind", t["kind"])
|
||||
obj.setdefault("vendor" if t["kind"] == "vendor" else "practice", t["name"])
|
||||
open(out, "w", encoding="utf-8").write(json.dumps(obj, ensure_ascii=False, indent=2))
|
||||
print(" ok %.1fs" % (time.time() - t0))
|
||||
except Exception as e:
|
||||
print(" error:", e)
|
||||
with open(os.path.join(a.out, t["id"] + ".log"), "a", encoding="utf-8") as f:
|
||||
f.write("%s %s\n" % (time.time(), e))
|
||||
print("done")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "Prism practice audit",
|
||||
"type": "object",
|
||||
"required": ["practice", "source_url", "mechanics", "taxonomy", "ux", "adopt_for_prism", "sources"],
|
||||
"properties": {
|
||||
"practice": {"type": "string"},
|
||||
"source_url": {"type": "string"},
|
||||
"what_it_is": {"type": "string"},
|
||||
"mechanics": {"type": "array", "items": {"type": "string"}},
|
||||
"taxonomy": {"type": "object"},
|
||||
"ux": {"type": "array", "items": {"type": "string"}},
|
||||
"data_model": {"type": "array", "items": {"type": "string"}},
|
||||
"strengths": {"type": "array", "items": {"type": "string"}},
|
||||
"weaknesses": {"type": "array", "items": {"type": "string"}},
|
||||
"adopt_for_prism": {"type": "array", "items": {"type": "string"}},
|
||||
"do_not_copy": {"type": "array", "items": {"type": "string"}},
|
||||
"sources": {"type": "array", "items": {"type": "string"}},
|
||||
"unknowns": {"type": "array", "items": {"type": "string"}}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
{
|
||||
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
||||
"title": "Prism vendor audit",
|
||||
"type": "object",
|
||||
"required": ["vendor", "official_url", "families", "compatibility", "sources"],
|
||||
"properties": {
|
||||
"vendor": {"type": "string"},
|
||||
"official_url": {"type": "string"},
|
||||
"generated_at": {"type": "string"},
|
||||
"families": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["name", "products"],
|
||||
"properties": {
|
||||
"name": {"type": "string"},
|
||||
"description": {"type": "string"},
|
||||
"products": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"required": ["model", "category", "source"],
|
||||
"properties": {
|
||||
"model": {"type": "string"},
|
||||
"category": {"type": "string"},
|
||||
"role": {"type": "string"},
|
||||
"form_factor": {"type": "string"},
|
||||
"room_size": {"type": ["string", "number", "null"]},
|
||||
"deployment": {"type": ["string", "null"]},
|
||||
"specs": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"camera.4k": {"type": ["boolean", "null"]},
|
||||
"camera.zoom_optical": {"type": ["number", "null"]},
|
||||
"camera.fov_h": {"type": ["number", "null"]},
|
||||
"audio.pickup_m": {"type": ["number", "null"]},
|
||||
"audio.mic_count": {"type": ["number", "null"]},
|
||||
"protocols": {"type": "array", "items": {"type": "string"}},
|
||||
"ports": {"type": "object"}
|
||||
},
|
||||
"additionalProperties": true
|
||||
},
|
||||
"accessories": {"type": "array", "items": {"type": "string"}},
|
||||
"kits": {"type": "array", "items": {"type": "string"}},
|
||||
"limitations": {"type": "array", "items": {"type": "string"}},
|
||||
"source": {
|
||||
"type": "object",
|
||||
"required": ["url"],
|
||||
"properties": {
|
||||
"url": {"type": "string"},
|
||||
"page": {"type": ["string", "number", "null"]},
|
||||
"quote": {"type": "string"},
|
||||
"level": {"enum": ["L1", "L2"]}
|
||||
}
|
||||
},
|
||||
"confidence": {"enum": ["high", "medium", "low"]}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"compatibility": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"from": {"type": "string"},
|
||||
"to": {"type": "string"},
|
||||
"kind": {"type": "string"},
|
||||
"condition": {"type": "string"},
|
||||
"source": {"type": "object"}
|
||||
}
|
||||
}
|
||||
},
|
||||
"sales_motion": {"type": "string"},
|
||||
"sources": {"type": "array", "items": {"type": "string"}},
|
||||
"unknowns": {"type": "array", "items": {"type": "string"}}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{"id":"vendor-yealink","kind":"vendor","name":"Yealink","official":"https://www.yealink.com","focus":"VCS-порты: MeetingBar, MeetingBoard, MeetingEye, MCore, MVC, UVC, аудио, аксессуары; BYOD","sources":["https://www.yealink.com","https://support.yealink.com"]}
|
||||
{"id":"vendor-audiocodes","kind":"vendor","name":"AudioCodes","official":"https://www.audiocodes.com","focus":"камеры, терминалы, Teams Rooms, SBC, совместимость","sources":["https://www.audiocodes.com","https://www.audiocodes.com/media/4j2l0edn/rxvcam70-ptz-camera-datasheet.pdf"]}
|
||||
{"id":"vendor-avaya","kind":"vendor","name":"Avaya","official":"https://www.avaya.com","focus":"VCS-терминалы XT/H175/Vantage; не телефония","sources":["https://www.avaya.com","https://support.avaya.com/css/public/documents/101035634"]}
|
||||
{"id":"vendor-poly","kind":"vendor","name":"Poly","official":"https://www.poly.com","focus":"Studio X/V/G, камеры, аудио, BYOD, kits","sources":["https://www.poly.com","https://www.poly.com/content/dam/www/products/video/studio/studio/doc/poly-studio-ds-it.pdf"]}
|
||||
{"id":"vendor-logitech","kind":"vendor","name":"Logitech","official":"https://www.logitech.com","focus":"Rally, MeetUp, RoomMate, Tap, Sight, CC5000e; BYOD","sources":["https://www.logitech.com"]}
|
||||
{"id":"vendor-iva","kind":"vendor","name":"IVA Technologies","official":"https://iva.ru","focus":"LARGO, терминалы, ВКС-платформа; официальные PDF","sources":["https://iva.ru","https://iva.ru/assets/content/iva-largo-310-datasheet..pdf"]}
|
||||
{"id":"vendor-hitrolink","kind":"vendor","name":"Hitrolink","official":"https://hitrolink.tech","focus":"видеобары, PTZ, терминалы, спикерфоны, RCH-аналоги; официальная документация","sources":["https://hitrolink.tech"]}
|
||||
{"id":"vendor-satel","kind":"vendor","name":"САТЕЛ","official":"https://satel.ru","focus":"ВКС-оборудование и терминалы; официальные страницы продуктов","sources":["https://satel.ru"]}
|
||||
{"id":"vendor-flat","kind":"vendor","name":"ФЛАТ (Flat)","official":"https://flat-soft.ru","focus":"ВКС/UC-продукты, терминалы/софт; официальные страницы","sources":["https://flat-soft.ru"]}
|
||||
{"id":"vendor-informtekhnika","kind":"vendor","name":"Информтехника (Миником)","official":"https://www.minicom.ru","focus":"ВКС-терминалы и оборудование; официальные страницы","sources":["https://www.minicom.ru"]}
|
||||
{"id":"practice-cisco-ccw","kind":"practice","name":"Cisco Commerce Workspace","official":"https://www.cisco.com/c/en/us/buy.html","focus":"конфигуратор: роли, совместимость, BOM, UX","sources":["https://www.cisco.com"]}
|
||||
{"id":"practice-yealink-room-designer","kind":"practice","name":"Yealink Room Designer","official":"https://www.yealink.com","focus":"комнаты, роли, аксессуары, визуальная сборка","sources":["https://www.yealink.com"]}
|
||||
{"id":"practice-logitech-configurator","kind":"practice","name":"Logitech Configurator","official":"https://www.logitech.com","focus":"подбор комнаты/решения, совместимость, BOM","sources":["https://www.logitech.com"]}
|
||||
{"id":"practice-poly","kind":"practice","name":"Poly solution finder","official":"https://www.poly.com","focus":"подбор по комнате/сценарию, family/line, аксессуары","sources":["https://www.poly.com"]}
|
||||
{"id":"practice-crestron-extron","kind":"practice","name":"Crestron / Extron design tools","official":"https://www.crestron.com","focus":"проектирование, порты, кабели, валидация, BOM","sources":["https://www.crestron.com","https://www.extron.com"]}
|
||||
{"id":"practice-octopart-siliconexpert","kind":"practice","name":"Octopart / SiliconExpert","official":"https://octopart.com","focus":"параметрический поиск, cross-reference, аналоги, lifecycle","sources":["https://octopart.com","https://www.siliconexpert.com"]}
|
||||
{"id":"practice-akeneo-pimcore","kind":"practice","name":"Akeneo / Pimcore PIM","official":"https://www.akeneo.com","focus":"taxonomy, attributes, families, lifecycle, governance","sources":["https://www.akeneo.com","https://pimcore.com"]}
|
||||
{"id":"practice-b2b-cpq","kind":"practice","name":"B2B CPQ","official":"https://www.salesforce.com/products/cpq/","focus":"quote, configurator, approvals, pricing, CRM","sources":["https://www.salesforce.com/products/cpq/"]}
|
||||
Reference in new issue
Block a user