mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-20 07:24:21 +01:00
Additional changes: * Improve typing * Modularize message history memory & fix/refactor lots of things * Fix summarization * Move memory relevance calculation to MemoryItem & improve test * Fix import warnings in web_selenium.py * Remove `memory_add` ghost command * Implement overlap in `split_text` * Move memory tests into subdirectory * Remove deprecated `get_ada_embedding()` and helpers * Fix used token calculation in `chat_with_ai` * Replace Message TypedDict by dataclass * Fix AgentManager singleton issues in tests --------- Co-authored-by: Auto-GPT-Bot <github-bot@agpt.co>
32 lines
867 B
Python
32 lines
867 B
Python
"""Code evaluation module."""
|
|
from __future__ import annotations
|
|
|
|
from autogpt.commands.command import command
|
|
from autogpt.llm.utils import call_ai_function
|
|
|
|
|
|
@command(
|
|
"analyze_code",
|
|
"Analyze Code",
|
|
'"code": "<full_code_string>"',
|
|
)
|
|
def analyze_code(code: str) -> list[str]:
|
|
"""
|
|
A function that takes in a string and returns a response from create chat
|
|
completion api call.
|
|
|
|
Parameters:
|
|
code (str): Code to be evaluated.
|
|
Returns:
|
|
A result string from create chat completion. A list of suggestions to
|
|
improve the code.
|
|
"""
|
|
|
|
function_string = "def analyze_code(code: str) -> list[str]:"
|
|
args = [code]
|
|
description_string = (
|
|
"Analyzes the given code and returns a list of suggestions for improvements."
|
|
)
|
|
|
|
return call_ai_function(function_string, args, description_string)
|