Cloud Code Generation Using Repository-Level Context
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current code generation technologies primarily focus on line-level code completion and do not adequately consider repository-level context, leading to poor generation capability and user experience due to the lack of integration with logical structure diagrams and background knowledge.
Innovation Solution
A cloud service-based code generation method that obtains repository-level context information to generate executable code, incorporating logical structure diagrams and background knowledge, allowing for improved code generation capability and user experience.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Manufacturing precision
If line-level code completion technology is used, then code generation can be performed, but repository-level context is lost leading to poor generation capability
Solution Approach 1:
The patent transitions from line-level code completion to repository-level context awareness by introducing a new dimension of context scope. The system retrieves and processes context information from multiple levels (repository, package, class, method) to generate code that is aware of the broader software architecture and existing code structure, thereby resolving the contradiction between simple line-level generation and comprehensive repository-level understanding.
Solution Approach 2:
The patent implements a nested context retrieval mechanism where context information is organized in hierarchical levels (repository → package → class → method). The system retrieves context from multiple nested levels simultaneously, allowing the code generation to consider both detailed local context and broader global context, thus preventing information loss while maintaining generation precision.
2Manufacturing precision
If repository-level context information is obtained, then code generation capability is improved, but system complexity increases
Solution Approach 1:
The patent segments the complex task of retrieving repository-level context into multiple independent steps: determining context scope, retrieving context information, and generating code. The context scope is further segmented into multiple levels (repository, package, class, method), each with its own retrieval mechanism. This segmentation reduces the complexity of handling the entire repository at once while maintaining comprehensive context awareness.
Solution Approach 2:
The system performs preliminary actions by pre-determining the context scope and pre-retrieving relevant context information before the actual code generation. The context scope is determined based on the code generation request, and context information is retrieved in advance, allowing the generation process to focus only on synthesizing the code rather than gathering all necessary context during generation, thus reducing overall system complexity.
3Manufacturing precision
If more context information is retrieved, then generation effectiveness is improved, but processing time increases
Solution Approach 1:
The patent applies partial action by retrieving context information from multiple levels (repository, package, class, method) selectively based on the code generation request. The system determines the appropriate context scope and retrieves only the necessary context information required for the generation task, avoiding unnecessary retrieval of the entire repository context. This balanced approach ensures sufficient context for effective generation while minimizing processing time through selective information gathering.
Data Source
AI summary
A cloud service-based code generation method includes receiving a code generation request, where the code generation request requests to generate first executable code for implementing a first method in a repository; obtaining, from information of the repository based on the code generation request, first context information needed for generating the first executable code; and generating the first executable code based on the first context information and the code generation request.


