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

@adminforth/completion-adapter-open-ai-chat-gpt

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@adminforth/completion-adapter-open-ai-chat-gpt - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

7

dist/index.js

@@ -34,2 +34,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

const data = yield resp.json();
if (data.error) {
return { error: data.error.message };
}
return {

@@ -41,3 +44,5 @@ content: data.choices[0].message.content,

this.options = options;
if (!options.openAiApiKey) {
}
validate() {
if (!this.options.openAiApiKey) {
throw new Error("openAiApiKey is required");

@@ -44,0 +49,0 @@ }

16

index.ts

@@ -1,2 +0,1 @@

import { da } from "@faker-js/faker";
import type { AdapterOptions } from "./types.js";

@@ -12,3 +11,6 @@ import type { CompletionAdapter } from "adminforth";

this.options = options;
if (!options.openAiApiKey) {
}
validate() {
if (!this.options.openAiApiKey) {
throw new Error("openAiApiKey is required");

@@ -18,3 +20,7 @@ }

complete = async (content: string, stop = ["."], maxTokens = 50) => {
complete = async (content: string, stop = ["."], maxTokens = 50): Promise<{
content?: string;
finishReason?: string;
error?: string;
}> => {
const resp = await fetch("https://api.openai.com/v1/chat/completions", {

@@ -40,3 +46,5 @@ method: "POST",

const data = await resp.json();
if (data.error) {
return { error: data.error.message };
}
return {

@@ -43,0 +51,0 @@ content: data.choices[0].message.content,

{
"name": "@adminforth/completion-adapter-open-ai-chat-gpt",
"version": "1.0.1",
"version": "1.0.2",
"main": "dist/index.js",

@@ -5,0 +5,0 @@ "types": "dist/index.d.ts",

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