UNPKG

auto-gpt-ts

Version:

my take of Auto-GPT in typescript

34 lines 1.74 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AnalyzeCodeCommand = void 0; const llm_utils_1 = require("../llm/llm-utils"); const command_1 = require("./command"); let AnalyzeCodeCommand = class AnalyzeCodeCommand { /** * A function that takes in a string and returns a response from create chat * completion api call. * @param code Code to be evaluated. * @returns A result string from create chat completion. A list of suggestions to improve the code. */ static analyzeCode(code) { const functionString = "analyzeCode(code: string): Promise<string[]>"; const args = [code]; const descriptionString = ("Analyzes the given code and returns a list of suggestions for improvements."); return (0, llm_utils_1.callAiFunction)(functionString, args, descriptionString); } }; AnalyzeCodeCommand = __decorate([ (0, command_1.CommandDecorator)({ name: 'analyzeCode', description: 'Analyze Code', signature: '"code": string' }) ], AnalyzeCodeCommand); exports.AnalyzeCodeCommand = AnalyzeCodeCommand; //# sourceMappingURL=analyze-code.js.map