Chat USD Modifiers#

Modifiers are a key architectural component in the Chat USD system that extend the functionality of network nodes. They intercept and modify messages, execute code, process results, and enhance the overall capabilities of the system. This document provides a comprehensive overview of the modifiers used in the Chat USD system.

Overview#

In the LC Agent framework, modifiers are components that can be attached to network nodes to extend their functionality. They can intercept messages before they are processed by the node, modify the results after processing, or perform additional operations during the processing.

The Chat USD system uses a variety of modifiers to enhance its capabilities, including:

  1. Code execution modifiers

  2. Scene information modifiers

  3. Search modifiers

  4. Network management modifiers

  5. Result processing modifiers

Each modifier serves a specific purpose and contributes to the overall functionality of the system.

Core Modifier Types#

Code Execution Modifiers#

DoubleRunUSDCodeGenInterpreterModifier#

The DoubleRunUSDCodeGenInterpreterModifier is a key modifier in the Chat USD system that executes code snippets and handles errors. It is used by both the USDCodeInteractiveNetworkNode and the SceneInfoNetworkNode.

This modifier executes code snippets in two phases:

  1. First run: Check for errors

  2. Second run: Execute the code

This two-phase approach ensures that errors are caught and handled appropriately, leading to a more robust code execution experience.

CodeExtractorModifier#

The CodeExtractorModifier extracts code snippets from responses. It identifies code blocks in the response and extracts them for execution.

This modifier ensures that code snippets are properly formatted and ready for execution.

Scene Information Modifiers#

SceneInfoPromoteLastNodeModifier#

The SceneInfoPromoteLastNodeModifier promotes code and error messages from subnetworks to the main network. It is used by the SceneInfoNetworkNode to ensure that the user sees the final code and any error messages.

This modifier ensures that the user sees the final code and any error messages, even if they were generated by a subnetwork.

USDCodeGenRagModifier#

The USDCodeGenRagModifier enhances scene information retrieval with Retrieval-Augmented Generation (RAG). It retrieves relevant information from a knowledge base to improve the quality of the generated code.

This modifier retrieves relevant information from a knowledge base and adds it to the query, improving the quality of the generated code.

Search Modifiers#

USDSearchModifier#

The USDSearchModifier is a key modifier in the Chat USD system that handles USD asset searches. It intercepts search queries, calls the USD Search API, and processes the results.

This modifier ensures that search queries are properly processed and the results are presented to the user in a useful format.

Network Management Modifiers#

NetworkLenghtModifier#

The NetworkLenghtModifier controls the maximum length of the network. It is used by both the USDCodeInteractiveNetworkNode and the SceneInfoNetworkNode to prevent the network from growing too large.

This modifier ensures that the network does not grow too large and consume too many resources.

Result Processing Modifiers#

PromoteLastNodeModifier#

The PromoteLastNodeModifier promotes the result of the last node in the network to the main network. It is used by the ChatUSDNetworkNode to ensure that the user sees the final result.

This modifier ensures that the user sees the final result, even if it was generated by a subnetwork.

Specialized Modifiers#

SceneInfoModifier#

The SceneInfoModifier is a specialized modifier used by the USDCodeInteractiveNetworkNode to retrieve scene information before generating code. It calls the SceneInfoNetworkNode to retrieve information about the current USD scene.

This modifier ensures that the USDCodeInteractiveNetworkNode has access to information about the current USD scene before generating code, leading to more accurate and effective code generation.

SceneInfoPromoteLastNodeModifier#

The SceneInfoPromoteLastNodeModifier is a specialized version of the PromoteLastNodeModifier used by the SceneInfoNetworkNode. It promotes code and error messages from subnetworks to the main network.

This modifier ensures that the user sees the final code and any error messages, even if they were generated by a subnetwork, and adds a success message to indicate that the information was retrieved successfully.