chatgpt-optimized-official
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -264,7 +264,7 @@ import axios from "axios"; | ||
if (response.data.choices[0]['message']['content']) { | ||
if (response.data.choices[0]['message']['tool_calls']) { | ||
if (response.data.choices[0].finish_reason == "tool_calls") { | ||
conversation.messages.push({ | ||
id: randomUUID(), | ||
content: response.data.choices[0]['message']['content'], | ||
type: MessageType.Function, | ||
type: MessageType.Assistant, | ||
date: Date.now(), | ||
@@ -271,0 +271,0 @@ name: function_name, |
@@ -9,3 +9,3 @@ import { ChatGPT, Assistant } from "../dist/index.js"; | ||
let bot = new ChatGPT(process.env.OPENAI_API_KEY, { | ||
let bot = new ChatGPT("", { | ||
temperature: 0.7, // OpenAI parameter | ||
@@ -71,24 +71,6 @@ max_tokens: 256, // OpenAI parameter [Max response size by tokens] | ||
} | ||
}, | ||
{ | ||
"type": "function", | ||
"function": { | ||
"name": "saveDataPayment", | ||
"description": "Guarda la información del pago del cliente", | ||
"parameters": { | ||
"type": "object", | ||
"properties": { | ||
"payType": { "type": "string", "enum": ["efectivo", "pago movil", "transferencia bancaria", "binance", "zelle"] }, | ||
"voucher": { | ||
"type": "string", | ||
"description": "texto comprobante de pago", | ||
} | ||
} | ||
] | ||
}, | ||
"required": ["payType"], | ||
} | ||
} | ||
}] | ||
} | ||
@@ -111,9 +93,14 @@ ); | ||
process.stdout.write("ChatGPT: "); | ||
await bot.askPost(res => { | ||
let response = await bot.askPost(res => { | ||
process.stdout.write(res.toString()); | ||
}, _ => { }, prompt, "3236385"); | ||
//console.log(); | ||
console.log("response new", response); | ||
if(response.finish_reason=="tool_calls"){ | ||
let response2=await bot.askV1("orden creada", "3236385", 3, "createOrder", response.message.tool_calls[0].id); | ||
process.stdout.write(response2.toString()); | ||
} | ||
} | ||
} | ||
main(); |
{ | ||
"name": "chatgpt-optimized-official", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "ChatGPT Client using official OpenAI API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -334,7 +334,7 @@ import axios from "axios"; | ||
if(response.data.choices[0]['message']['content']) { | ||
if(response.data.choices[0]['message']['tool_calls']){ | ||
if(response.data.choices[0].finish_reason=="tool_calls"){ | ||
conversation.messages.push({ | ||
id: randomUUID(), | ||
content: response.data.choices[0]['message']['content'], | ||
type: MessageType.Function, | ||
type: MessageType.Assistant, | ||
date: Date.now(), | ||
@@ -465,3 +465,3 @@ name: function_name, | ||
} | ||
return messages; // Devolver los mensajes generados | ||
@@ -468,0 +468,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
487901
2548