smoltalk 0.0.3 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/classes/ToolCall.d.ts +11 -0
  2. package/dist/classes/ToolCall.js +33 -0
  3. package/dist/classes/message/AssistantMessage.d.ts +32 -0
  4. package/dist/classes/message/AssistantMessage.js +56 -0
  5. package/dist/classes/message/BaseMessage.d.ts +12 -0
  6. package/dist/classes/message/BaseMessage.js +2 -0
  7. package/dist/classes/message/DeveloperMessage.d.ts +20 -0
  8. package/dist/classes/message/DeveloperMessage.js +33 -0
  9. package/dist/classes/message/SystemMessage.d.ts +20 -0
  10. package/dist/classes/message/SystemMessage.js +33 -0
  11. package/dist/classes/message/ToolMessage.d.ts +23 -0
  12. package/dist/classes/message/ToolMessage.js +51 -0
  13. package/dist/classes/message/UserMessage.d.ts +19 -0
  14. package/dist/classes/message/UserMessage.js +31 -0
  15. package/dist/classes/message/index.d.ts +38 -0
  16. package/dist/classes/message/index.js +26 -0
  17. package/dist/client.d.ts +1 -1
  18. package/dist/client.js +7 -4
  19. package/dist/clients/baseClient.d.ts +5 -0
  20. package/dist/clients/baseClient.js +14 -0
  21. package/dist/clients/google.d.ts +4 -3
  22. package/dist/clients/google.js +41 -23
  23. package/dist/clients/openai.d.ts +3 -2
  24. package/dist/clients/openai.js +17 -11
  25. package/dist/index.d.ts +1 -0
  26. package/dist/index.js +1 -0
  27. package/dist/logger.d.ts +2 -0
  28. package/dist/logger.js +10 -0
  29. package/dist/models.d.ts +178 -8
  30. package/dist/models.js +98 -4
  31. package/dist/types.d.ts +18 -19
  32. package/dist/util/common.d.ts +54 -0
  33. package/dist/util/common.js +75 -0
  34. package/dist/util/openai.d.ts +0 -2
  35. package/dist/util/openai.js +0 -7
  36. package/package.json +1 -1
@@ -0,0 +1,11 @@
1
+ export type ToolCallOptions = {};
2
+ export declare class ToolCall {
3
+ private _id;
4
+ private _name;
5
+ private _arguments;
6
+ private logger;
7
+ constructor(id: string, name: string, args: Record<string, any> | string, options?: ToolCallOptions);
8
+ get id(): string;
9
+ get name(): string;
10
+ get arguments(): Record<string, any>;
11
+ }
@@ -0,0 +1,33 @@
1
+ import { getLogger } from "../logger.js";
2
+ export class ToolCall {
3
+ _id;
4
+ _name;
5
+ _arguments;
6
+ logger;
7
+ constructor(id, name, args, options = {}) {
8
+ this._id = id;
9
+ this._name = name;
10
+ this.logger = getLogger();
11
+ if (typeof args === "string") {
12
+ try {
13
+ this._arguments = JSON.parse(args);
14
+ }
15
+ catch (e) {
16
+ this.logger.error(`Failed to parse arguments for ToolCall ${name} with id ${id}:`, e, args);
17
+ this._arguments = {};
18
+ }
19
+ }
20
+ else {
21
+ this._arguments = args;
22
+ }
23
+ }
24
+ get id() {
25
+ return this._id;
26
+ }
27
+ get name() {
28
+ return this._name;
29
+ }
30
+ get arguments() {
31
+ return this._arguments;
32
+ }
33
+ }
@@ -0,0 +1,32 @@
1
+ import { BaseMessage, MessageClass } from "./BaseMessage.js";
2
+ import { TextPart } from "../../types.js";
3
+ import { ChatCompletionMessageParam } from "openai/resources";
4
+ import { Content } from "@google/genai";
5
+ export declare class AssistantMessage extends BaseMessage implements MessageClass {
6
+ _role: "assistant";
7
+ _content: string | Array<TextPart> | null;
8
+ _name?: string;
9
+ _audio?: any | null;
10
+ _function_call?: any | null;
11
+ _refusal?: string | null;
12
+ _tool_calls?: Array<any>;
13
+ _rawData?: any;
14
+ constructor(content: string | Array<TextPart> | null, options?: {
15
+ name?: string;
16
+ audio?: any | null;
17
+ function_call?: any | null;
18
+ refusal?: string | null;
19
+ tool_calls?: Array<any>;
20
+ rawData?: any;
21
+ });
22
+ get content(): string;
23
+ get role(): "assistant";
24
+ get name(): string | undefined;
25
+ get audio(): any | null | undefined;
26
+ get function_call(): any | null | undefined;
27
+ get refusal(): string | null | undefined;
28
+ get tool_calls(): Array<any> | undefined;
29
+ get rawData(): any;
30
+ toOpenAIMessage(): ChatCompletionMessageParam;
31
+ toGoogleMessage(): Content;
32
+ }
@@ -0,0 +1,56 @@
1
+ import { BaseMessage } from "./BaseMessage.js";
2
+ export class AssistantMessage extends BaseMessage {
3
+ _role = "assistant";
4
+ _content;
5
+ _name;
6
+ _audio;
7
+ _function_call;
8
+ _refusal;
9
+ _tool_calls;
10
+ _rawData;
11
+ constructor(content, options = {}) {
12
+ super();
13
+ this._content = content;
14
+ this._name = options.name;
15
+ this._audio = options.audio;
16
+ this._function_call = options.function_call;
17
+ this._refusal = options.refusal;
18
+ this._tool_calls = options.tool_calls;
19
+ this._rawData = options.rawData;
20
+ }
21
+ get content() {
22
+ if (this._content === null || this._content === undefined) {
23
+ return "";
24
+ }
25
+ return typeof this._content === "string"
26
+ ? this._content
27
+ : JSON.stringify(this._content);
28
+ }
29
+ get role() {
30
+ return this._role;
31
+ }
32
+ get name() {
33
+ return this._name;
34
+ }
35
+ get audio() {
36
+ return this._audio;
37
+ }
38
+ get function_call() {
39
+ return this._function_call;
40
+ }
41
+ get refusal() {
42
+ return this._refusal;
43
+ }
44
+ get tool_calls() {
45
+ return this._tool_calls;
46
+ }
47
+ get rawData() {
48
+ return this._rawData;
49
+ }
50
+ toOpenAIMessage() {
51
+ return { role: this.role, content: this.content, name: this.name };
52
+ }
53
+ toGoogleMessage() {
54
+ return { role: "model", parts: [{ text: this.content }] };
55
+ }
56
+ }
@@ -0,0 +1,12 @@
1
+ import { Content } from "@google/genai";
2
+ import { ChatCompletionMessageParam } from "openai/resources";
3
+ export declare class BaseMessage {
4
+ }
5
+ export interface MessageClass {
6
+ get content(): string;
7
+ get role(): string;
8
+ get name(): string | undefined;
9
+ get rawData(): any;
10
+ toOpenAIMessage(): ChatCompletionMessageParam;
11
+ toGoogleMessage(): Content;
12
+ }
@@ -0,0 +1,2 @@
1
+ export class BaseMessage {
2
+ }
@@ -0,0 +1,20 @@
1
+ import { BaseMessage, MessageClass } from "./BaseMessage.js";
2
+ import { TextPart } from "../../types.js";
3
+ import { ChatCompletionMessageParam } from "openai/resources";
4
+ import { Content } from "@google/genai";
5
+ export declare class DeveloperMessage extends BaseMessage implements MessageClass {
6
+ _role: "developer";
7
+ _content: string | Array<TextPart>;
8
+ _name?: string;
9
+ _rawData?: any;
10
+ constructor(content: string | Array<TextPart>, options?: {
11
+ name?: string;
12
+ rawData?: any;
13
+ });
14
+ get content(): string;
15
+ get role(): "developer";
16
+ get name(): string | undefined;
17
+ get rawData(): any;
18
+ toOpenAIMessage(): ChatCompletionMessageParam;
19
+ toGoogleMessage(): Content;
20
+ }
@@ -0,0 +1,33 @@
1
+ import { BaseMessage } from "./BaseMessage.js";
2
+ export class DeveloperMessage extends BaseMessage {
3
+ _role = "developer";
4
+ _content;
5
+ _name;
6
+ _rawData;
7
+ constructor(content, options = {}) {
8
+ super();
9
+ this._content = content;
10
+ this._name = options.name;
11
+ this._rawData = options.rawData;
12
+ }
13
+ get content() {
14
+ return typeof this._content === "string"
15
+ ? this._content
16
+ : JSON.stringify(this._content);
17
+ }
18
+ get role() {
19
+ return this._role;
20
+ }
21
+ get name() {
22
+ return this._name;
23
+ }
24
+ get rawData() {
25
+ return this._rawData;
26
+ }
27
+ toOpenAIMessage() {
28
+ return { role: this.role, content: this.content, name: this.name };
29
+ }
30
+ toGoogleMessage() {
31
+ return { role: this.role, parts: [{ text: this.content }] };
32
+ }
33
+ }
@@ -0,0 +1,20 @@
1
+ import { BaseMessage, MessageClass } from "./BaseMessage.js";
2
+ import { TextPart } from "../../types.js";
3
+ import { ChatCompletionMessageParam } from "openai/resources";
4
+ import { Content } from "@google/genai";
5
+ export declare class SystemMessage extends BaseMessage implements MessageClass {
6
+ _role: "system";
7
+ _content: string | Array<TextPart>;
8
+ _name?: string;
9
+ _rawData?: any;
10
+ constructor(content: string | Array<TextPart>, options?: {
11
+ name?: string;
12
+ rawData?: any;
13
+ });
14
+ get content(): string;
15
+ get role(): "system";
16
+ get name(): string | undefined;
17
+ get rawData(): any;
18
+ toOpenAIMessage(): ChatCompletionMessageParam;
19
+ toGoogleMessage(): Content;
20
+ }
@@ -0,0 +1,33 @@
1
+ import { BaseMessage } from "./BaseMessage.js";
2
+ export class SystemMessage extends BaseMessage {
3
+ _role = "system";
4
+ _content;
5
+ _name;
6
+ _rawData;
7
+ constructor(content, options = {}) {
8
+ super();
9
+ this._content = content;
10
+ this._name = options.name;
11
+ this._rawData = options.rawData;
12
+ }
13
+ get content() {
14
+ return typeof this._content === "string"
15
+ ? this._content
16
+ : JSON.stringify(this._content);
17
+ }
18
+ get role() {
19
+ return this._role;
20
+ }
21
+ get name() {
22
+ return this._name;
23
+ }
24
+ get rawData() {
25
+ return this._rawData;
26
+ }
27
+ toOpenAIMessage() {
28
+ return { role: this.role, content: this.content, name: this.name };
29
+ }
30
+ toGoogleMessage() {
31
+ return { role: this.role, parts: [{ text: this.content }] };
32
+ }
33
+ }
@@ -0,0 +1,23 @@
1
+ import { BaseMessage, MessageClass } from "./BaseMessage.js";
2
+ import { TextPart } from "../../types.js";
3
+ import { ChatCompletionMessageParam } from "openai/resources";
4
+ import { Content } from "@google/genai";
5
+ export declare class ToolMessage extends BaseMessage implements MessageClass {
6
+ _role: "tool";
7
+ _content: string | Array<TextPart>;
8
+ _tool_call_id: string;
9
+ _rawData?: any;
10
+ _name: string;
11
+ constructor(content: string | Array<TextPart>, options: {
12
+ tool_call_id: string;
13
+ rawData?: any;
14
+ name: string;
15
+ });
16
+ get content(): string;
17
+ get role(): "tool";
18
+ get name(): string;
19
+ get tool_call_id(): string;
20
+ get rawData(): any;
21
+ toOpenAIMessage(): ChatCompletionMessageParam;
22
+ toGoogleMessage(): Content;
23
+ }
@@ -0,0 +1,51 @@
1
+ import { BaseMessage } from "./BaseMessage.js";
2
+ export class ToolMessage extends BaseMessage {
3
+ _role = "tool";
4
+ _content;
5
+ _tool_call_id;
6
+ _rawData;
7
+ _name;
8
+ constructor(content, options) {
9
+ super();
10
+ this._content = content;
11
+ this._tool_call_id = options.tool_call_id;
12
+ this._rawData = options.rawData;
13
+ this._name = options.name;
14
+ }
15
+ get content() {
16
+ return typeof this._content === "string"
17
+ ? this._content
18
+ : JSON.stringify(this._content);
19
+ }
20
+ get role() {
21
+ return this._role;
22
+ }
23
+ get name() {
24
+ return this._name;
25
+ }
26
+ get tool_call_id() {
27
+ return this._tool_call_id;
28
+ }
29
+ get rawData() {
30
+ return this._rawData;
31
+ }
32
+ toOpenAIMessage() {
33
+ return {
34
+ role: this.role,
35
+ content: this.content,
36
+ tool_call_id: this.tool_call_id,
37
+ };
38
+ }
39
+ toGoogleMessage() {
40
+ return {
41
+ role: "user", parts: [{
42
+ functionResponse: {
43
+ name: this.name,
44
+ response: {
45
+ result: this.content
46
+ }
47
+ }
48
+ }]
49
+ };
50
+ }
51
+ }
@@ -0,0 +1,19 @@
1
+ import { BaseMessage, MessageClass } from "./BaseMessage.js";
2
+ import { ChatCompletionMessageParam } from "openai/resources";
3
+ import { Content } from "@google/genai";
4
+ export declare class UserMessage extends BaseMessage implements MessageClass {
5
+ _role: "user";
6
+ _content: string;
7
+ _name?: string;
8
+ _rawData?: any;
9
+ constructor(content: string, options?: {
10
+ name?: string;
11
+ rawData?: any;
12
+ });
13
+ get content(): string;
14
+ get role(): "user";
15
+ get name(): string | undefined;
16
+ get rawData(): any;
17
+ toOpenAIMessage(): ChatCompletionMessageParam;
18
+ toGoogleMessage(): Content;
19
+ }
@@ -0,0 +1,31 @@
1
+ import { BaseMessage } from "./BaseMessage.js";
2
+ export class UserMessage extends BaseMessage {
3
+ _role = "user";
4
+ _content;
5
+ _name;
6
+ _rawData;
7
+ constructor(content, options = {}) {
8
+ super();
9
+ this._content = content;
10
+ this._name = options.name;
11
+ this._rawData = options.rawData;
12
+ }
13
+ get content() {
14
+ return this._content;
15
+ }
16
+ get role() {
17
+ return this._role;
18
+ }
19
+ get name() {
20
+ return this._name;
21
+ }
22
+ get rawData() {
23
+ return this._rawData;
24
+ }
25
+ toOpenAIMessage() {
26
+ return { role: this.role, content: this.content, name: this.name };
27
+ }
28
+ toGoogleMessage() {
29
+ return { role: this.role, parts: [{ text: this.content }] };
30
+ }
31
+ }
@@ -0,0 +1,38 @@
1
+ import { UserMessage } from "./UserMessage.js";
2
+ import { AssistantMessage } from "./AssistantMessage.js";
3
+ import { DeveloperMessage } from "./DeveloperMessage.js";
4
+ import { SystemMessage } from "./SystemMessage.js";
5
+ import { ToolMessage } from "./ToolMessage.js";
6
+ import { TextPart } from "../../types.js";
7
+ export * from "./AssistantMessage.js";
8
+ export * from "./BaseMessage.js";
9
+ export * from "./DeveloperMessage.js";
10
+ export * from "./SystemMessage.js";
11
+ export * from "./ToolMessage.js";
12
+ export * from "./UserMessage.js";
13
+ export declare function userMessage(content: string, options?: {
14
+ name?: string;
15
+ rawData?: any;
16
+ }): UserMessage;
17
+ export declare function assistantMessage(content: string | Array<TextPart> | null, options?: {
18
+ name?: string;
19
+ audio?: any | null;
20
+ function_call?: any | null;
21
+ refusal?: string | null;
22
+ tool_calls?: Array<any>;
23
+ rawData?: any;
24
+ }): AssistantMessage;
25
+ export declare function developerMessage(content: string | Array<TextPart>, options?: {
26
+ name?: string;
27
+ rawData?: any;
28
+ }): DeveloperMessage;
29
+ export declare function systemMessage(content: string | Array<TextPart>, options?: {
30
+ name?: string;
31
+ rawData?: any;
32
+ }): SystemMessage;
33
+ export declare function toolMessage(content: string | Array<TextPart>, options: {
34
+ tool_call_id: string;
35
+ rawData?: any;
36
+ name: string;
37
+ }): ToolMessage;
38
+ export type Message = ToolMessage | UserMessage | AssistantMessage | DeveloperMessage | SystemMessage;
@@ -0,0 +1,26 @@
1
+ import { UserMessage } from "./UserMessage.js";
2
+ import { AssistantMessage } from "./AssistantMessage.js";
3
+ import { DeveloperMessage } from "./DeveloperMessage.js";
4
+ import { SystemMessage } from "./SystemMessage.js";
5
+ import { ToolMessage } from "./ToolMessage.js";
6
+ export * from "./AssistantMessage.js";
7
+ export * from "./BaseMessage.js";
8
+ export * from "./DeveloperMessage.js";
9
+ export * from "./SystemMessage.js";
10
+ export * from "./ToolMessage.js";
11
+ export * from "./UserMessage.js";
12
+ export function userMessage(content, options = {}) {
13
+ return new UserMessage(content, options);
14
+ }
15
+ export function assistantMessage(content, options = {}) {
16
+ return new AssistantMessage(content, options);
17
+ }
18
+ export function developerMessage(content, options = {}) {
19
+ return new DeveloperMessage(content, options);
20
+ }
21
+ export function systemMessage(content, options = {}) {
22
+ return new SystemMessage(content, options);
23
+ }
24
+ export function toolMessage(content, options) {
25
+ return new ToolMessage(content, options);
26
+ }
package/dist/client.d.ts CHANGED
@@ -3,4 +3,4 @@ export * from "./clients/openai.js";
3
3
  import { SmolGoogle } from "./clients/google.js";
4
4
  import { SmolOpenAi } from "./clients/openai.js";
5
5
  import { SmolConfig } from "./types.js";
6
- export declare function getClient(config: SmolConfig): SmolOpenAi | SmolGoogle;
6
+ export declare function getClient(config: SmolConfig): SmolGoogle | SmolOpenAi;
package/dist/client.js CHANGED
@@ -1,18 +1,21 @@
1
1
  export * from "./clients/google.js";
2
2
  export * from "./clients/openai.js";
3
- import { EgonLog } from "egonlog";
4
3
  import { SmolGoogle } from "./clients/google.js";
5
4
  import { SmolOpenAi } from "./clients/openai.js";
6
5
  import { getModel, isTextModel } from "./models.js";
7
6
  import { SmolError } from "./smolError.js";
7
+ import { getLogger } from "./logger.js";
8
8
  export function getClient(config) {
9
- const apiKey = config.apiKey;
10
- const logger = new EgonLog({ level: config.logLevel || "info" });
9
+ if (!config.openAiApiKey && !config.googleApiKey) {
10
+ throw new SmolError("No API key provided. Please provide an OpenAI or Google API key in the config using openAiApiKey or googleApiKey.");
11
+ }
12
+ // Initialize logger singleton with desired log level
13
+ const logger = getLogger(config.logLevel);
11
14
  const model = getModel(config.model);
12
15
  if (model === undefined || !isTextModel(model)) {
13
16
  throw new SmolError(`Only text models are supported currently. ${config.model} is a ${model?.type} model.`);
14
17
  }
15
- const clientConfig = { ...config, logger };
18
+ const clientConfig = { ...config };
16
19
  switch (model.source) {
17
20
  case "openai":
18
21
  return new SmolOpenAi(clientConfig);
@@ -0,0 +1,5 @@
1
+ import { PromptConfig, PromptResult, Result, SmolClient } from "../types.js";
2
+ export declare class BaseClient implements SmolClient {
3
+ text(config: PromptConfig): Promise<Result<PromptResult>>;
4
+ prompt(text: string, config?: PromptConfig): Promise<Result<PromptResult>>;
5
+ }
@@ -0,0 +1,14 @@
1
+ import { userMessage } from "../classes/message/index.js";
2
+ export class BaseClient {
3
+ text(config) {
4
+ throw new Error("Method not implemented.");
5
+ }
6
+ prompt(text, config) {
7
+ const msg = userMessage(text);
8
+ const promptConfig = {
9
+ ...config,
10
+ messages: config?.messages ? [...config.messages, msg] : [msg],
11
+ };
12
+ return this.text(promptConfig);
13
+ }
14
+ }
@@ -1,11 +1,12 @@
1
1
  import { GoogleGenAI } from "@google/genai";
2
- import { BaseClientConfig, PromptConfig, PromptResult, Result } from "../types.js";
2
+ import { BaseClientConfig, PromptConfig, PromptResult, Result, SmolClient } from "../types.js";
3
+ import { BaseClient } from "./baseClient.js";
3
4
  export type SmolGoogleConfig = BaseClientConfig;
4
- export declare class SmolGoogle implements SmolClient {
5
+ export declare class SmolGoogle extends BaseClient implements SmolClient {
5
6
  private client;
6
7
  private logger;
7
8
  private model;
8
9
  constructor(config: SmolGoogleConfig);
9
10
  getClient(): GoogleGenAI;
10
- text(content: string, config?: PromptConfig): Promise<Result<PromptResult>>;
11
+ text(config: PromptConfig): Promise<Result<PromptResult>>;
11
12
  }
@@ -1,39 +1,57 @@
1
- // @ts-nocheck
2
1
  import { GoogleGenAI } from "@google/genai";
2
+ import { getLogger } from "../logger.js";
3
3
  import { success, } from "../types.js";
4
- export class SmolGoogle {
4
+ import { BaseClient } from "./baseClient.js";
5
+ import { ToolCall } from "../classes/ToolCall.js";
6
+ import { convertOpenAIToolToGoogle } from "../util/common.js";
7
+ export class SmolGoogle extends BaseClient {
5
8
  client;
6
9
  logger;
7
10
  model;
8
11
  constructor(config) {
9
- this.client = new GoogleGenAI({ apiKey: config.apiKey });
10
- this.logger = config.logger;
12
+ super();
13
+ if (!config.googleApiKey) {
14
+ throw new Error("Google API key is required for SmolGoogle client.");
15
+ }
16
+ this.client = new GoogleGenAI({ apiKey: config.googleApiKey });
17
+ this.logger = getLogger();
11
18
  this.model = config.model;
12
19
  }
13
20
  getClient() {
14
21
  return this.client;
15
22
  }
16
- async text(content, config) {
17
- const messages = structuredClone(config?.messages) || [];
18
- messages.push({ role: "user", content });
19
- /* const contents = messages.map((message) => ({
20
- role: message.role === "user" ? "user" : "model", // Use consistent roles
21
- parts: [makePart(message)] as Part[],
22
- }));
23
-
24
- role: "user",
25
- parts: [{ text: sanitizedPrompt }],
26
- });
27
- contents.push({
28
- */
29
- // Send the prompt as the latest message
30
- const result = await this.client.models.generateContent({
31
- contents: content,
23
+ async text(config) {
24
+ const messages = config.messages.map((msg) => msg.toGoogleMessage());
25
+ const tools = (config.tools || []).map((tool) => convertOpenAIToolToGoogle(tool));
26
+ const genConfig = {};
27
+ if (tools.length > 0) {
28
+ genConfig.tools = [{ functionDeclarations: tools }];
29
+ }
30
+ const request = {
31
+ contents: messages,
32
32
  model: this.model,
33
+ config: genConfig,
34
+ };
35
+ if (config.rawAttributes) {
36
+ Object.assign(request, config.rawAttributes);
37
+ }
38
+ this.logger.debug("Sending request to Google Gemini:", JSON.stringify(request, null, 2));
39
+ // Send the prompt as the latest message
40
+ const result = await this.client.models.generateContent(request);
41
+ this.logger.debug("Response from Google Gemini:", JSON.stringify(result, null, 2));
42
+ const text = result.text || null;
43
+ const toolCalls = [];
44
+ result.candidates?.forEach((candidate) => {
45
+ if (candidate.content && candidate.content.parts) {
46
+ candidate.content.parts.forEach((part) => {
47
+ if (part.functionCall) {
48
+ const functionCall = part.functionCall;
49
+ toolCalls.push(new ToolCall("", functionCall.name, functionCall.args));
50
+ }
51
+ });
52
+ }
33
53
  });
34
- //console.log("Full response:", JSON.stringify(result, null, 2));
35
- const text = result.text;
36
54
  // Return the response, updating the chat history
37
- return success({ output: result.text, toolCalls: [] });
55
+ return success({ output: text, toolCalls });
38
56
  }
39
57
  }
@@ -1,11 +1,12 @@
1
1
  import OpenAI from "openai";
2
2
  import { BaseClientConfig, PromptConfig, PromptResult, Result, SmolClient } from "../types.js";
3
+ import { BaseClient } from "./baseClient.js";
3
4
  export type SmolOpenAiConfig = BaseClientConfig;
4
- export declare class SmolOpenAi implements SmolClient {
5
+ export declare class SmolOpenAi extends BaseClient implements SmolClient {
5
6
  private client;
6
7
  private logger;
7
8
  private model;
8
9
  constructor(config: SmolOpenAiConfig);
9
10
  getClient(): OpenAI;
10
- text(content: string, config?: PromptConfig): Promise<Result<PromptResult>>;
11
+ text(config: PromptConfig): Promise<Result<PromptResult>>;
11
12
  }