vccs
Vue 3용 차트 컴포넌트 모음, Recharts에서 포팅
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
개인 계정의 공개 저장소 소유자는 GitHub로 로그인해 운영자를 확인하고 소개를 직접 관리할 수 있습니다. 관리자 승인은 필요하지 않습니다.
로그인한 뒤 확인 파일을 만들어 이 저장소의 기본 브랜치에 30분 안에 커밋해 주세요. 다른 브랜치나 포크의 파일은 인정하지 않습니다. 파일을 올린 뒤 아래에서 확인하면 관리자 승인 없이 관리할 수 있습니다. 자격을 유지하려면 파일을 남겨 두세요.
로그인이 필요하면 로그인 화면으로 이동합니다. 로그인 후 이곳으로 돌아와 원하는 확인 버튼을 다시 눌러 주세요.
프로젝트 폴더에서 /nomorevibe verify를 실행하면 소유권을 확인하고 소개를 직접 관리할 수 있습니다.
1분 만에 확인하기README 전체를 불러오는 중입니다. 아래는 저장된 발췌입니다.
usaspending-agent
A tool-calling assistant for questions about USASpending.gov federal spending data. An LLM agent picks between retrieval (conceptual/definitional term lookups, and semantic NAICS/PSC/CFDA/county code lookups) and live USASpending API calls (actual numbers), across as many tool calls and turns as a question needs.
Live demo: usaspending-agent.vercel.app (frontend on Vercel, backend on Railway — see Deployment)README 전문 보기 ↗A tool-calling assistant for questions about USASpending.gov federal spending data. An LLM agent picks between retrieval (conceptual/definitional term lookups, and semantic NAICS/PSC/CFDA/county code lookups) and live USASpending API calls (actual numbers), across as many tool calls and turns as a question needs.
Live demo: usaspending-agent.vercel.app (frontend on Vercel, backend on Railway — see Deployment)
create_agent (a LangGraph graph), via langgraph_tools.py's LangChain-compatible wrappers of the same tool functions), with a SQLite checkpointer keyed by conversation_id giving real multi-turn memory — a follow-up like "what about last year?" resolves against the prior turn's history.download_records for filtered award, transaction, or sub-award CSVs via POST /api/v2/download/search/, and download_single_award for one award by its internal ID. Both poll the job and return the file link with a citation. A "Download this" button after a spending answer posts that answer's structured filters straight to the same pipeline (download_handler.py), with no LLM call.code_execution as a fallback for calculations those six don't cover.| Tool | Answers |
|---|---|
search_guide | Definitions and concepts from the Analyst's Guide and the USASpending Glossary, with page or term citations |
lookup_agency | An agency's basic profile (toptier code, mission, website) |
resolve_naics_code | Plain-English industry/business description → matching NAICS code(s), for the naics_code filter below — semantic matches against the official code index, not a confirmed exact lookup |
resolve_psc_code | Same idea for a product/service description → PSC (Product and Service Code) code(s), for the psc_code filter |
resolve_cfda_program | Same idea for a federal grant/loan/assistance program description → CFDA/Assistance Listing program number(s), for the cfda_program filter |
resolve_county_fips | A county name → its 3-digit FIPS code, for the performed_in_county/recipient_in_county filters — strips local suffixes (Louisiana parishes, Alaska boroughs/census areas) the live endpoint's own match otherwise fails on |
resolve_budget_function | A plain-English budget category (e.g. "National Defense", "Medicare") → matching budget_function/budget_subfunction code(s), for get_spending_explorer_breakdown's filters |
list_top_agencies_by_budget | Agencies ranked by budget authority, largest first, with each one's share of the total federal budget — always the current fiscal year/quarter, no historical range |
get_agency_budget | An agency's actual appropriated budgetary resources, obligations, and outlays for a fiscal year range — the real answer to "what is X's budget," as opposed to the spending tools below, which report award-level spending (a different, non-interchangeable number). group_by="sub_component" breaks the same figures down by sub-component/bureau (e.g. NIH or CDC within HHS) for a single fiscal year instead, optionally scoped to one named bureau's own federal accounts |
get_agency_award_breakdown | One agency's award obligations and transaction/new-award counts for a single fiscal year, broken down by sub-agency by default — query_spending's group_by aggregates have no count fields at all. group_by="award_category" breaks down by award category instead, and gives the agency's own single total with no breakdown |
uv sync
cp .env.example .env # fill in ANTHROPIC_API_KEY (and ANTHROPIC_WORKSPACE_ID if using an
# identity-linked key); LANGSMITH_* is optional, for tracing
The conceptual/definitional index (Guide + Glossary):
uv run python -m backend.app.retrieval.pipeline.ingest \
--pdf data/raw/analyst-guide.pdf --out data/chunks/analysts_guide_chunks.jsonl
uv run python -m backend.app.retrieval.pipeline.ingest_glossary # fetches the live Glossary API
uv run python -m backend.app.retrieval.pipeline.vector_index \
--chunks data/chunks/analysts_guide_chunks.jsonl data/chunks/glossary_chunks.jsonl
uv run python -m backend.app.retrieval.pipeline.bm25_index \
--chunks data/chunks/analysts_guide_chunks.jsonl data/chunks/glossary_chunks.jsonl
The three code-lookup indexes (resolve_naics_code/resolve_psc_code/resolve_cfda_program), each
its own Chroma collection/Whoosh index via env var overrides so they don't collide with the one above
or each other — source files already in data/raw/ (Census NAICS files, the PSC manual, the SAM.gov
CFDA bulk CSV):
uv run python -m backend.app.retrieval.pipeline.ingest_naics
uv run python -m backend.app.retrieval.pipeline.ingest_psc
uv run python -m backend.app.retrieval.pipeline.ingest_cfda
CHROMA_DB_DIR=./data/chroma_naics WHOOSH_INDEX_DIR=./data/whoosh_naics \
uv run python -m backend.app.retrieval.pipeline.vector_index --chunks data/chunks/naics_chunks.jsonl
CHROMA_DB_DIR=./data/chroma_naics WHOOSH_INDEX_DIR=./data/whoosh_naics \
uv run python -m backend.app.retrieval.pipeline.bm25_index --chunks data/chunks/naics_chunks.jsonl
# same pattern for psc (chroma_psc/whoosh_psc, psc_chunks.jsonl) and cfda (chroma_cfda/whoosh_cfda, cfda_chunks.jsonl)
Two processes: the FastAPI backend, and the Next.js frontend that talks to it through a server-side proxy route.
uv run uvicorn backend.app.main:app --reload --host 127.0.0.1 --port 8000
cd web && npm install # first time only
npm run dev
http://localhost:3000 — the empty chat state shows 5 randomly-sampled
quick-question buttons (from web/src/lib/demoQuestions.ts's hand-vetted set of 20,
each verified live to trigger its expected tool call) for a fast first-touch demoPOST /ask with {"question": "...", "conversation_id": "..."}, returns
{answer_text, source_type, conversation_id, charts, citations, tool_citations, downloads} —
omit conversation_id on the first call, then pass back the one returned to continue
the same multi-turn threadASK_RATE_LIMIT_PER_MINUTE (default 20) requests/minute per client IPGET /healthYou can also run the agent directly from the CLI, without starting the server:
uv run python -m backend.app.agent --question "What is a prime award?"
Backend on Railway, frontend on Vercel — two separate deploys, connected by one env var.
Backend (Railway):
Dockerfile (see railway.json). The image bakes the
Guide/Glossary/NAICS/PSC/CFDA indices in at build time (read-only at runtime, never
rewritten), so only the conversation-history DB needs persistent storage./data — CONVERSATIONS_DB_PATH already defaults to
/data/conversations.db in the image.ANTHROPIC_API_KEY (required), ANTHROPIC_WORKSPACE_ID (if using an
identity-linked key), LANGSMITH_* (optional tracing), ASK_RATE_LIMIT_PER_MINUTE
(optional, default 20).SqliteSaver checkpointer is one sqlite
connection in one process. Don't set --workers > 1 or scale replicas past 1 (see #72
for the Postgres swap that would allow that).GET /health (already wired into railway.json).Frontend (Vercel):
web/ as the project root.FASTAPI_BASE_URL to the Railway backend's public URL. The browser never calls the
backend directly — web/src/app/api/ask/route.ts proxies server-side — so no CORS setup
is needed on the FastAPI side.uv run pytest -q # unit tests: chunking/ingestion (Guide, Glossary, NAICS, PSC,
# CFDA), retrieval merge logic, chart/citation eligibility,
# arithmetic tools, API client parsing, conversation persistence,
# the LangGraph tool wrappers — no network calls, no API cost
uv run ruff check .
agent/dev_tools/ and retrieval/dev_tools/ hold separate, opt-in scripts (real billed
LLM calls for most of them) not run by the above or by CI — see Project layout below.
backend/app/
main.py FastAPI app (POST /ask, GET /health)
logging_config.py Shared logging setup (server + CLI)
agent/ Tool-calling agent (package)
singletons.py Lazily-constructed clients: Anthropic/LangChain chat
models, the Guide+Glossary and NAICS/PSC/CFDA
retrievers, the USASpending API client, and the
LangGraph checkpointer + conversation graph
tools/ The 21 @beta_tool data tools, split by concern:
_shared.py (call recording, per-turn budget,
untrusted-data wrapping, + search_guide/
lookup_agency/get_agency_budget (also covers
the old get_agency_budget_by_subcomponent via
group_by)/list_top_agencies_by_budget/
get_agency_award_breakdown), spending/
(category.py/over_time.py/search.py/geography.py/
consolidated.py - query_spending, consolidating
get_spending_by_category/get_spending_over_time/
search_awards/search_transactions/search_subawards/
get_spending_by_geography (the six stay as
internal implementation, not bound to the agent),
all funneled through tool_filters._build_filters),
awards.py
(get_award_details/get_award_subawards/
get_award_funding_breakdown/
get_award_transaction_history), recipients.py
(search_recipients/get_recipient_details/
get_recipient_children), award_type_breakdown.py
(get_award_type_breakdown), disaster.py
(get_disaster_spending_overview),
spending_explorer.py
(get_spending_explorer_breakdown) +
business_type_labels.py
(its code->label table), naics.py/psc.py/cfda.py/
budget_function.py/location.py (the resolve_*_code /
resolve_budget_function / resolve_county_fips
semantic code-lookup tools). See docs/adding-a-tool.md
for the tool registration checklist.
tool_filters.py Shared filter-building layer for the spending tools
arithmetic_tools.py The six deterministic arithmetic tools
langgraph_tools.py LangChain-compatible wrappers of the same tool
functions, for the LangGraph agent path
scope.py In-scope gate: a first-turn classifier plus a
separate follow-up classifier that folds in prior
conversation turns
download_handler.py CSV download pipeline shared by the download tools
and the "Download this" button
response_shaping.py Chart/citation/download-spec logic, fiscal-year math
orchestrator.py System prompt, AgentResult, ask() - runs the
LangGraph conversation path
cli.py The --question CLI entry point
dev_tools/ Manual, opt-in scripts (real billed LLM calls unless
noted, not in CI): red-team checks (data-injection,
jailbreak, prompt-extraction, resource-abuse),
tool-selection, code-lookup, and download-handler
accuracy evals (LangSmith Dataset + evaluate()),
scope-classifier calibration, live 3-turn conversation-path
verification, a code_execution wiring check, live
verification of the spending-tool filters
(verify_shared_filters.py), a free/local
coverage-diff check against the live API contract
(check_filter_coverage.py), and a LangSmith
trace-dump utility (fetch_trace.py)
retrieval/
hybrid.py Dense+sparse retriever with cross-encoder reranking (used at request time)
pipeline/ One-off scripts: Guide PDF/Glossary API/NAICS/PSC/CFDA source data -> chunks -> indexes
dev_tools/ Manual scripts: sanity_check.py, calibrate_threshold.py
usaspending/
client.py Typed client for the live USASpending.gov API
models.py Award/recipient/agency response models
filter_models.py AdvancedFilterObject models + coverage tracking
capture.py ContextVar-based live-request capture
exceptions.py USASpendingAPIError and HTTP error handling
web/ Next.js frontend (separate process; proxies to the
FastAPI API through web/src/app/api/ask/route.ts)
tests/ Unit tests
BACKLOG.md Known gaps and deferred work
group_by="whole_agency"get_award_type_breakdown | The count of awards by type — Contracts, Contract IDVs, Grants, Direct Payments, Loans, Other. The only tool here with no scoping filter required at all (a bounded six-number answer even fully unscoped); optional filters narrow it to one agency/recipient/location/etc. |
get_disaster_spending_overview | Headline disaster/emergency-relief totals — budget authority, obligations, outlays — optionally scoped to specific Disaster Emergency Fund Codes (e.g. COVID-19, infrastructure relief). All-time, government-wide only; a different data source from every award-level spending tool here |
get_spending_explorer_breakdown | Whole-of-government obligated spending grouped by budget function/subfunction/federal account/program activity/object class/agency/recipient — account-level data, a different lineage from every award-level spending tool below; totals won't match them and that's expected |
query_spending | Individual award/subaward/transaction records, or an aggregate rollup, for a fiscal year range, scoped by an awarding agency and/or a recipient. level (award/subaward/transaction) picks the record type — subaward reverses recipient_name/recipient_in_* to mean the sub-recipient, not the prime, the opposite of every other level. Omit group_by for ranked individual rows (search_awards/search_subawards/search_transactions's old job); set it to a category name (NAICS/PSC/sub-agency/etc. — top limit categories, not a grand total), "time" (a real grand total across fiscal years/quarters/months), or "geography" (state/county/congressional-district/country, the only path to a location breakdown — population/per-capita figures reflect current data, not the queried period). Consolidates what were six separate tools (search_awards, search_subawards, search_transactions, get_spending_by_category, get_spending_over_time, get_spending_by_geography) into one — each result still includes an internal_id for a follow-up get_award_details call, and flags when a result list is truncated |
get_award_details | Full details for one specific award (contract, IDV, grant, loan, or other financial assistance) found via query_spending — description, dates, competition data, recipient, funding breakdown, and parent-vehicle linkage. include_child_orders=True fetches the real child/grandchild-order rollup for an IDV (contract vehicle), since an IDV's own reported total can show $0 even when it's an active, heavily-used vehicle |
get_award_funding_breakdown | The Federal Account Funding breakdown for one specific award — which Treasury Account Symbol/object class/program activity/DEFC combinations funded it, and how much each contributed. A separate, later-timed data source from get_award_details' own total, only best-effort linked to it |
get_award_transaction_history | The individual transactions/modifications that built up to one specific award's current state — mod number, action date, action type, amount, description per row |
get_award_subawards | The complete subaward list for one specific prime award already found via query_spending, given its internal_id — the award-profile page's own Sub-Awards tab, as opposed to query_spending(level="subaward")'s cross-award search |
search_recipients | Find a company/organization/individual's exact recipient_id by name, UEI, or DUNS — a name alone is often genuinely ambiguous (e.g. "Boeing" resolves to 6+ distinct recipients sharing the same display name), so this shows every real candidate rather than silently picking one, for a precise follow-up via get_recipient_details or the recipient_id filter above |
get_recipient_details | Full profile for one already-resolved recipient — identity, parent company, address, business types, and total federal transactions for a fiscal year, "all" (default), or "latest" (trailing 12 months) |
get_recipient_children | The individual child recipients rolling up into one already-resolved "parent"-level recipient's total, e.g. "which subsidiaries make up Boeing's total" — resolves the live API's DUNS/UEI keying internally, so callers still pass a recipient_id |
sum_values, average, percentage_of, delta, ratio, rank_values | Deterministic arithmetic over numbers the tools above already returned — totals, shares, before/after change, cross-entity comparison, ranking |
code_execution | Anthropic's sandboxed Python/Bash fallback for calculations the six typed tools don't cover (e.g. a statistic like standard deviation) |