intelligems-core
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese/intelligems-core
/intelligems-core
Shared library that powers all Intelligems Analytics skills. Sets up your workspace with the API client, metric helpers, and configuration.
You rarely need to run this directly — other skills (like ) automatically check for the workspace and set it up if needed.
/test-verdict为所有Intelligems Analytics技能提供支持的共享库。用于为你的工作区配置API客户端、指标辅助工具及相关设置。
你几乎无需直接运行此库——其他技能(如)会自动检查工作区状态,若需要则自动完成设置。
/test-verdictWhat's Included
包含内容
| File | Purpose |
|---|---|
| API client with automatic retry and rate-limit handling |
| Extract values, uplift, confidence, and CI bounds from API responses |
| Formatting, runtime calculation, variation lookup |
| Shared thresholds (80% confidence, 10-day minimum, etc.) |
| Slack Block Kit formatting and webhook delivery |
| Creates |
| Creates macOS LaunchAgent for scheduled Slack delivery |
| 文件 | 用途 |
|---|---|
| 具备自动重试和速率限制处理功能的API客户端 |
| 从API响应中提取数值、提升量、置信度及置信区间边界 |
| 格式化、运行时计算、变体查询 |
| 共享阈值设置(如80%置信度、最小10天周期等) |
| Slack Block Kit格式化及Webhook推送 |
| 创建包含虚拟环境及依赖项的 |
| 创建用于定时Slack推送的macOS LaunchAgent |
Step 1: Get API Key
步骤1:获取API密钥
Ask the user for their Intelligems API key.
"What's your Intelligems API key? You can get one by contacting support@intelligems.io"
Never hardcode or assume an API key.
向用户索要他们的Intelligems API密钥。
“你的Intelligems API密钥是什么?你可以通过联系support@intelligems.io获取。”
绝对不要硬编码或默认假设API密钥。
Step 2: Set Up Workspace
步骤2:设置工作区
Run the setup script to create the workspace:
bash
bash setup_workspace.shThis creates:
- — working directory
~/intelligems-analytics/ - — Python virtual environment
~/intelligems-analytics/venv/ - — API key configuration
~/intelligems-analytics/.env
Then save the user's API key:
bash
echo "INTELLIGEMS_API_KEY=<user's key>" > ~/intelligems-analytics/.env运行设置脚本以创建工作区:
bash
bash setup_workspace.sh此脚本会创建:
- — 工作目录
~/intelligems-analytics/ - — Python虚拟环境
~/intelligems-analytics/venv/ - — API密钥配置文件
~/intelligems-analytics/.env
然后保存用户的API密钥:
bash
echo "INTELLIGEMS_API_KEY=<user's key>" > ~/intelligems-analytics/.envStep 3: Copy Core Libraries
步骤3:复制核心库
Copy all files from into the workspace:
references/bash
cp references/ig_client.py ~/intelligems-analytics/
cp references/ig_metrics.py ~/intelligems-analytics/
cp references/ig_helpers.py ~/intelligems-analytics/
cp references/ig_config.py ~/intelligems-analytics/将目录下的所有文件复制到工作区:
references/bash
cp references/ig_client.py ~/intelligems-analytics/
cp references/ig_metrics.py ~/intelligems-analytics/
cp references/ig_helpers.py ~/intelligems-analytics/
cp references/ig_config.py ~/intelligems-analytics/Step 4: Verify
步骤4:验证
Activate the environment and verify the client works:
bash
source ~/intelligems-analytics/venv/bin/activate
python3 -c "
from ig_client import IntelligemsAPI
from dotenv import load_dotenv
import os
load_dotenv()
api = IntelligemsAPI(os.getenv('INTELLIGEMS_API_KEY'))
tests = api.get_active_experiments()
print(f'Connected. Found {len(tests)} active experiment(s).')
"If successful, the workspace is ready for any Intelligems Analytics skill.
激活虚拟环境并验证客户端是否正常工作:
bash
source ~/intelligems-analytics/venv/bin/activate
python3 -c "
from ig_client import IntelligemsAPI
from dotenv import load_dotenv
import os
load_dotenv()
api = IntelligemsAPI(os.getenv('INTELLIGEMS_API_KEY'))
tests = api.get_active_experiments()
print(f'Connected. Found {len(tests)} active experiment(s).')
"如果验证成功,工作区就可以用于任何Intelligems Analytics技能了。