Closed Torantulino closed 4 months ago
The code changes look good overall, but I noticed a few things that could be improved:
In ai_extractor.py
, the create_item
method is empty and just passes. It would be better to either implement the database storage logic or add a TODO comment indicating that it needs to be implemented in the future.
In code_validation.py
, there is an empty pass
statement in the if not func.function_id:
block. It would be helpful to add a comment explaining what should happen in that case or why it's being skipped for now.
In database.py
, the get_ids_from_function_id_and_compiled_route
function has a lot of nested includes when fetching the function and compiled route. While this may be necessary to get all the required data, it could impact performance if the function is called frequently. Consider optimizing the queries if needed.
The retry.j2
and user.j2
prompt templates in codex/prompts/gpt-4-0125-preview/validate/documentation_extractor/
have the same content. If this is intentional, it's fine, but if they are meant to be different, make sure to update one of them.
The system.j2
prompt template is empty. If it's not needed, consider removing the file. If it's meant to have content, make sure to add it.
It would be helpful to add some comments or docstrings in the get_ids_from_function_id_and_compiled_route
function to explain what it does and what the expected inputs and outputs are.
Overall, the changes introduce a new DocumentationExtractor
class and update the error enhancement logic to extract relevant documentation using the LLM. The get_ids_from_function_id_and_compiled_route
function is added to fetch the necessary IDs for the LLM invocation. The code is well-structured and follows good practices, with just a few minor suggestions for improvement.
Lots of Love,
Clade Opus
In ai_extractor.py, the create_item method is empty and just passes
- yep. I'm not really sure what was supposed to be there but it seems to work.In code_validation.py, there is an empty pass statement in the if not func.function_id: block.
- Not sure about this one, I left a comment for @ntindle In database.py, the get_ids_from_function_id_and_compiled_route function has a lot of nested includes when fetching the function and compiled route.
- Noted, but that's fine for nowThe retry.j2 and user.j2 prompt templates in codex/prompts/gpt-4-0125-preview/validate/documentation_extractor/ have the same content.
That's intentional. As we improve the system we might want to do something different here, but right now it can't really fail so it wont trigger.The system.j2 prompt template is empty
- Intentional, didn't want a system prompt, wasn't sure if I needed the file.I'm seriously impressed with Claude Opus's PR Reviews...!
Instead of sending entire ReadMe in Enhanced Error Message, this PR uses an AI Block to extract information from the docs using an LLM.
This may be simple and a bit crude, but in playground testing this produces good results.
(real) Example Response that would be sent to the LLM on failure to use a module correctly:
To fix the error "ChatCompletion" is not a known member of module "openai", you should use the following code instead:
The documentation shows that the correct way to create a chat completion is by calling client.chat.completions.create() with the appropriate parameters, not openai.ChatCompletion.create().