@singlestore/ai
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -8,3 +8,6 @@ import { ChatCompletionMessageParam } from 'openai/resources/chat/completions'; | ||
type ChatCompletionStream = AsyncGenerator<ChatCompletionChunk>; | ||
type ChatCompletionMessage = ChatCompletionMessageParam; | ||
type ChatCompletionMessage = { | ||
role: ChatCompletionMessageParam["role"]; | ||
content: string; | ||
}; | ||
interface CreateChatCompletionOptions { | ||
@@ -14,3 +17,3 @@ model?: string; | ||
stream?: boolean; | ||
history?: ChatCompletionMessage[]; | ||
messages?: ChatCompletionMessage[]; | ||
} | ||
@@ -17,0 +20,0 @@ type CreateChatCompletionResult<T extends CreateChatCompletionOptions = CreateChatCompletionOptions> = T extends { |
@@ -69,6 +69,6 @@ "use strict"; | ||
async create(prompt, options) { | ||
const { systemRole = "You are a helpful assistant", history = [], ..._options } = options ?? {}; | ||
const messages = _options?.messages || [ | ||
const { systemRole = "You are a helpful assistant", messages = [], ..._options } = options ?? {}; | ||
const _messages = [ | ||
{ role: "system", content: systemRole }, | ||
...history || [], | ||
...messages || [], | ||
{ role: "user", content: prompt } | ||
@@ -80,3 +80,3 @@ ]; | ||
..._options, | ||
messages | ||
messages: _messages | ||
}); | ||
@@ -83,0 +83,0 @@ if (typeof response === "object" && response && "choices" in response) { |
{ | ||
"name": "@singlestore/ai", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"license": "Apache-2.0", | ||
@@ -27,3 +27,3 @@ "sideEffects": false, | ||
"dependencies": { | ||
"openai": "^4.53.2" | ||
"openai": "^4.55.7" | ||
}, | ||
@@ -30,0 +30,0 @@ "devDependencies": { |
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
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
30824
283
Updatedopenai@^4.55.7