← 返回 xai 的题目列表Twitter Insight Platform (CodeSignal Take-Home)
类型:qbank
The most commonly chosen prompt from xAI's 4-hour CodeSignal take-home menu. Pull tweets from a Kaggle dataset, validate them with Pydantic, ingest into a local store, then run a worker that calls the Grok API to score / classify each tweet. Layer on inbound + outbound rate limiters and Dockerize. Cursor / Claude Code is explicitly allowed and effectively required.
Requirements
Functional:
Download the supplied Kaggle Twitter dataset (or an equivalent supplied CSV/JSON dump).
Validate each record against a Pydantic model and ingest into a local database (SQLite or Postgres in Docker).
Implement an inference worker that calls the Grok API for each tweet and stores a score / classification (sentiment, topic — the prompt specifies the schema).
Add an output validation step on the LLM response (schema check + confidence threshold).
Add inbound + outbound rate limiters: cap how fast you accept new tweets vs. how fast you call the downstream Grok API. Numbers reported: ~100 req/s inbound, ~10 req/s outbound.
Dockerize the whole thing: a single docker compose up should boot the DB, the ingester, and the worker.
Record a demo video after the 4-hour code window closes: walk through the architecture and run the system end-to-end on camera.
Watch out for:
The take-home menu has two near-identical "Twitter Insight" prompts. One is MLE-leaning (more weight on the model layer); the other is the classic backend prompt. Read both descriptions carefully before choosing.
Notes
AI assistants (Cursor, Claude Code, Gemini CLI) are explicitly allowed and finishing in 4 hours without one is unrealistic. Graders care that you can defend every line in the demo, not how you produced it.
Many candidates report submitting a clean demo and then being silently rejected without the demo ever being opened — assume the grading bar is tight on completeness (rate limiters present, Docker boots cleanly, validation actually runs) rather than on novelty.
Spend the first 25 minutes choosing the prompt — the prompt-selection cost is itself part of the bar.
Use the post-clock window aggressively: dockerization and the demo recording can both be polished after the 4-hour timer stops.
Common reject signals: missing rate limiter, non-functional Docker, demo that talks around the code instead of showing it run.
Preparation
Pre-build a Cursor / Claude Code project template with: Pydantic models, SQLAlchemy + SQLite, a httpx client with retry, a tenacity-backed token bucket, and a docker-compose.yml with two services. Be able to bring this up in 30 minutes.
Drill the rate-limiter pattern with a bounded asyncio.Queue between two token buckets (see the rate-limiter card).
Practice recording a 5-minute demo: introduce architecture, run the ingestion, watch the worker process a few tweets, query the DB, show the rate limiter dropping requests under load.
Have a fallback prompt picked in advance (e.g. Grok search wrapper) in case the Twitter prompt's variant looks wrong for your background.