The present application relates to the field of
artificial intelligence and computer application technology, in particular to a multi-source context retrieval and intention execution method, which comprises the following steps: based on the given user question and user identification, retrieval,
processing and token budget truncation are performed to generate context text that can safely inject
system prompt of a large
language model system; the user intention type and entity are determined, and an
executable plan
JSON is generated from a predefined plan template; the user
natural language and available table structure are input; for the user request determined as a
data analysis type, the determined data and chart are output, and the LLM is called to generate AI insight and push in a streaming manner according to the token budget segmentation; the multi-source retrieval and injection
algorithm realizes reproducible merging and truncation under the unified
data structure and sorting rules, and is combined with the token budget, which is suitable for the AgentOS shared by multiple tenants and multiple business lines, reduces the repeated docking of various applications and the context inconsistency problem, and improves the integrability.