* Pi's message.

* Fix most everything.

* Blacked

* Add Typing, Docstrings everywhere, organize the code a bit.

* Black

* fix import

* Update message, dedupe.

* Increase backoff time.

* bump up retries
This commit is contained in:
BillSchumacher
2023-04-15 07:56:23 -05:00
committed by GitHub
parent e986af5de0
commit 1073954fb7
64 changed files with 2254 additions and 1883 deletions

View File

@@ -0,0 +1,29 @@
"""A module that contains a function to generate test cases for the submitted code."""
import json
from typing import List
from autogpt.llm_utils import call_ai_function
def write_tests(code: str, focus: List[str]) -> str:
"""
A function that takes in code and focus topics and returns a response from create
chat completion api call.
Parameters:
focus (List): A list of suggestions around what needs to be improved.
code (str): Code for test cases to be generated against.
Returns:
A result string from create chat completion. Test cases for the submitted code
in response.
"""
function_string = (
"def create_test_cases(code: str, focus: Optional[str] = None) -> str:"
)
args = [code, json.dumps(focus)]
description_string = (
"Generates test cases for the existing code, focusing on"
" specific areas if required."
)
return call_ai_function(function_string, args, description_string)