Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add codexgraph Readme #569

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 74 additions & 8 deletions apps/codexgraph_agent/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
# 🌟✨ CodexGraph 🌟✨

<p align="center">
<img src="img/framework.png" alt="framework" width="800px"/>
</p>
<p align="center">
<img src="codexgraph.png" alt="image-20240719171906628" width="200px"/>
<a href="https://www.arxiv.org/abs/2408.03910"><strong>ArXiv Paper</strong></a>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="https://laptype.github.io/CodexGraph-page/"><strong>Webpage</strong></a>
</p>




## 📘 Introduction
**CodexGraph Agent** is an advanced multi-tasking agent that integrates a language model (LM) agent with a code graph database interface. By utilizing the structural characteristics of graph databases and the versatility of the Cypher query language, CodexGraph enables the LM agent to formulate and execute multi-step queries. This capability allows for precise context retrieval and code navigation that is aware of the code's structure.
**CodexGraph** is an advanced multi-tasking agent that integrates a language model (LM) agent with a code graph database interface. By utilizing the structural characteristics of graph databases and the versatility of the Cypher query language, CodexGraph enables the LM agent to formulate and execute multi-step queries. This capability allows for precise context retrieval and code navigation that is aware of the code's structure.



## 🚀 How to Use

Expand Down Expand Up @@ -55,16 +66,71 @@ python apps\codexgraph_agent\run.py
```

## 📂 Example Usage
### 📑 code summary:
TBD
### 📑 code chat:
**Code Chat** allows users to inquire about a code repository, providing insights into code structure and function usage. This functionality is particularly useful for understanding complex codebases, identifying dependencies, and exploring the usage of specific classes, methods, and functions.

Here is an example of **Code Chat**. The user's question is: "Summarize the `CodexGraphAgentChat` class, what methods it has, and what they are for."

<img src="img/README/code_chat2.png" alt="code chat" style="display: block; margin: 0 auto;" />

Once the necessary information is gathered, **Code Chat** constructs a comprehensive response to the user’s question. This response includes a summary of the `CodexGraphAgentChat` class, a list of its methods, and a description of what each method does.

### 🔍 code debug:
TBD

The **Code Debugger** diagnoses and resolves bugs by applying iterative reasoning and information retrieval to suggest targeted fixes. It utilizes Cypher queries to analyze the code repository, identify the cause of the issue, and recommend precise modifications.

Here is an example of **Code Debugger**. The user’s input is a real issue where the outcome does not match the expected behavior. The **Code Debugger** first analyzes the problem, then uses Cypher queries to retrieve relevant information and infer the cause of the bug. Finally, it provides an explanation of the bug and suggests the location for the modification.

<img src="img/README/code_debug_0.png" alt="code debug" style="display: block; margin: 0 auto;" />

Identifying the precise location of the bug in the codebase and providing a detailed explanation of the issue and the underlying cause of the bug.

![code_debug_7](img/README/code_debug_7.png)

![code_debug_8](img/README/code_debug_8.png)

Finally, **Code Debugger** will suggest modifications to ensure the bug is resolved.

![code_debug_9](img/README/code_debug_9.png)





### 📑 code add comment:
TBD
The **Code Commentor** analyzes code to provide detailed comments, enhancing code readability and maintainability. It leverages the code graph database to understand the code’s structure and behavior, ensuring accurate and informative comments.

![code_commentor1](img/README/code_commentor1.png)

By using Cypher queries, the specific implementation of the return function was obtained, and the return type was clarified.

![code_commentor2](img/README/code_commentor2.png)



### 📑 code generate:
TBD

The user has requested a function to retrieve the number of input and output tokens of `CypherAgent`. However, the challenge is identifying the corresponding fields within `CypherAgent` as this information is not provided in the user’s input.

![code_gen0](img/README/code_gen0.png)

First, **Code Generator** will consider the thought process in determining how to identify the relevant fields. Then, by using Cypher queries, it was discovered that the corresponding fields are `input_token_num` and `output_token_num`, which enables the generation of the correct code.

![code_gen1](img/README/code_gen1.png)



### 📑 code add unit-test:
TBD



Here is an example of **Code Unittestor**. The user’s input is: "Generate test cases for `TaskManager`." The **Code Unittestor** will first retrieve all methods and inheritance relationships in `TaskManager`, and then generate detailed test case code.



**Code Unittestor** will generate detailed unit test code for the `TaskManager` class, covering its methods and inheritance relationships.

![code_unittester](img/README/code_unittester.png)

## Future work
1. Streaming output the llm output
Expand Down
Binary file added apps/codexgraph_agent/img/README/code_chat2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/codexgraph_agent/img/README/code_debug_7.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/codexgraph_agent/img/README/code_debug_8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/codexgraph_agent/img/README/code_debug_9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/codexgraph_agent/img/README/code_gen0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/codexgraph_agent/img/README/code_gen1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/codexgraph_agent/img/framework.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading