The Universal Router
The Universal Router serves as the core of the system, processing user queries and determining the best tool or service to handle the request. Queries are automatically parsed, routed, and processed to generate accurate, context-aware responses. The intelligent router also manages post-processing of results, ensuring that responses are tailored to the user’s needs without requiring additional instructions.
Examples of Supported Queries
Price Queries: "What is the price of WBTC on Solana?"
Image Analysis: "What objects are in this image?"
News Updates: "Get me the latest cryptocurrency news."
Content Extraction: "Summarize the key points of this article."
Mathematics: "What is (5 + 3) * 2?"
Intelligent Query Handling
State of Mika uses advanced AI models to:
Understand natural language queries in context.
Determine the most appropriate tool to handle the request.
Automatically post-process results to provide concise and relevant responses.
Rate Limits
News: Limited by CryptoPanic API key restrictions.
Real-Time Market Data: 300 requests per minute for token price queries.
Web Scraping: No specific limits, but usage should remain considerate.
Image Recognition: Governed by Gemini API rate limits.
Mathematics: Unlimited access.
Error Handling
The API includes comprehensive error handling:
Invalid region codes return a 400 error with a detailed message.
Invalid currency lists (>50) return a 400 error.
Invalid chain IDs return a 400 error.
LLM routing failures fallback to keyword-based routing.
Post-processing failures fallback to the original response.
API timeouts and connection issues return appropriate error codes.
Token price lookup failures include detailed error information.
Invalid or inaccessible URLs return appropriate error codes.
Internal URLs and localhost are blocked for security.
Rate limits are enforced for DexScreener API calls (300/minute).
Invalid mathematical expressions return a 400 error with an explanation.
Division by zero and other math errors return appropriate error codes.
Logging
The application includes comprehensive logging:
Query analysis and routing decisions.
Post-processing attempts and results.
LLM service interactions.
Parameter validation and mapping.
Error conditions and fallbacks.
Web scraping attempts and results.
Content processing status.
Token price lookups and chain validations.
Math expression parsing and evaluation.
Configure logging level in your environment:
Last updated