| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- #!/usr/bin/env bash
- set -euo pipefail
- cd "$(dirname "$0")"
- if [ -f ".venv/bin/activate" ]; then
- # shellcheck disable=SC1091
- source .venv/bin/activate
- fi
- export PYTHONPATH="$(pwd):${PYTHONPATH:-}"
- python - <<'PY'
- import asyncio
- import json
- from news_mcp.config import NEWS_EXTRACT_PROVIDER, NEWS_EXTRACT_MODEL, NEWS_SUMMARY_PROVIDER, NEWS_SUMMARY_MODEL
- from news_mcp.llm import active_llm_config
- from news_mcp.enrichment.llm_enrich import classify_cluster_llm
- SAMPLE_CLUSTER = {
- "cluster_id": "provider-test",
- "headline": "Test headline for provider verification",
- "summary": "This is a tiny sample cluster used to verify provider, model, and key configuration.",
- "topic": "other",
- "entities": [],
- "sentiment": "neutral",
- "importance": 0.0,
- "sources": ["provider_test.sh"],
- "timestamp": "2026-05-22T00:00:00+00:00",
- "articles": [
- {
- "title": "Test headline for provider verification",
- "url": "https://example.com/provider-test",
- "source": "provider_test.sh",
- "timestamp": "2026-05-22T00:00:00+00:00",
- "summary": "This is a tiny sample cluster used to verify provider, model, and key configuration.",
- }
- ],
- }
- async def main() -> None:
- print(json.dumps(active_llm_config(), indent=2, sort_keys=True))
- print()
- print("extract_provider=", NEWS_EXTRACT_PROVIDER)
- print("extract_model=", NEWS_EXTRACT_MODEL)
- print("summary_provider=", NEWS_SUMMARY_PROVIDER)
- print("summary_model=", NEWS_SUMMARY_MODEL)
- print()
- result = await classify_cluster_llm(dict(SAMPLE_CLUSTER))
- print(json.dumps(result, indent=2, sort_keys=True, ensure_ascii=False))
- asyncio.run(main())
- PY
|