TopoSem: In-context planning with semantically-informed tooling graph similarity
2025
Designing intelligent assistants for e-commerce sellers presents significant challenges, primarily due to the abstract nature of seller queries and the complexity of orchestrating multiple internal tools. In-context planning (ICP) has emerged as a promising adaptive problem-solving approach for this setting. However, selecting effective exemplars for ICP remains a difficult problem, largely because of the intricate coordination among underlying APIs. Relying solely on semantic similarity between textual queries can misguide large language models (LLMs) during planning, as semantically similar queries may correspond to vastly different API execution graphs. To address this, we propose TopoSem, a novel framework that enhances ICP by jointly considering the topological distance of API execution graphs and the semantic differences in API payloads. We leverage a contrastive learning approach to learn meaningful embeddings, which are then used in an enhanced dynamic clustering mechanism to reduce noise and redundancy in exemplar selection. Empirical results demonstrate that TopoSem substantially outperforms traditional exemplar selection methods in terms of planning accuracy and generalization, particularly in scenarios involving complex API orchestration.
Research areas