New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

iudex

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

iudex - npm Package Compare versions

Comparing version 0.6.3 to 0.7.0

16

dist/index.d.ts

@@ -197,2 +197,15 @@ import OpenAI from 'openai';

declare function startWorkflow(baseUrl: string, apiKey: string): (query: string, modules?: string) => Promise<StartWorkflowRes>;
type FunctionJson = {
name: string;
description?: string;
parameters?: Record<string, any>;
returns?: Record<string, any>;
usageExample?: string;
returnsExample?: string;
};
type putFunctionJsonsReq = {
jsons: FunctionJson[];
module?: string;
};
declare function putFunctionJsons(baseUrl: string, apiKey: string): (jsons: FunctionJson[], module?: string) => Promise<void>;

@@ -225,2 +238,3 @@ declare const DEFAULT_BASE_URL = "https://5pz08znmzj.execute-api.us-west-2.amazonaws.com";

});
uploadFunctions: (jsons: Array<OpenAI.ChatCompletionCreateParams.Function>, modules?: string) => Promise<void>;
chatCompletionsCreate: (body: OpenAI.ChatCompletionCreateParamsNonStreaming & {

@@ -246,2 +260,2 @@ messages: Array<ChatCompletionMessageWithIudex>;

export { type ChatCompletionMessageWithIudex, type ChatCompletionWithIudex, DEFAULT_BASE_URL, Iudex, type IudexMessage, type NextMessageRes, type ReturnFunctionCallBody, type ReturnFunctionCallRes, type StartWorkflowRes, Iudex as default, extractMessageTextContent, mapIudexToOpenAi, nextMessage, returnFunctionCall, startWorkflow };
export { type ChatCompletionMessageWithIudex, type ChatCompletionWithIudex, DEFAULT_BASE_URL, Iudex, type IudexMessage, type NextMessageRes, type ReturnFunctionCallBody, type ReturnFunctionCallRes, type StartWorkflowRes, Iudex as default, extractMessageTextContent, mapIudexToOpenAi, nextMessage, putFunctionJsons, type putFunctionJsonsReq, returnFunctionCall, startWorkflow };

38

dist/index.js

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

nextMessage: () => nextMessage,
putFunctionJsons: () => putFunctionJsons,
returnFunctionCall: () => returnFunctionCall,

@@ -43,6 +44,3 @@ startWorkflow: () => startWorkflow

function throwOnApiError(json) {
if (!json) {
return json;
}
if (json.message === "Service Unavailable") {
if (json?.message === "Service Unavailable") {
throw Error(json.message);

@@ -53,3 +51,3 @@ }

function unwrapApi(json) {
if (json && json.body && typeof json.body === "string" && json.body.startsWith("{") && json.body.endsWith("}")) {
if (json?.body && typeof json.body === "string" && json.body.startsWith("{") && json.body.endsWith("}")) {
return JSON.parse(json.body);

@@ -72,3 +70,3 @@ }

method: "PUT",
headers: { Authorization: `Bearer ${apiKey}` },
headers: { "x-api-key": `${apiKey}` },
body: JSON.stringify(bodyJson)

@@ -82,3 +80,3 @@ }).then(parseIudexResponse);

method: "GET",
headers: { Authorization: `Bearer ${apiKey}` }
headers: { "x-api-key": `${apiKey}` }
}).then(parseIudexResponse);

@@ -91,3 +89,3 @@ };

method: "POST",
headers: { Authorization: `Bearer ${apiKey}` },
headers: { "x-api-key": `${apiKey}` },
body: JSON.stringify({ query, modules })

@@ -97,2 +95,12 @@ }).then(parseIudexResponse);

}
function putFunctionJsons(baseUrl, apiKey) {
return function(jsons, module2) {
const bodyJson = { jsons, module: module2 };
return fetch(baseUrl + "/function_jsons", {
method: "PUT",
headers: { "x-api-key": `${apiKey}` },
body: JSON.stringify(bodyJson)
}).then(parseIudexResponse);
};
}

@@ -141,2 +149,6 @@ // src/utils.ts

}
uploadFunctions = (jsons, modules) => {
return putFunctionJsons(this.baseUrl, this.apiKey)(jsons, modules);
};
// OpenAI interface shim
chatCompletionsCreate = (body) => {

@@ -164,4 +176,5 @@ const lastMessage = body.messages[body.messages.length - 1];

}
return startWorkflow(this.baseUrl, this.apiKey)(extractMessageTextContent(lastMessage.content)).then(({ workflowId }) => poll(nextMessage(this.baseUrl, this.apiKey), [workflowId]).then(
(r) => {
const messageContent = extractMessageTextContent(lastMessage.content);
return startWorkflow(this.baseUrl, this.apiKey)(messageContent).then(
({ workflowId }) => poll(nextMessage(this.baseUrl, this.apiKey), [workflowId]).then((r) => {
return {

@@ -171,4 +184,4 @@ model: body.model,

};
}
));
})
);
};

@@ -239,2 +252,3 @@ chat = {

nextMessage,
putFunctionJsons,
returnFunctionCall,

@@ -241,0 +255,0 @@ startWorkflow

{
"name": "iudex",
"version": "0.6.3",
"version": "0.7.0",
"description": "Iudex client",
"scripts": {
"build": "tsup",
"test": "jest"
},
"main": "./dist/index.js",

@@ -41,7 +45,3 @@ "module": "./dist/index.mjs",

"zod": "^3.22.4"
},
"scripts": {
"build": "tsup",
"test": "jest"
}
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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