Making API documentation digestible for LLMs through intelligent chunking and retrieval.
The paper introduces a technique to reduce LLM input token limitations when processing API documentation by intelligently chunking OpenAPI specifications and using RAG with an agent-based approach.
https://arxiv.org/abs/2411.19804
Original Problem π€:
β LLM-based service composition faces strict input token limitations, making it challenging to process comprehensive API documentation efficiently.
β Current methods struggle to preprocess and chunk API specifications while preserving essential information.
Solution in this Paper π§:
β The paper proposes OpenAPI RAG, a system that creates optimized chunks from API documentation using token-based and LLM-based strategies.
β A Discovery Agent extends this by decomposing queries into subtasks and retrieving endpoint details on demand.
β The system employs embedding models for semantic similarity matching, reducing token count while maintaining information relevance.
Key Insights π‘:
β LLM-based summary strategies outperform naive chunking approaches
β Agent-based approach significantly reduces token usage while improving precision
β Token-based chunking with endpoint splitting provides balanced performance
Results π:
β Discovery Agent achieved 70.29% precision on Spotify API tests
β Reduced token count by 62% compared to baseline RAG approach
β Maintained F1 score of 68.30% while using fewer tokens
β Successfully demonstrated scalability with TMDB API having 54 endpoints










