Context assembly based on a business state machine and method and system for binding with tool parameters

By using a context assembly and tool parameter binding method based on business state machines, the problems of cross-domain erroneous calls, parameter illusions, and cross-domain pollution in e-commerce intelligent customer service are solved. This achieves the unification of tool call accuracy and context management, and improves the consistency of business domain state reasoning in intelligent customer service.

CN123180346APending Publication Date: 2026-11-27SHANGHAI OUDIAN CLOUD INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611331225.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-31
Publication Date
2026-11-27

AI Technical Summary

Technical Problem

In existing e-commerce intelligent customer service technologies, tool calls lack a unified reasoning mechanism based on business domain knowledge, leading to problems such as cross-domain erroneous calls, parameter illusions, order mix-ups, and cross-domain pollution.

Method used

A context assembly and tool parameter binding method based on business state machines is adopted. The business domain state machine drives intent confirmation and denial rollback, tool gating, context assembly and parameter binding lifecycle management. The automatic reasoning and management of business domain state is realized by using a session state maintenance module, intent and hypothesis module, domain state machine, domain configuration center, tool gating module, context assembly module, parameter binding module and large model calling module.

Benefits of technology

Reduce cross-domain erroneous calls, prevent parameter illusion and string pollution, improve the consistency of knowledge reasoning, control reasoning costs, and achieve a balance between tool call accuracy and context management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123180346A_ABST
    Figure CN123180346A_ABST
Patent Text Reader

Abstract

The application provides a context assembly and tool parameter binding method and system based on a service state machine, which maintains a service domain state and an entity binding table for each session, generates an intention hypothesis and a target domain after receiving user input through intention recognition, outputs a confirmation inquiry to the user when the confidence level is low, migrates the domain state according to the confirmation result, and rolls back the domain state according to the denial result; reads the allowed tool set from the domain configuration center according to the current domain and performs tool gating, assembles the domain-related context containing instruction fragments, policy summaries, demonstration dialogues and entity summaries, performs parameter binding on the parsed entity and generates a reduced-parameter tool view to submit a large model, and merges and injects the bound parameters during tool execution; and releases the original domain binding when the domain is switched or exited. The application has the beneficial effects of: uniformly driving tool gating, context assembly and binding life cycle management by a domain state machine, reducing cross-domain mis-calling and parameter illusion, and preventing single-string and domain pollution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention mainly relates to the field of intelligent customer service and large model tool invocation technology, specifically to a method and system for context assembly and tool parameter binding based on a business state machine. Background Technology

[0002] E-commerce intelligent customer service typically integrates multiple business tools, including those for shopping guides, order processing, and membership management. The large model selects tools and inputs parameters via function calls. To improve the accuracy of tool calls, existing technologies often employ methods such as changing prompts after intent recognition, retrieving dynamic example dialogues, or injecting partial fields from the execution layer when parameters are known. Some solutions utilize multi-agent roles, allowing switching between instances of shopping guide and after-sales service robots.

[0003] In practical applications, the above solutions suffer from several drawbacks. First, when all tools are continuously mounted, the system relies solely on prompts to determine when they should be invoked. Second, after-sales consultations may mistakenly trigger search or points tools. Third, static or purely similarity-based sample dialogues are not linked to domain status and confirmation / denial results, leaving residual strategies even after the user denies intent. Fourth, known parameters are only hidden without unbinding, resulting in old order numbers being injected even after the user changes topics, leading to order mix-ups. Fifth, confirmation results from existing clarification statements do not drive unified switching and rollback of tool sets, context packages, and binding tables, lacking a unified reasoning mechanism based on business domain knowledge representation to coordinate the linkage of these modules. Summary of the Invention

[0004] 1. The technical problem that the invention aims to solve: This invention provides a method and system for context assembly and tool parameter binding based on a business state machine. The business domain state machine serves as the engine for business knowledge representation and state reasoning, and uniformly drives the lifecycle management of intent confirmation and denial rollback, tool gating, context assembly, and scoped parameter binding.

[0005] 2. Technical Solution: To achieve the above objectives, the technical solution provided by this invention is as follows: The context assembly and tool parameter binding method based on the business state machine includes the following steps: S1. Maintain a business domain status and entity binding table for each session. The business domain status includes non-domain status, assumed pending confirmation status, and at least two business domain statuses. S2. Receive user input, generate intent hypothesis and target domain through intent recognition, and output confirmation query to user when the confidence level of the intent hypothesis is lower than a preset threshold; migrate the business domain state to the target domain according to the user's confirmation result, and roll back the business domain state to the state before migration according to the user's denial result. S3. Based on the current business domain status, read the allowed tool set, context package and bindable entity type corresponding to the business domain from the domain configuration center, and gating the tool list exposed to the large model; S4. Assemble domain-related contexts according to the current business domain. The domain-related contexts include instruction fragments, policy summaries, sample dialogues, and entity summaries. S5. Perform parameter binding on the parsed entities, omit the parameters corresponding to the bound entities from the tool parameter view visible in the large model, and generate a parameter reduction tool view; S6. Submit the parameter reduction tool view and the domain-related context to the large model, obtain the tool call request, and then execute the tool call after merging and injecting the bound parameters during the tool execution phase. S7. When a domain switch or domain exit is detected, release the entity bindings of the original business domain and switch to the allowed tool set and context package of the new business domain.

[0006] Furthermore, step S2, which involves migrating the business domain state to the target domain based on the user's confirmation and rolling back the business domain state to its pre-migration state based on the user's denial, specifically includes: When the user confirms, the business domain state is migrated to the target domain, and the business domain state, entity binding table and tool policy before migration are pushed onto the rollback stack. When a user denies the migration, a snapshot before the migration is popped from the rollback stack to restore the business domain state, entity binding table, and tool policies.

[0007] Furthermore, the domain configuration center defines a domain identifier, domain name, a subset of tools that the business domain is allowed to call, a context package identifier corresponding to the business domain, entity types that the business domain can be bound to, and a sample library index for each business domain.

[0008] Furthermore, the gating of the tool list exposed to the large model in step S3 is as follows: before each round of inference, only the set of allowed tools corresponding to the current business domain state is exposed to the large model, and tools outside the current business domain are not included in the tool list for this round.

[0009] Furthermore, the assembly of domain-related contexts according to the current business domain in step S4 specifically includes: loading the corresponding instruction fragments and policy summaries according to the context package identifier of the current business domain, selecting the demonstration dialogue that matches the current business domain status according to the demonstration library index, and generating entity summaries according to the entity binding table.

[0010] Furthermore, the parameter binding of the parsed entity described in step S5 specifically includes: when the tool returns an entity or the entity recognition module parses an entity, a binding record is created. The binding record contains an entity value and a scope identifier, and the scope identifier corresponds to the business domain to which the entity belongs. The binding record is merged and injected only when the business domain to which the tool belongs is consistent with the scope identifier of the binding record.

[0011] Furthermore, the release trigger conditions for the binding record include domain switching, domain exit, binding entity replacement, binding lifetime timeout, and tool execution failure.

[0012] Furthermore, when there is an already bound entity in the current business domain, this round only exposes the parameter reduction tool view to the large model, and does not expose the full parameter tool view containing the parameters corresponding to the bound entity at the same time.

[0013] A context assembly and tool parameter binding system based on a business state machine includes: The session state maintenance module is used to maintain a business domain state and entity binding table for each session. The intent and hypothesis module is used to receive user input and generate intent hypotheses and target domains. When the confidence of the intent hypothesis is lower than a preset threshold, it outputs a confirmation query and triggers domain state transition or rollback based on the user's confirmation or denial result. Domain state machine is used to manage the migration, rollback, and switching of business domain states; The domain configuration center is used to store the allowed tool sets, context packages, bindable entity types, and sample library indexes for each business domain. The tool gating module is used to gate the list of tools exposed to the large model based on the current business domain status. The context assembly module is used to assemble domain-related contexts according to the current business domain; The parameter binding module is used to perform parameter binding on parsed entities, generate a parameter reduction tool view, and merge and inject the bound parameters during the tool execution phase. The large model invocation module is used to submit the parameter reduction tool view and the domain-related context to the large model and obtain the tool invocation request; The tool execution module is used to execute tool calls and merge the injected bound parameters.

[0014] Furthermore, it also includes a rollback stack, which is used to save the business domain state, entity binding table and tool policy snapshot before migration when the user confirms the entry into the domain, and to pop up the snapshot to restore the business domain state, entity binding table and tool policy when the user denies it.

[0015] 3. Beneficial effects: Compared with the prior art, the technical solution provided by this invention has the following advantages: Reduce cross-domain misuse: The large model only sees a subset of tools in the current business domain in each round, avoiding accidental calls to shopping guide or membership tools in after-sales consultation scenarios.

[0016] Reduce parameter illusion: Parsed entities are injected by the server during the execution phase, avoiding the repeated generation of key fields such as order numbers in large models.

[0017] To prevent cross-listing and cross-domain pollution: the bound record carries the domain scope, and the binding is released when the domain switches or exits. If the user denies the assumption, the entire record can be rolled back.

[0018] Clarification scripts are linked to state: Intent confirmation questions have been upgraded from an independent copy module to triggers for state transitions and strategy switching.

[0019] Controlling inference costs: Domain-level contexts and tool views are smaller than full mounts, which helps control token overhead; Enhancing the consistency of knowledge reasoning: The business domain state machine unifies the scattered intent confirmation, tool gating, context assembly and binding management under the same knowledge expression framework. Through state reasoning, it ensures the consistency of strategies of each module and avoids strategy conflicts caused by independent decisions of multiple modules.

[0020] It should be noted that the structures not described in this invention are not related to the design points and improvement directions of this invention, and are the same as or can be implemented using existing technologies, and will not be elaborated here. Attached Figure Description

[0021] Figure 1 This is a flowchart of the method of the present invention; Figure 2 This is a schematic diagram of the business domain state machine of the present invention; Figure 3 This is a flowchart of the assembly and binding pipeline before the single-round reasoning of the present invention; Figure 4 This is a sequence diagram of the parameter binding lifecycle of the present invention; Figure 5 This is a block diagram of the system module structure of the present invention; Figure 6 This is a timing diagram for an e-commerce embodiment of the present invention. Detailed Implementation

[0022] To facilitate understanding of the present invention, a more complete description of the invention will be given below with reference to the accompanying drawings, which illustrate several embodiments of the invention. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that the disclosure of the invention will be more thorough and complete.

[0023] Example 1: Domain Configuration In this embodiment, taking e-commerce intelligent customer service as an example, four business domain states are configured: NONE (not entered domain), GUIDE (shopping guide domain), ORDER (order domain), and MEMBER (member domain).

[0024] The domain configuration center defines a domain identifier, domain name, allowed subset of tools, context package identifier, bindable entity types, and sample library index for each business domain. The specific configuration is shown in the table below:

[0025] The above domain configuration can be extended to more business domains such as payment domain and invoice domain, and is not limited to the above three business domains.

[0026] Example 2: Service Domain State Machine Combination Figure 2 This section explains the working process of a business domain state machine. Essentially, a business domain state machine is a knowledge representation and reasoning mechanism based on business rules. It achieves automatic reasoning and management of session states through predefined domain states, state transition conditions, and rollback rules. The business knowledge base consists of the set of allowed tools, context packages, and bindable entity types stored in the domain configuration center for each business domain. The confirmation or denial results of intent assumptions serve as reasoning input, and the output, after state transition reasoning, is the tool policy and context policy that should be activated in the current domain. The specific working process is as follows: The session enters the non-domain state (NONE) during initialization. After receiving user input, the system generates intent hypotheses and target domains through intent recognition; When the confidence level of the intent assumption is higher than the preset threshold, the process is directly migrated to the target business domain. When the confidence level is lower than a preset threshold, the system enters a pending confirmation state (HYPOTHESIS_PENDING) and outputs a confirmation question in the form of "Do you want to ask..." to the user. When the user confirms and the target is the shopping guide domain, migrate to the shopping guide domain (GUIDE). When the user confirms and the target is the order domain, migrate to the order domain (ORDER). When the user confirms and the target is the member domain, migrate to the member domain (MEMBER). If the user denies the migration, the system will roll back to the state before the migration. When a new cross-domain hypothesis is detected in any business domain state, the system enters a hypothesis pending confirmation state. After user confirmation, the system switches to the new business domain and releases the original domain binding. When a user leaves the domain, the binding is released and the user returns to a non-domain state.

[0027] Example 3: Assembly and Binding Pipeline Before Single-Round Reasoning Combination Figure 3Explanation of the assembly and binding pipeline before a single round of inference: After receiving user input, the system determines whether user confirmation is required based on intent recognition or hypothesis generation. When confirmation is required, output a confirmation query and push the current state onto the rollback stack snapshot; depending on the user's confirmation or denial result, if confirmed, migrate the business domain state; if denied, pop the stack and roll back the binding and tool strategy. When no confirmation is required, the current domain state can be directly used. Then, according to the domain gating tool set, the domain context (including instruction fragments, sample dialogues, and entity summaries) is assembled, and it is determined whether there are related entities in the current domain binding table: if there are, a parameter reduction tool view is generated (the bound parameters are omitted); otherwise, a full parameter tool view is used. Submit the tool view and context to the large model, and merge the bound parameters on the server when the tool is executed; Finally, determine whether the domain has been switched or exited. If so, release the original domain binding, switch the context package, update the binding table, and wait for the next round.

[0028] Example 4: Parameter Binding Lifecycle Combination Figure 4 Explanation of parameter binding lifecycle: Taking the order domain as an example, after a user asks "Can I get a refund?" and confirms entering the order domain, the domain state machine sets the domain to ORDER and loads the order tool subset and the context package; After the user provides the order number or the order search tool returns the order number, the parameter binding module writes the binding record binding{order_id,scope=ORDER}. In the next round, the tool view will remove the order_id parameter. When the large model calls apply_after_sale(reason=...), it will not include order_id. The tool execution layer will merge and inject order_id before execution. When the user asks "How do I use the points?" and confirms entry into the member domain, the domain state machine releases the binding of scope to ORDER, switches the member tool and context package, and the original order_id is no longer injected into subsequent tool calls.

[0029] Example 5: System Module Structure Combination Figure 5 System module structure description: User messages enter the intent and hypothesis module, generate intent hypotheses, and are then sent to the domain state machine. The domain state machine reads the domain configuration center and drives the tool gating module and the context assembly module, respectively. The tool gating module outputs the set of tools allowed in the current domain, and the context assembly module outputs the domain-related context. Both are then sent to the large model calling module. After the large model returns the tool call request, the tool execution module, in cooperation with the parameter binding module, merges and injects the bound parameters and executes the tool. The tool returns the execution result to the user, and the parameter binding module updates the binding table based on the execution result.

[0030] Example 6: Complete E-commerce Example Combination Figure 6 This document describes a complete implementation in an e-commerce scenario: When a user enters "Can I get a refund?", the intelligent customer service responds with "Do you mean to ask if we support seven-day no-reason after-sales service?". After the user confirms, the domain state machine sets the domain to ORDER and loads the order domain context and tools. The intelligent customer service calls the query_order tool, the tool layer returns the order number O123, and the parameter binding module binds order_id=O123; Subsequently, the intelligent customer service calls the apply_after_sale tool (without the order_id parameter). After O123 is injected into the tool's execution layer, it executes and replies to the user whether it is applicable and provides further guidance. The user then enters "How do I use the points?", and the intelligent customer service outputs "Confirm whether you want to inquire about member points?". After the user confirms, the domain state machine sets the domain to MEMBER, releases the order binding, switches the member toolkit, and calls the query_points tool to explain the points rules to the user.

[0031] This invention can also be extended in the following ways: High confidence indicates an intention to skip confirmation and directly enter the domain; low confidence indicates an intention to force confirmation. The binding record has a set lifespan, and the binding is reactivated when the user explicitly enters "change to another order"; The two tools for full participation and parameter reduction coexist and are disambiguated through naming; Combined with the side-channel manual clarification mechanism, a background clarification is initiated for policy exceptions within the order domain, and the clarified entities are written into the binding table; Domain configuration is extended to more business domains such as payment domain and invoice domain.

[0032] In summary, this invention takes the business domain state machine as its core and unifies the lifecycle management of intent confirmation, tool gating, context assembly, and parameter binding, effectively reducing cross-domain erroneous calls and parameter illusions, and preventing single-domain and cross-domain pollution.

[0033] The above-described embodiments are merely illustrative of certain implementations of the present invention, and are described in a relatively specific and detailed manner. However, they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of the present invention, and these modifications and improvements are all within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the appended claims.

Claims

1. A method for context assembly and tool parameter binding based on a business state machine, characterized in that, Includes the following steps: S1. Maintain a business domain status and entity binding table for each session. The business domain status includes non-domain status, assumed pending confirmation status, and at least two business domain statuses. S2. Receive user input, generate intent hypothesis and target domain through intent recognition, and output confirmation query to user when the confidence level of the intent hypothesis is lower than a preset threshold; Based on the user's confirmation, the business domain state is migrated to the target domain; based on the user's denial, the business domain state is rolled back to the state before migration. S3. Based on the current business domain status, read the allowed tool set, context package and bindable entity type corresponding to the business domain from the domain configuration center, and gating the tool list exposed to the large model; S4. Assemble domain-related contexts according to the current business domain. The domain-related contexts include instruction fragments, policy summaries, sample dialogues, and entity summaries. S5. Perform parameter binding on the parsed entities, omit the parameters corresponding to the bound entities from the tool parameter view visible in the large model, and generate a parameter reduction tool view; S6. Submit the parameter reduction tool view and the domain-related context to the large model, obtain the tool call request, and then execute the tool call after merging and injecting the bound parameters during the tool execution phase. S7. When a domain switch or domain exit is detected, release the entity bindings of the original business domain and switch to the allowed tool set and context package of the new business domain.

2. The context assembly and tool parameter binding method based on business state machine according to claim 1, characterized in that: Step S2, which involves migrating the business domain state to the target domain based on the user's confirmation and rolling back the business domain state to its pre-migration state based on the user's denial, specifically includes: When the user confirms, the business domain state is migrated to the target domain, and the business domain state, entity binding table and tool policy before migration are pushed onto the rollback stack. When a user denies the migration, a snapshot before the migration is popped from the rollback stack to restore the business domain state, entity binding table, and tool policies.

3. The context assembly and tool parameter binding method based on business state machine according to claim 1, characterized in that: The domain configuration center defines a domain identifier, domain name, a subset of tools that the business domain is allowed to call, a context package identifier corresponding to the business domain, entity types that the business domain can be bound to, and a sample library index for each business domain.

4. The context assembly and tool parameter binding method based on business state machine according to claim 1, characterized in that: The gating of the tool list exposed to the large model in step S3 is as follows: before each round of inference, only the set of allowed tools corresponding to the current business domain state is exposed to the large model, and tools outside the current business domain are not included in the tool list for this round.

5. The method for context assembly and tool parameter binding based on a business state machine according to claim 1, characterized in that: The assembly of domain-related contexts according to the current business domain in step S4 specifically includes: loading the corresponding instruction fragments and policy summaries according to the context packet identifier of the current business domain, selecting the demonstration dialogue that matches the current business domain status according to the demonstration library index, and generating entity summaries according to the entity binding table.

6. The context assembly and tool parameter binding method based on business state machine according to claim 1, characterized in that: Step S5, which involves binding parameters to the parsed entity, specifically includes: when the tool returns an entity or the entity recognition module parses an entity, a binding record is created. The binding record contains the entity value and a scope identifier, and the scope identifier corresponds to the business domain to which the entity belongs. The binding record is merged and injected only when the business domain to which the tool belongs is consistent with the scope identifier of the binding record.

7. The context assembly and tool parameter binding method based on business state machine according to claim 6, characterized in that: The release trigger conditions for the binding record include domain switching, domain exit, binding entity replacement, binding lifetime timeout, and tool execution failure.

8. The context assembly and tool parameter binding method based on business state machine according to claim 1, characterized in that: When there is an already bound entity in the current business domain, this round only exposes the parameter reduction tool view to the large model, and does not expose the full parameter tool view containing the parameters corresponding to the bound entity at the same time.

9. A context assembly and tool parameter binding system based on a business state machine, characterized in that, include: The session state maintenance module is used to maintain a business domain state and entity binding table for each session. The intent and hypothesis module is used to receive user input and generate intent hypotheses and target domains. When the confidence of the intent hypothesis is lower than a preset threshold, it outputs a confirmation query and triggers domain state transition or rollback based on the user's confirmation or denial result. Domain state machine is used to manage the migration, rollback, and switching of business domain states; The domain configuration center is used to store the allowed tool sets, context packages, bindable entity types, and sample library indexes for each business domain. The tool gating module is used to gate the list of tools exposed to the large model based on the current business domain status. The context assembly module is used to assemble domain-related contexts according to the current business domain; The parameter binding module is used to perform parameter binding on parsed entities, generate a parameter reduction tool view, and merge and inject the bound parameters during the tool execution phase. The large model invocation module is used to submit the parameter reduction tool view and the domain-related context to the large model and obtain the tool invocation request; The tool execution module is used to execute tool calls and merge the injected bound parameters.

10. The context assembly and tool parameter binding system based on business state machine according to claim 9, characterized in that: It also includes a rollback stack, which is used to save the business domain state, entity binding table and tool policy snapshot before migration when the user confirms the entry into the domain, and to pop up the snapshot to restore the business domain state, entity binding table and tool policy when the user denies it.