- Added new endpoints to the analyst API for managing assets, including `GET /assets` to list assets and `POST /assets/{kind}/{asset_id}/publish` to publish assets.
- Introduced `DictAmbiguityCheckRequest` schema for checking metric ambiguities, enhancing the analyst's ability to clarify definitions and aliases.
- Implemented `detect_dict_ambiguity` function to analyze potential ambiguities in metrics, providing structured feedback for users.
- Updated `AnalystAgent` to support the new asset management functionalities and ambiguity detection logic, improving overall user experience.
- Enhanced existing schemas and services to accommodate new features, ensuring robust data handling and validation.
This update significantly improves the analyst API's capabilities, allowing for better asset management and clarity in metric definitions.
38 lines
1.1 KiB
SQL
38 lines
1.1 KiB
SQL
-- 问数 NL2SQL few-shot(published · D-11 演示)
|
||
-- 用法:mysql -u root jinrong_agent < scripts/agent/seed-analyst-few-shots.sql
|
||
|
||
USE jinrong_agent;
|
||
|
||
DELETE FROM analytics_few_shot WHERE created_by = 'SEED';
|
||
|
||
INSERT INTO analytics_few_shot (question, sql_text, status, version, created_by, published_by)
|
||
VALUES (
|
||
'平台持仓市值最大的客户是谁,其持有产品的净值走势如何',
|
||
'WITH top_c AS (
|
||
SELECT h.customer_id
|
||
FROM core_holding h
|
||
GROUP BY h.customer_id
|
||
ORDER BY SUM(h.market_value) DESC
|
||
LIMIT 1
|
||
)
|
||
SELECT c.customer_id, c.display_name, p.product_name, n.nav_date, n.nav, n.daily_chg_pct
|
||
FROM top_c t
|
||
JOIN core_customer c ON c.customer_id = t.customer_id
|
||
JOIN core_holding h ON h.customer_id = t.customer_id
|
||
JOIN core_product p ON p.product_id = h.product_id
|
||
JOIN core_product_nav n ON n.product_id = h.product_id
|
||
ORDER BY p.product_name, n.nav_date',
|
||
'published',
|
||
1,
|
||
'SEED',
|
||
'SEED'
|
||
),
|
||
(
|
||
'各产品类型有多少只',
|
||
'SELECT product_type, COUNT(*) AS product_count FROM core_product GROUP BY product_type ORDER BY product_count DESC',
|
||
'published',
|
||
1,
|
||
'SEED',
|
||
'SEED'
|
||
);
|