|
1 | 1 | This reference documents every object and method available in Kaizen’s SDK and API. |
2 | 2 |
|
3 | | -For a step-by-step guide on how to use Kaizen, check out the [Getting Started](../getting_started). |
| 3 | +For a step-by-step guide on how to use Kaizen, check out the [initial setup guide](/initial_setup_guide). |
4 | 4 |
|
5 | | -## Code Reviewer |
| 5 | +For a quickstart, you can instead checkout [kaizen.cloudcode.ai](https://kaizen.cloudcode.ai) to get started with Kaizen in a few clicks. |
6 | 6 |
|
7 | | -### Class: CodeReviewer |
8 | | - |
9 | | -#### Constructor |
10 | | - |
11 | | -- `__init__(self, llm_provider: LLMProvider)` |
12 | | - Initializes the CodeReviewer with the provided LLM provider. |
13 | | - |
14 | | -#### Methods |
15 | | - |
16 | | -##### review_pull_request |
17 | | - |
18 | | -- `review_pull_request(self, diff_text: str, pull_request_title: str, pull_request_desc: str, pull_request_files: List[Dict], reeval_response: bool = False) -> ReviewData` |
19 | | - Reviews a pull request and generates feedback. |
20 | | - - Parameters: |
21 | | - - `diff_text`: The diff text of the pull request. |
22 | | - - `pull_request_title`: The title of the pull request. |
23 | | - - `pull_request_desc`: The description of the pull request. |
24 | | - - `pull_request_files`: List of files changed in the pull request. |
25 | | - - `reeval_response`: Whether to re-evaluate the response. |
26 | | - - Returns: ReviewData object containing the review results. |
27 | | - |
28 | | -### Class: PRDescriptionGenerator |
29 | | - |
30 | | -#### Constructor |
31 | | - |
32 | | -- `__init__(self, llm_provider: LLMProvider)` |
33 | | - Initializes the PRDescriptionGenerator with the provided LLM provider. |
34 | | - |
35 | | -#### Methods |
36 | | - |
37 | | -##### generate_pull_request_desc |
38 | | - |
39 | | -- `generate_pull_request_desc(self, diff_text: str, pull_request_title: str, pull_request_desc: str, pull_request_files: List[Dict], user: str) -> str` |
40 | | - Generates a description for a pull request. |
41 | | - - Parameters: |
42 | | - - `diff_text`: The diff text of the pull request. |
43 | | - - `pull_request_title`: The title of the pull request. |
44 | | - - `pull_request_desc`: The existing description of the pull request. |
45 | | - - `pull_request_files`: List of files changed in the pull request. |
46 | | - - `user`: The user or context for generating the description. |
47 | | - - Returns: A string containing the generated pull request description. |
48 | | - |
49 | | -## Unit Test generator |
50 | | - |
51 | | - |
52 | | -### Class: UnitTestGenerator |
53 | | - |
54 | | -#### Constructor |
55 | | - |
56 | | -- `__init__(self, verbose=False)` |
57 | | - Initializes the UnitTestGenerator with optional verbosity setting. |
58 | | - |
59 | | -#### Methods |
60 | | - |
61 | | -##### generate_tests_from_dir |
62 | | - |
63 | | -- `generate_tests_from_dir(self, dir_path: str, output_path: str = None)` |
64 | | - Generates unit tests for all supported files in a given directory. |
65 | | - - Parameters: |
66 | | - - `dir_path`: Path of the directory containing source files. |
67 | | - - `max_critique`: Maximum number of critique iterations. |
68 | | - - `output_path`: (Optional) Custom output path for generated tests. |
69 | | - - `verbose`: Enable verbose logging. |
70 | | - - `enable_critique`: Enable AI critique and improvement of generated tests. |
71 | | - - Returns: A tuple containing an empty dictionary and llm usage statistics. |
72 | | - |
73 | | -##### generate_tests |
74 | | - |
75 | | -- `generate_tests(self, file_path: str, content: str = None, max_critique: int = 3, output_path: str = None, verbose: bool = False, enable_critique: bool = False)` |
76 | | - Generates unit tests for a given file with various configuration options. |
77 | | - - Parameters: |
78 | | - - `file_path`: Path of the file relative to the project root. |
79 | | - - `content`: (Optional) File content. |
80 | | - - `max_critique`: Maximum number of critique iterations. |
81 | | - - `output_path`: (Optional) Custom output path for generated tests. |
82 | | - - `verbose`: Enable verbose logging. |
83 | | - - `enable_critique`: Enable AI critique and improvement of generated tests. |
84 | | - - Returns: A tuple containing an empty dictionary and llm usage statistics. |
85 | | - |
86 | | -##### run_tests |
87 | | - |
88 | | -- `run_tests(self) -> Dict` |
89 | | - Runs the generated unit tests and returns the results. |
90 | | - |
91 | | - |
92 | | - |
93 | | -## Code Scanner |
94 | | - |
95 | | -### Class: CodeScanner |
96 | | - |
97 | | -#### Constructor |
98 | | - |
99 | | -- `__init__(self, llm_provider: LLMProvider)` |
100 | | - Initializes the CodeScanner with the provided LLM provider. |
101 | | - |
102 | | -#### Methods |
103 | | - |
104 | | -##### review_code |
105 | | - |
106 | | -- `review_code(self, file_data: str, user: str) -> ReviewData` |
107 | | - Performs a code review on a single file. |
108 | | - - Parameters: |
109 | | - - `file_data`: Content of the file to be reviewed. |
110 | | - - `user`: Username or project identifier. |
111 | | - - Returns: ReviewData object containing the review results. |
112 | | - |
113 | | -##### review_code_dir |
114 | | - |
115 | | -- `review_code_dir(self, dir_path: str, reevaluate: bool = False, user: str) -> ReviewData` |
116 | | - Performs a code review on all files in a directory. |
117 | | - - Parameters: |
118 | | - - `dir_path`: Path to the directory containing the files to be reviewed. |
119 | | - - `reevaluate`: Whether to reevaluate previously scanned files. |
120 | | - - `user`: Username or project identifier. |
121 | | - - Returns: ReviewData object containing the review results for all files. |
122 | | - |
123 | | -## UI Reviewer |
124 | | -### Class: UIReviewer |
125 | | - |
126 | | -#### Constructor |
127 | | - |
128 | | -- `__init__(self, llm_provider: LLMProvider)`: |
129 | | - Initializes the UI Reviewer with the provided LLM provider. |
130 | | - |
131 | | -#### Methods |
132 | | - |
133 | | -##### generate_ui_review |
134 | | - |
135 | | -- `generate_ui_review(self, url: str = None, html_content: str = None) -> Dict` |
136 | | - Performs a UI review on a given URL or HTML code. |
137 | | - - Parameters: |
138 | | - - `url`: URL of the web page to be reviewed. |
139 | | - - `html_code`: HTML code to be reviewed. |
140 | | - - Returns: A dictionary containing the review results. |
141 | | - |
142 | | -## End to End Test Generator |
143 | | - |
144 | | -### Class: E2ETestGenerator |
145 | | - |
146 | | -#### Constructor |
147 | | - |
148 | | -- `__init__(self)` |
149 | | - Initializes the E2ETestGenerator. |
150 | | - |
151 | | -#### Methods |
152 | | - |
153 | | -##### generate_e2e_tests |
154 | | - |
155 | | -- `generate_e2e_tests(self, url: str) -> Tuple[List[Dict], Dict]` |
156 | | - Generates E2E UI tests for the given URL. |
157 | | - - Parameters: |
158 | | - - `url`: URL of the web application to test. |
159 | | - - Returns: A tuple containing a list of generated tests and LLM usage statistics. |
160 | | - |
161 | | -##### run_tests |
162 | | - |
163 | | -- `run_tests(self) -> Dict` |
164 | | - Runs the generated E2E UI tests. |
165 | | - - Returns: A dictionary containing test execution results. |
166 | | - |
167 | | -## Work Summary Generator |
168 | | - |
169 | | -### Class: WorkSummaryGenerator |
170 | | - |
171 | | -#### Constructor |
172 | | - |
173 | | -- `__init__(self)` |
174 | | - Initializes the WorkSummaryGenerator. |
175 | | - |
176 | | -#### Methods |
177 | | - |
178 | | -##### generate_work_summaries |
179 | | - |
180 | | -- `generate_work_summaries(self, file_diffs: List[Dict], user: str) -> Dict` |
181 | | - Generates a work summary from the provided file diffs. |
182 | | - - Parameters: |
183 | | - - `file_diffs`: List of dictionaries containing file diff information. |
184 | | - - `user`: Username or identifier for the user generating the summary. |
185 | | - - Returns: A dictionary containing the generated summary and other relevant information. |
186 | | - |
187 | | -##### generate_twitter_post |
188 | | - |
189 | | -- `generate_twitter_post(self, summary: str, user: str) -> Tuple[str, Dict]` |
190 | | - Generates a Twitter post based on the work summary. |
191 | | - - Parameters: |
192 | | - - `summary`: The generated work summary. |
193 | | - - `user`: Username or identifier for the user generating the post. |
194 | | - - Returns: A tuple containing the generated Twitter post and LLM usage statistics. |
195 | | - |
196 | | -##### generate_linkedin_post |
197 | | - |
198 | | -- `generate_linkedin_post(self, summary: str, user: str) -> Tuple[str, Dict]` |
199 | | - Generates a LinkedIn post based on the work summary. |
200 | | - - Parameters: |
201 | | - - `summary`: The generated work summary. |
202 | | - - `user`: Username or identifier for the user generating the post. |
203 | | - - Returns: A tuple containing the generated LinkedIn post and LLM usage statistics. |
| 7 | +For a deploying Kaizen on your own infrastructure, check out the [self-hosting guide](/self_hosting_guide). |
0 commit comments