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

@singlestore/ai

Package Overview
Dependencies
Maintainers
0
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@singlestore/ai - npm Package Compare versions

Comparing version 0.0.26 to 0.0.27

46

dist/index.d.ts

@@ -7,2 +7,12 @@ import z$1, { z } from 'zod';

interface ChatCompletion {
content: string;
}
type ChatCompletionStream = AsyncGenerator<ChatCompletion>;
type OnChatCompletionChunk = (chunk: ChatCompletion) => Promise<void> | void;
interface ChatCompletionMessage {
role: Extract<ChatCompletionMessageParam["role"], "system" | "assistant" | "user">;
content: string | null;
}
type ChatCompletionToolCall<T extends string, U extends z.AnyZodObject | undefined, K> = (params: U extends z.AnyZodObject ? z.infer<U> : void) => Promise<{

@@ -29,11 +39,2 @@ name: T;

interface ChatCompletion {
content: string;
}
type ChatCompletionStream = AsyncGenerator<ChatCompletion>;
type OnChatCompletionChunk = (chunk: ChatCompletion) => Promise<void> | void;
interface ChatCompletionMessage {
role: Extract<ChatCompletionMessageParam["role"], "system" | "assistant" | "user">;
content: string | null;
}
interface CreateChatCompletionParams<TStream extends boolean | undefined, TChatCompletionTool extends AnyChatCompletionTool[] | undefined> {

@@ -54,3 +55,3 @@ prompt?: string;

type CreateChatCompletionResult<TStream extends boolean | undefined> = TStream extends true ? ChatCompletionStream : ChatCompletion;
declare abstract class ChatCompletions<TChatCompletionTool extends AnyChatCompletionTool[] | undefined> {
declare abstract class ChatCompletionsManager<TChatCompletionTool extends AnyChatCompletionTool[] | undefined> {
tools: TChatCompletionTool;

@@ -69,3 +70,3 @@ initTools(tools: TChatCompletionTool): void;

}
declare class OpenAIChatCompletions<TChatCompletionTool extends AnyChatCompletionTool[] | undefined> extends ChatCompletions<TChatCompletionTool> {
declare class OpenAIChatCompletions<TChatCompletionTool extends AnyChatCompletionTool[] | undefined> extends ChatCompletionsManager<TChatCompletionTool> {
private _openai;

@@ -78,6 +79,7 @@ constructor(_openai: OpenAI);

type Embedding = number[];
interface CreateEmbeddingsParams {
model?: string;
}
declare abstract class Embeddings {
declare abstract class EmbeddingsManager {
abstract getModels(): string[];

@@ -92,3 +94,3 @@ abstract create(input: string | string[], params?: CreateEmbeddingsParams): Promise<Embedding[]>;

}
declare class OpenAIEmbeddings extends Embeddings {
declare class OpenAIEmbeddingsManager extends EmbeddingsManager {
private _openai;

@@ -126,15 +128,15 @@ constructor(_openai: OpenAI);

interface AIConfig<TEmbeddings extends Embeddings, TChatCompletionTool extends AnyChatCompletionTool[] | undefined, TChatCompletion extends ChatCompletions<TChatCompletionTool>> {
interface AIConfig<TChatCompletionTools extends AnyChatCompletionTool[] | undefined, TChatCompletionsManager extends ChatCompletionsManager<TChatCompletionTools>, TEmbeddingsManager extends EmbeddingsManager> {
openAIApiKey?: string;
embeddings?: TEmbeddings;
chatCompletions?: TChatCompletion;
chatCompletionTools?: TChatCompletionTool;
chatCompletionTools?: TChatCompletionTools;
chatCompletionsManager?: TChatCompletionsManager;
embeddingsManager?: TEmbeddingsManager;
}
type AnyAI = AI<Embeddings, AnyChatCompletionTool[] | undefined, ChatCompletions<any>>;
declare class AI<TEmbeddings extends Embeddings = OpenAIEmbeddings, TChatCompletionTool extends AnyChatCompletionTool[] | undefined = undefined, TChatCompletions extends ChatCompletions<any> = OpenAIChatCompletions<TChatCompletionTool>> {
embeddings: TEmbeddings;
type AnyAI = AI<AnyChatCompletionTool[] | undefined, ChatCompletionsManager<any>, EmbeddingsManager>;
declare class AI<TChatCompletionTools extends AnyChatCompletionTool[] | undefined = undefined, TChatCompletions extends ChatCompletionsManager<any> = OpenAIChatCompletions<TChatCompletionTools>, TEmbeddingsManager extends EmbeddingsManager = OpenAIEmbeddingsManager> {
embeddings: TEmbeddingsManager;
chatCompletions: TChatCompletions;
constructor(config: AIConfig<TEmbeddings, TChatCompletionTool, TChatCompletions>);
constructor(config: AIConfig<TChatCompletionTools, TChatCompletions, TEmbeddingsManager>);
}
export { AI, type AIConfig, type AnyAI, type AnyChatCompletionTool, type ChatCompletion, type ChatCompletionMessage, type ChatCompletionStream, ChatCompletionTool, type ChatCompletionToolCall, ChatCompletions, type CreateChatCompletionParams, type CreateChatCompletionResult, type CreateEmbeddingsParams, type Embedding, Embeddings, type MergeChatCompletionTools, MessageLengthExceededError, MessagesLengthExceededError, type OnChatCompletionChunk, type OpenAIChatCompletionModel, OpenAIChatCompletions, type OpenAICreateChatCompletionParams, type OpenAICreateEmbeddingsParams, type OpenAIEmbeddingModel, OpenAIEmbeddings, parseLengthErrorMessage };
export { AI, type AIConfig, type AnyAI, type AnyChatCompletionTool, type ChatCompletion, type ChatCompletionMessage, type ChatCompletionStream, ChatCompletionTool, type ChatCompletionToolCall, ChatCompletionsManager, type CreateChatCompletionParams, type CreateChatCompletionResult, type CreateEmbeddingsParams, type Embedding, EmbeddingsManager, type MergeChatCompletionTools, MessageLengthExceededError, MessagesLengthExceededError, type OnChatCompletionChunk, type OpenAIChatCompletionModel, OpenAIChatCompletions, type OpenAICreateChatCompletionParams, type OpenAICreateEmbeddingsParams, type OpenAIEmbeddingModel, OpenAIEmbeddingsManager, parseLengthErrorMessage };

@@ -35,4 +35,4 @@ "use strict";

ChatCompletionTool: () => ChatCompletionTool,
ChatCompletions: () => ChatCompletions,
Embeddings: () => Embeddings,
ChatCompletionsManager: () => ChatCompletionsManager,
EmbeddingsManager: () => EmbeddingsManager,
MessageLengthExceededError: () => MessageLengthExceededError,

@@ -45,4 +45,4 @@ MessagesLengthExceededError: () => MessagesLengthExceededError,

// src/chat-completions/index.ts
var ChatCompletions = class {
// src/chat-completions/manager.ts
var ChatCompletionsManager = class {
tools = void 0;

@@ -101,3 +101,3 @@ initTools(tools) {

// src/chat-completions/openai.ts
var OpenAIChatCompletions = class extends ChatCompletions {
var OpenAIChatCompletions = class extends ChatCompletionsManager {
constructor(_openai) {

@@ -282,8 +282,8 @@ super();

// src/embeddings/index.ts
var Embeddings = class {
// src/embeddings/manager.ts
var EmbeddingsManager = class {
};
// src/embeddings/openai.ts
var OpenAIEmbeddings = class extends Embeddings {
var OpenAIEmbeddingsManager = class extends EmbeddingsManager {
constructor(_openai) {

@@ -309,4 +309,4 @@ super();

const openai = new import_openai2.OpenAI({ apiKey: config.openAIApiKey });
this.embeddings = config.embeddings ?? new OpenAIEmbeddings(openai);
this.chatCompletions = config.chatCompletions ?? new OpenAIChatCompletions(openai);
this.chatCompletions = config.chatCompletionsManager ?? new OpenAIChatCompletions(openai);
this.embeddings = config.embeddingsManager ?? new OpenAIEmbeddingsManager(openai);
if (config.chatCompletionTools?.length) {

@@ -321,4 +321,4 @@ this.chatCompletions.initTools(config.chatCompletionTools);

ChatCompletionTool,
ChatCompletions,
Embeddings,
ChatCompletionsManager,
EmbeddingsManager,
MessageLengthExceededError,

@@ -325,0 +325,0 @@ MessagesLengthExceededError,

{
"name": "@singlestore/ai",
"version": "0.0.26",
"version": "0.0.27",
"license": "Apache-2.0",

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

@@ -117,3 +117,3 @@ # SingleStoreAI

class CustomChatCompletions<
class CustomChatCompletionsManager<
TChatCompletionTool extends AnyChatCompletionTool[] | undefined,

@@ -140,3 +140,3 @@ > extends ChatCompletions<TChatCompletionTool> {

openAIApiKey: "<OPENAI_API_KEY>",
chatCompletions: new CustomChatCompletions(),
chatCompletions: new CustomChatCompletionsManager(),
});

@@ -152,3 +152,3 @@ ```

class CustomEmbeddings extends Embeddings {
class CustomEmbeddingsManager extends Embeddings {
constructor() {

@@ -171,4 +171,4 @@ super();

openAIApiKey: "<OPENAI_API_KEY>",
embeddings: new CustomEmbeddings(),
embeddings: new CustomEmbeddingsManager(),
});
```

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