Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chatwithcloud

Package Overview
Dependencies
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chatwithcloud - npm Package Compare versions

Comparing version 0.2.4 to 0.2.6

82

dist/openai.js

@@ -29,3 +29,3 @@ "use strict";

process.env.AWS_SDK_JS_SUPPRESS_MAINTENANCE_MODE_MESSAGE = "1";
const systemPrompt = `You are an expert Javascript Programmer and AWS DevOps Engineer. Your job is to answer questions about AWS environment by writing Javascript code using AWS SDK V2. The code must be adhering to a few rules:
const systemPrompt = `Take a deep breath and approach it step by step. You are an expert Javascript Programmer and AWS DevOps Engineer. Your job is to answer questions about AWS environment by writing Javascript code using AWS SDK V2. The code must be adhering to a few rules:

@@ -106,2 +106,3 @@ - Must be preferring promises over callbacks

let generatingCode = false;
consola_1.consola.start("Thinking...");
try {

@@ -124,4 +125,5 @@ const stream = useTrial

const choice = decodedChunk.choices[0];
const contentChunk = (_d = choice.delta) === null || _d === void 0 ? void 0 : _d.content;
const toolCallChunk = (_e = choice === null || choice === void 0 ? void 0 : choice.delta) === null || _e === void 0 ? void 0 : _e.tool_calls;
// Print human readable message
const contentChunk = (_d = choice.delta) === null || _d === void 0 ? void 0 : _d.content;
if (contentChunk) {

@@ -131,4 +133,3 @@ process.stdout.write(contentChunk);

}
const toolCallChunk = (_e = choice === null || choice === void 0 ? void 0 : choice.delta) === null || _e === void 0 ? void 0 : _e.tool_calls;
if (toolCallChunk) {
else if (toolCallChunk) {
if (toolCallChunk[0].id) {

@@ -140,3 +141,3 @@ toolCallId = toolCallChunk[0].id;

if (!generatingCode) {
consola_1.consola.start("Thinking...");
consola_1.consola.start("Talking to cloud...");
generatingCode = true;

@@ -158,35 +159,3 @@ }

for (const parsedArgument of parsedArguments) {
consola_1.consola.start(uppercaseFirstLetter(parsedArgument.explanation || "") + "...");
newMessages.push({
role: "assistant",
content: "",
tool_calls: [
{
function: {
name: "runAwsCode",
arguments: accumulatedToolCallArgumentChunks,
},
type: "function",
id: toolCallId,
},
],
});
try {
const AWS = require("aws-sdk");
const wrappedCode = wrapUserCode(parsedArgument.code);
const result = yield eval(`(async function() { return (async () => { ${wrappedCode} })(); })()`);
newMessages.push({
role: "tool",
content: JSON.stringify(result),
tool_call_id: toolCallId,
});
}
catch (error) {
consola_1.consola.warn("Incorrect code generated! Retrying...", error.message);
newMessages.push({
role: "tool",
content: "Error while running a tool: " + error.message,
tool_call_id: toolCallId,
});
}
yield runTool(parsedArgument, newMessages, accumulatedToolCallArgumentChunks, toolCallId);
}

@@ -233,2 +202,39 @@ }

exports.chat = chat;
function runTool(parsedArgument, newMessages, accumulatedToolCallArgumentChunks, toolCallId) {
return __awaiter(this, void 0, void 0, function* () {
consola_1.consola.start(uppercaseFirstLetter(parsedArgument.explanation || "") + "...");
newMessages.push({
role: "assistant",
content: "",
tool_calls: [
{
function: {
name: "runAwsCode",
arguments: accumulatedToolCallArgumentChunks,
},
type: "function",
id: toolCallId,
},
],
});
try {
const AWS = require("aws-sdk");
const wrappedCode = wrapUserCode(parsedArgument.code);
const result = yield eval(`(async function() { return (async () => { ${wrappedCode} })(); })()`);
newMessages.push({
role: "tool",
content: JSON.stringify(result),
tool_call_id: toolCallId,
});
}
catch (error) {
consola_1.consola.warn("Incorrect code generated! Retrying...", error.message);
newMessages.push({
role: "tool",
content: "Error while running a tool: " + error.message,
tool_call_id: toolCallId,
});
}
});
}
function wrapUserCode(userCode) {

@@ -235,0 +241,0 @@ const project = new ts_morph_1.Project({

{
"name": "chatwithcloud",
"version": "0.2.4",
"version": "0.2.6",
"description": "A CLI to chat with your AWS cloud, literally.",

@@ -5,0 +5,0 @@ "sideEffects": false,

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc