@marktoflow/integrations 2.0.3 → 2.0.4
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.
- package/README.md +65 -16
- package/dist/adapters/claude-agent-types.d.ts +28 -28
- package/dist/adapters/claude-agent-workflow.d.ts +16 -16
- package/dist/adapters/codex-types.d.ts +6 -6
- package/dist/adapters/codex-workflow.d.ts +16 -16
- package/dist/adapters/github-copilot-types.d.ts +22 -22
- package/dist/adapters/github-copilot-workflow.d.ts +14 -14
- package/dist/adapters/ollama-types.d.ts +42 -42
- package/dist/adapters/openai-types.d.ts +552 -33
- package/dist/adapters/openai-types.d.ts.map +1 -1
- package/dist/adapters/openai-types.js +58 -5
- package/dist/adapters/openai-types.js.map +1 -1
- package/dist/adapters/openai.d.ts +59 -5
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +211 -32
- package/dist/adapters/openai.js.map +1 -1
- package/dist/services/playwright/client.d.ts +110 -0
- package/dist/services/playwright/client.d.ts.map +1 -0
- package/dist/services/playwright/client.js +690 -0
- package/dist/services/playwright/client.js.map +1 -0
- package/dist/services/playwright/index.d.ts +7 -0
- package/dist/services/playwright/index.d.ts.map +1 -0
- package/dist/services/playwright/index.js +7 -0
- package/dist/services/playwright/index.js.map +1 -0
- package/dist/services/playwright/initializer.d.ts +24 -0
- package/dist/services/playwright/initializer.d.ts.map +1 -0
- package/dist/services/playwright/initializer.js +99 -0
- package/dist/services/playwright/initializer.js.map +1 -0
- package/dist/services/playwright/types.d.ts +270 -0
- package/dist/services/playwright/types.d.ts.map +1 -0
- package/dist/services/playwright/types.js +5 -0
- package/dist/services/playwright/types.js.map +1 -0
- package/dist/services/playwright.d.ts +3 -675
- package/dist/services/playwright.d.ts.map +1 -1
- package/dist/services/playwright.js +3 -1138
- package/dist/services/playwright.js.map +1 -1
- package/package.json +25 -7
- package/dist/adapters/claude-agent-hooks.d.ts +0 -176
- package/dist/services/github.d.ts +0 -3
- package/dist/services/gmail-trigger.d.ts +0 -92
- package/dist/services/gmail.d.ts +0 -116
- package/dist/services/google-calendar.d.ts +0 -220
- package/dist/services/google-docs.d.ts +0 -197
- package/dist/services/google-drive.d.ts +0 -149
- package/dist/services/google-sheets.d.ts +0 -165
- package/dist/services/http.d.ts +0 -120
- package/dist/services/jira.d.ts +0 -3
- package/dist/services/linear.d.ts +0 -163
- package/dist/services/mysql.d.ts +0 -91
- package/dist/services/outlook-trigger.d.ts +0 -121
- package/dist/services/outlook.d.ts +0 -237
- package/dist/services/postgres.d.ts +0 -83
- package/dist/services/slack-socket.d.ts +0 -18
- package/dist/services/slack.d.ts +0 -3
- package/dist/services/whatsapp.d.ts +0 -311
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* Type definitions for OpenAI SDK integration with marktoflow
|
|
3
3
|
*
|
|
4
4
|
* These types enable integration with OpenAI-compatible APIs including
|
|
5
|
-
* OpenAI, VLLM, and other local/remote endpoints.
|
|
5
|
+
* OpenAI, VLLM, llama.cpp, and other local/remote endpoints.
|
|
6
|
+
* Includes full tool calling and structured output support.
|
|
6
7
|
*/
|
|
7
8
|
import { z } from 'zod';
|
|
8
9
|
// ============================================================================
|
|
@@ -15,11 +16,46 @@ export const OpenAIClientConfigSchema = z.object({
|
|
|
15
16
|
organization: z.string().optional(),
|
|
16
17
|
timeout: z.number().positive().optional(),
|
|
17
18
|
});
|
|
18
|
-
export const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
export const OpenAIToolFunctionSchema = z.object({
|
|
20
|
+
name: z.string(),
|
|
21
|
+
description: z.string().optional(),
|
|
22
|
+
parameters: z.record(z.unknown()).optional(),
|
|
23
|
+
strict: z.boolean().optional(),
|
|
22
24
|
});
|
|
25
|
+
export const OpenAIToolSchema = z.object({
|
|
26
|
+
type: z.literal('function'),
|
|
27
|
+
function: OpenAIToolFunctionSchema,
|
|
28
|
+
});
|
|
29
|
+
export const OpenAIChatMessageSchema = z.discriminatedUnion('role', [
|
|
30
|
+
z.object({
|
|
31
|
+
role: z.literal('system'),
|
|
32
|
+
content: z.string(),
|
|
33
|
+
name: z.string().optional(),
|
|
34
|
+
}),
|
|
35
|
+
z.object({
|
|
36
|
+
role: z.literal('user'),
|
|
37
|
+
content: z.union([z.string(), z.array(z.unknown())]),
|
|
38
|
+
name: z.string().optional(),
|
|
39
|
+
}),
|
|
40
|
+
z.object({
|
|
41
|
+
role: z.literal('assistant'),
|
|
42
|
+
content: z.string().nullable(),
|
|
43
|
+
name: z.string().optional(),
|
|
44
|
+
tool_calls: z.array(z.object({
|
|
45
|
+
id: z.string(),
|
|
46
|
+
type: z.literal('function'),
|
|
47
|
+
function: z.object({
|
|
48
|
+
name: z.string(),
|
|
49
|
+
arguments: z.string(),
|
|
50
|
+
}),
|
|
51
|
+
})).optional(),
|
|
52
|
+
}),
|
|
53
|
+
z.object({
|
|
54
|
+
role: z.literal('tool'),
|
|
55
|
+
content: z.string(),
|
|
56
|
+
tool_call_id: z.string(),
|
|
57
|
+
}),
|
|
58
|
+
]);
|
|
23
59
|
export const OpenAIChatOptionsSchema = z.object({
|
|
24
60
|
model: z.string().optional(),
|
|
25
61
|
messages: z.array(OpenAIChatMessageSchema),
|
|
@@ -30,6 +66,23 @@ export const OpenAIChatOptionsSchema = z.object({
|
|
|
30
66
|
stop: z.union([z.string(), z.array(z.string())]).optional(),
|
|
31
67
|
frequency_penalty: z.number().min(-2).max(2).optional(),
|
|
32
68
|
presence_penalty: z.number().min(-2).max(2).optional(),
|
|
69
|
+
tools: z.array(OpenAIToolSchema).optional(),
|
|
70
|
+
tool_choice: z.union([
|
|
71
|
+
z.enum(['auto', 'none', 'required']),
|
|
72
|
+
z.object({ type: z.literal('function'), function: z.object({ name: z.string() }) }),
|
|
73
|
+
]).optional(),
|
|
74
|
+
response_format: z.union([
|
|
75
|
+
z.object({ type: z.literal('text') }),
|
|
76
|
+
z.object({ type: z.literal('json_object') }),
|
|
77
|
+
z.object({
|
|
78
|
+
type: z.literal('json_schema'),
|
|
79
|
+
json_schema: z.object({
|
|
80
|
+
name: z.string(),
|
|
81
|
+
schema: z.record(z.unknown()),
|
|
82
|
+
strict: z.boolean().optional(),
|
|
83
|
+
}),
|
|
84
|
+
}),
|
|
85
|
+
]).optional(),
|
|
33
86
|
});
|
|
34
87
|
export const OpenAIEmbeddingOptionsSchema = z.object({
|
|
35
88
|
model: z.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai-types.js","sourceRoot":"","sources":["../../src/adapters/openai-types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"openai-types.js","sourceRoot":"","sources":["../../src/adapters/openai-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAwNxB,+EAA+E;AAC/E,cAAc;AACd,+EAA+E;AAE/E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACnC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC/C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC5C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AK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;CAClD,CAAC,CAAC"}
|
|
@@ -2,11 +2,18 @@
|
|
|
2
2
|
* OpenAI SDK Adapter for marktoflow
|
|
3
3
|
*
|
|
4
4
|
* This adapter provides integration with OpenAI-compatible APIs,
|
|
5
|
-
* including OpenAI, VLLM, and other local/remote endpoints
|
|
6
|
-
* implement the OpenAI API specification.
|
|
5
|
+
* including OpenAI, VLLM, llama.cpp, and other local/remote endpoints
|
|
6
|
+
* that implement the OpenAI API specification.
|
|
7
|
+
*
|
|
8
|
+
* Supports:
|
|
9
|
+
* - Chat completions (standard and streaming)
|
|
10
|
+
* - Tool calling / function calling with agentic loop
|
|
11
|
+
* - Structured output (JSON mode, JSON schema)
|
|
12
|
+
* - Embeddings
|
|
13
|
+
* - Model listing and discovery
|
|
7
14
|
*/
|
|
8
15
|
import { SDKInitializer } from '@marktoflow/core';
|
|
9
|
-
import type { OpenAIClientConfig, OpenAIChatOptions, OpenAIChatResult, OpenAIEmbeddingOptions, OpenAIEmbeddingResult } from './openai-types.js';
|
|
16
|
+
import type { OpenAIClientConfig, OpenAIChatOptions, OpenAIChatResult, OpenAIEmbeddingOptions, OpenAIEmbeddingResult, OpenAIToolCall, OpenAIToolExecutor, OpenAIToolLoopOptions } from './openai-types.js';
|
|
10
17
|
export declare class OpenAIClient {
|
|
11
18
|
private client;
|
|
12
19
|
private defaultModel;
|
|
@@ -19,13 +26,41 @@ export declare class OpenAIClient {
|
|
|
19
26
|
model?: string;
|
|
20
27
|
} | string, model?: string): Promise<string>;
|
|
21
28
|
/**
|
|
22
|
-
* Full chat completion with all options
|
|
29
|
+
* Full chat completion with all options including tools and response_format
|
|
23
30
|
*/
|
|
24
31
|
chatCompletion(options: OpenAIChatOptions): Promise<OpenAIChatResult>;
|
|
25
32
|
/**
|
|
26
33
|
* Streaming chat completion
|
|
27
34
|
*/
|
|
28
35
|
chatStream(options: OpenAIChatOptions): AsyncGenerator<string, void, unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* Run an agentic tool-calling loop.
|
|
38
|
+
*
|
|
39
|
+
* Sends the conversation to the model. If the model responds with tool_calls,
|
|
40
|
+
* executes them via the provided executor, appends results, and re-sends.
|
|
41
|
+
* Repeats until the model returns a text response or maxTurns is reached.
|
|
42
|
+
*
|
|
43
|
+
* @param options - Chat options including tools definition
|
|
44
|
+
* @param toolExecutor - Function that executes a tool call and returns the result
|
|
45
|
+
* @returns Final chat result after all tool calls are resolved
|
|
46
|
+
*/
|
|
47
|
+
chatWithTools(options: OpenAIToolLoopOptions, toolExecutor: OpenAIToolExecutor): Promise<OpenAIChatResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Generate a response in JSON format.
|
|
50
|
+
* Uses response_format to ensure valid JSON output.
|
|
51
|
+
*/
|
|
52
|
+
generateJSON<T = unknown>(options: Omit<OpenAIChatOptions, 'response_format'>): Promise<T>;
|
|
53
|
+
/**
|
|
54
|
+
* Generate a response matching a JSON schema.
|
|
55
|
+
* Uses structured outputs for guaranteed schema compliance.
|
|
56
|
+
*/
|
|
57
|
+
generateStructured<T = unknown>(options: Omit<OpenAIChatOptions, 'response_format'> & {
|
|
58
|
+
schema: {
|
|
59
|
+
name: string;
|
|
60
|
+
schema: Record<string, unknown>;
|
|
61
|
+
strict?: boolean;
|
|
62
|
+
};
|
|
63
|
+
}): Promise<T>;
|
|
29
64
|
/**
|
|
30
65
|
* Create embeddings for text input
|
|
31
66
|
*/
|
|
@@ -37,6 +72,11 @@ export declare class OpenAIClient {
|
|
|
37
72
|
id: string;
|
|
38
73
|
owned_by: string;
|
|
39
74
|
}>>;
|
|
75
|
+
/**
|
|
76
|
+
* Auto-detect the default model from the server.
|
|
77
|
+
* Useful for local servers (llama.cpp) that serve a single model.
|
|
78
|
+
*/
|
|
79
|
+
autoDetectModel(): Promise<string | null>;
|
|
40
80
|
/**
|
|
41
81
|
* Check if the API endpoint is available
|
|
42
82
|
*/
|
|
@@ -61,14 +101,28 @@ export declare class OpenAIClient {
|
|
|
61
101
|
}>;
|
|
62
102
|
temperature?: number;
|
|
63
103
|
max_tokens?: number;
|
|
104
|
+
tools?: Array<{
|
|
105
|
+
type: "function";
|
|
106
|
+
function: {
|
|
107
|
+
name: string;
|
|
108
|
+
description?: string;
|
|
109
|
+
parameters?: Record<string, unknown>;
|
|
110
|
+
};
|
|
111
|
+
}>;
|
|
112
|
+
tool_choice?: "auto" | "none" | "required";
|
|
113
|
+
response_format?: {
|
|
114
|
+
type: string;
|
|
115
|
+
};
|
|
64
116
|
}) => Promise<{
|
|
65
117
|
choices: Array<{
|
|
66
118
|
message: {
|
|
67
|
-
content: string;
|
|
119
|
+
content: string | null;
|
|
120
|
+
tool_calls?: OpenAIToolCall[];
|
|
68
121
|
};
|
|
69
122
|
}>;
|
|
70
123
|
}>;
|
|
71
124
|
};
|
|
125
|
+
private mapResponse;
|
|
72
126
|
}
|
|
73
127
|
export declare const OpenAIInitializer: SDKInitializer;
|
|
74
128
|
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/adapters/openai.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/adapters/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAc,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAGhB,sBAAsB,EACtB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,mBAAmB,CAAC;AAM3B,qBAAa,YAAY;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@
|
|
|
2
2
|
* OpenAI SDK Adapter for marktoflow
|
|
3
3
|
*
|
|
4
4
|
* This adapter provides integration with OpenAI-compatible APIs,
|
|
5
|
-
* including OpenAI, VLLM, and other local/remote endpoints
|
|
6
|
-
* implement the OpenAI API specification.
|
|
5
|
+
* including OpenAI, VLLM, llama.cpp, and other local/remote endpoints
|
|
6
|
+
* that implement the OpenAI API specification.
|
|
7
|
+
*
|
|
8
|
+
* Supports:
|
|
9
|
+
* - Chat completions (standard and streaming)
|
|
10
|
+
* - Tool calling / function calling with agentic loop
|
|
11
|
+
* - Structured output (JSON mode, JSON schema)
|
|
12
|
+
* - Embeddings
|
|
13
|
+
* - Model listing and discovery
|
|
7
14
|
*/
|
|
8
15
|
import OpenAI from 'openai';
|
|
9
16
|
// ============================================================================
|
|
@@ -13,7 +20,7 @@ export class OpenAIClient {
|
|
|
13
20
|
client;
|
|
14
21
|
defaultModel;
|
|
15
22
|
constructor(config = {}) {
|
|
16
|
-
// For
|
|
23
|
+
// For local endpoints (VLLM, llama.cpp), a dummy key is needed since the SDK requires non-empty string
|
|
17
24
|
const apiKey = config.apiKey || process.env.OPENAI_API_KEY || 'dummy-key';
|
|
18
25
|
this.client = new OpenAI({
|
|
19
26
|
apiKey,
|
|
@@ -42,11 +49,12 @@ export class OpenAIClient {
|
|
|
42
49
|
// Chat Completions
|
|
43
50
|
// --------------------------------------------------------------------------
|
|
44
51
|
/**
|
|
45
|
-
* Full chat completion with all options
|
|
52
|
+
* Full chat completion with all options including tools and response_format
|
|
46
53
|
*/
|
|
47
54
|
async chatCompletion(options) {
|
|
48
55
|
const model = options.model || this.defaultModel;
|
|
49
|
-
|
|
56
|
+
// Build request parameters
|
|
57
|
+
const params = {
|
|
50
58
|
model,
|
|
51
59
|
messages: options.messages,
|
|
52
60
|
temperature: options.temperature,
|
|
@@ -56,41 +64,43 @@ export class OpenAIClient {
|
|
|
56
64
|
stop: options.stop,
|
|
57
65
|
frequency_penalty: options.frequency_penalty,
|
|
58
66
|
presence_penalty: options.presence_penalty,
|
|
59
|
-
});
|
|
60
|
-
return {
|
|
61
|
-
id: response.id,
|
|
62
|
-
object: response.object,
|
|
63
|
-
created: response.created,
|
|
64
|
-
model: response.model,
|
|
65
|
-
choices: response.choices.map((choice, index) => ({
|
|
66
|
-
index,
|
|
67
|
-
message: {
|
|
68
|
-
role: choice.message.role,
|
|
69
|
-
content: choice.message.content || '',
|
|
70
|
-
},
|
|
71
|
-
finish_reason: choice.finish_reason || 'stop',
|
|
72
|
-
})),
|
|
73
|
-
usage: response.usage
|
|
74
|
-
? {
|
|
75
|
-
prompt_tokens: response.usage.prompt_tokens,
|
|
76
|
-
completion_tokens: response.usage.completion_tokens,
|
|
77
|
-
total_tokens: response.usage.total_tokens,
|
|
78
|
-
}
|
|
79
|
-
: undefined,
|
|
80
67
|
};
|
|
68
|
+
// Add tools if provided
|
|
69
|
+
if (options.tools && options.tools.length > 0) {
|
|
70
|
+
params.tools = options.tools;
|
|
71
|
+
if (options.tool_choice) {
|
|
72
|
+
params.tool_choice = options.tool_choice;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
// Add response format if provided
|
|
76
|
+
if (options.response_format) {
|
|
77
|
+
params.response_format = options.response_format;
|
|
78
|
+
}
|
|
79
|
+
const response = await this.client.chat.completions.create(params);
|
|
80
|
+
return this.mapResponse(response);
|
|
81
81
|
}
|
|
82
82
|
/**
|
|
83
83
|
* Streaming chat completion
|
|
84
84
|
*/
|
|
85
85
|
async *chatStream(options) {
|
|
86
86
|
const model = options.model || this.defaultModel;
|
|
87
|
-
const
|
|
87
|
+
const params = {
|
|
88
88
|
model,
|
|
89
89
|
messages: options.messages,
|
|
90
90
|
temperature: options.temperature,
|
|
91
91
|
max_tokens: options.max_tokens,
|
|
92
92
|
stream: true,
|
|
93
|
-
}
|
|
93
|
+
};
|
|
94
|
+
if (options.tools && options.tools.length > 0) {
|
|
95
|
+
params.tools = options.tools;
|
|
96
|
+
if (options.tool_choice) {
|
|
97
|
+
params.tool_choice = options.tool_choice;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (options.response_format) {
|
|
101
|
+
params.response_format = options.response_format;
|
|
102
|
+
}
|
|
103
|
+
const stream = await this.client.chat.completions.create(params);
|
|
94
104
|
for await (const chunk of stream) {
|
|
95
105
|
const content = chunk.choices[0]?.delta?.content;
|
|
96
106
|
if (content) {
|
|
@@ -99,6 +109,117 @@ export class OpenAIClient {
|
|
|
99
109
|
}
|
|
100
110
|
}
|
|
101
111
|
// --------------------------------------------------------------------------
|
|
112
|
+
// Tool Calling — Agentic Loop
|
|
113
|
+
// --------------------------------------------------------------------------
|
|
114
|
+
/**
|
|
115
|
+
* Run an agentic tool-calling loop.
|
|
116
|
+
*
|
|
117
|
+
* Sends the conversation to the model. If the model responds with tool_calls,
|
|
118
|
+
* executes them via the provided executor, appends results, and re-sends.
|
|
119
|
+
* Repeats until the model returns a text response or maxTurns is reached.
|
|
120
|
+
*
|
|
121
|
+
* @param options - Chat options including tools definition
|
|
122
|
+
* @param toolExecutor - Function that executes a tool call and returns the result
|
|
123
|
+
* @returns Final chat result after all tool calls are resolved
|
|
124
|
+
*/
|
|
125
|
+
async chatWithTools(options, toolExecutor) {
|
|
126
|
+
const maxTurns = options.maxTurns ?? 10;
|
|
127
|
+
const messages = [...options.messages];
|
|
128
|
+
for (let turn = 0; turn < maxTurns; turn++) {
|
|
129
|
+
const result = await this.chatCompletion({
|
|
130
|
+
...options,
|
|
131
|
+
messages,
|
|
132
|
+
});
|
|
133
|
+
const choice = result.choices[0];
|
|
134
|
+
if (!choice) {
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
// If no tool calls, we're done — model gave a final response
|
|
138
|
+
if (!choice.message.tool_calls || choice.message.tool_calls.length === 0) {
|
|
139
|
+
return result;
|
|
140
|
+
}
|
|
141
|
+
// Append the assistant's tool-calling message to conversation
|
|
142
|
+
messages.push({
|
|
143
|
+
role: 'assistant',
|
|
144
|
+
content: choice.message.content,
|
|
145
|
+
tool_calls: choice.message.tool_calls,
|
|
146
|
+
});
|
|
147
|
+
// Execute each tool call and append results
|
|
148
|
+
for (const toolCall of choice.message.tool_calls) {
|
|
149
|
+
if (options.onToolCall) {
|
|
150
|
+
options.onToolCall(toolCall);
|
|
151
|
+
}
|
|
152
|
+
let toolResult;
|
|
153
|
+
try {
|
|
154
|
+
const args = JSON.parse(toolCall.function.arguments);
|
|
155
|
+
toolResult = await toolExecutor(toolCall.function.name, args);
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
toolResult = {
|
|
159
|
+
error: error instanceof Error ? error.message : String(error),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (options.onToolResult) {
|
|
163
|
+
options.onToolResult(toolCall, toolResult);
|
|
164
|
+
}
|
|
165
|
+
// Append tool result as a tool message
|
|
166
|
+
const resultStr = typeof toolResult === 'string'
|
|
167
|
+
? toolResult
|
|
168
|
+
: JSON.stringify(toolResult);
|
|
169
|
+
messages.push({
|
|
170
|
+
role: 'tool',
|
|
171
|
+
content: resultStr,
|
|
172
|
+
tool_call_id: toolCall.id,
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
// Max turns exceeded — return the last result
|
|
177
|
+
// Make one final call without tools to get a summary
|
|
178
|
+
return this.chatCompletion({
|
|
179
|
+
...options,
|
|
180
|
+
messages,
|
|
181
|
+
tools: undefined,
|
|
182
|
+
tool_choice: undefined,
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
// --------------------------------------------------------------------------
|
|
186
|
+
// Structured Output
|
|
187
|
+
// --------------------------------------------------------------------------
|
|
188
|
+
/**
|
|
189
|
+
* Generate a response in JSON format.
|
|
190
|
+
* Uses response_format to ensure valid JSON output.
|
|
191
|
+
*/
|
|
192
|
+
async generateJSON(options) {
|
|
193
|
+
const result = await this.chatCompletion({
|
|
194
|
+
...options,
|
|
195
|
+
response_format: { type: 'json_object' },
|
|
196
|
+
});
|
|
197
|
+
const content = result.choices[0]?.message?.content;
|
|
198
|
+
if (!content) {
|
|
199
|
+
throw new Error('No content in response');
|
|
200
|
+
}
|
|
201
|
+
return JSON.parse(content);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Generate a response matching a JSON schema.
|
|
205
|
+
* Uses structured outputs for guaranteed schema compliance.
|
|
206
|
+
*/
|
|
207
|
+
async generateStructured(options) {
|
|
208
|
+
const { schema, ...chatOptions } = options;
|
|
209
|
+
const result = await this.chatCompletion({
|
|
210
|
+
...chatOptions,
|
|
211
|
+
response_format: {
|
|
212
|
+
type: 'json_schema',
|
|
213
|
+
json_schema: schema,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
const content = result.choices[0]?.message?.content;
|
|
217
|
+
if (!content) {
|
|
218
|
+
throw new Error('No content in response');
|
|
219
|
+
}
|
|
220
|
+
return JSON.parse(content);
|
|
221
|
+
}
|
|
222
|
+
// --------------------------------------------------------------------------
|
|
102
223
|
// Embeddings
|
|
103
224
|
// --------------------------------------------------------------------------
|
|
104
225
|
/**
|
|
@@ -138,6 +259,23 @@ export class OpenAIClient {
|
|
|
138
259
|
}
|
|
139
260
|
return models;
|
|
140
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* Auto-detect the default model from the server.
|
|
264
|
+
* Useful for local servers (llama.cpp) that serve a single model.
|
|
265
|
+
*/
|
|
266
|
+
async autoDetectModel() {
|
|
267
|
+
try {
|
|
268
|
+
const models = await this.listModels();
|
|
269
|
+
if (models.length > 0) {
|
|
270
|
+
this.defaultModel = models[0].id;
|
|
271
|
+
return models[0].id;
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
catch {
|
|
275
|
+
// Server may not support /models endpoint
|
|
276
|
+
}
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
141
279
|
// --------------------------------------------------------------------------
|
|
142
280
|
// Utility
|
|
143
281
|
// --------------------------------------------------------------------------
|
|
@@ -173,21 +311,56 @@ export class OpenAIClient {
|
|
|
173
311
|
*/
|
|
174
312
|
chat = {
|
|
175
313
|
completions: async (inputs) => {
|
|
176
|
-
const
|
|
314
|
+
const params = {
|
|
177
315
|
model: inputs.model || this.defaultModel,
|
|
178
316
|
messages: inputs.messages,
|
|
179
317
|
temperature: inputs.temperature,
|
|
180
318
|
max_tokens: inputs.max_tokens,
|
|
181
|
-
}
|
|
319
|
+
};
|
|
320
|
+
if (inputs.tools)
|
|
321
|
+
params.tools = inputs.tools;
|
|
322
|
+
if (inputs.tool_choice)
|
|
323
|
+
params.tool_choice = inputs.tool_choice;
|
|
324
|
+
if (inputs.response_format)
|
|
325
|
+
params.response_format = inputs.response_format;
|
|
326
|
+
const response = await this.client.chat.completions.create(params);
|
|
182
327
|
return {
|
|
183
328
|
choices: response.choices.map((choice) => ({
|
|
184
329
|
message: {
|
|
185
330
|
content: choice.message.content || '',
|
|
331
|
+
tool_calls: choice.message.tool_calls,
|
|
186
332
|
},
|
|
187
333
|
})),
|
|
188
334
|
};
|
|
189
335
|
},
|
|
190
336
|
};
|
|
337
|
+
// --------------------------------------------------------------------------
|
|
338
|
+
// Private Helpers
|
|
339
|
+
// --------------------------------------------------------------------------
|
|
340
|
+
mapResponse(response) {
|
|
341
|
+
return {
|
|
342
|
+
id: response.id,
|
|
343
|
+
object: response.object,
|
|
344
|
+
created: response.created,
|
|
345
|
+
model: response.model,
|
|
346
|
+
choices: response.choices.map((choice, index) => ({
|
|
347
|
+
index,
|
|
348
|
+
message: {
|
|
349
|
+
role: choice.message.role,
|
|
350
|
+
content: choice.message.content || '',
|
|
351
|
+
tool_calls: choice.message.tool_calls,
|
|
352
|
+
},
|
|
353
|
+
finish_reason: choice.finish_reason || 'stop',
|
|
354
|
+
})),
|
|
355
|
+
usage: response.usage
|
|
356
|
+
? {
|
|
357
|
+
prompt_tokens: response.usage.prompt_tokens,
|
|
358
|
+
completion_tokens: response.usage.completion_tokens,
|
|
359
|
+
total_tokens: response.usage.total_tokens,
|
|
360
|
+
}
|
|
361
|
+
: undefined,
|
|
362
|
+
};
|
|
363
|
+
}
|
|
191
364
|
}
|
|
192
365
|
// ============================================================================
|
|
193
366
|
// SDK Initializer
|
|
@@ -196,13 +369,19 @@ export const OpenAIInitializer = {
|
|
|
196
369
|
async initialize(_module, config) {
|
|
197
370
|
const auth = config.auth || {};
|
|
198
371
|
const options = config.options || {};
|
|
199
|
-
|
|
372
|
+
const clientConfig = {
|
|
200
373
|
baseUrl: auth['base_url'] || options['baseUrl'],
|
|
201
374
|
apiKey: auth['api_key'] || options['apiKey'],
|
|
202
375
|
model: options['model'],
|
|
203
376
|
organization: options['organization'],
|
|
204
377
|
timeout: options['timeout'],
|
|
205
|
-
}
|
|
378
|
+
};
|
|
379
|
+
const client = new OpenAIClient(clientConfig);
|
|
380
|
+
// Auto-detect model for local servers if model is 'auto' or not specified
|
|
381
|
+
if (clientConfig.baseUrl && (!clientConfig.model || clientConfig.model === 'auto')) {
|
|
382
|
+
await client.autoDetectModel();
|
|
383
|
+
}
|
|
384
|
+
return client;
|
|
206
385
|
},
|
|
207
386
|
};
|
|
208
387
|
//# sourceMappingURL=openai.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/adapters/openai.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"openai.js","sourceRoot":"","sources":["../../src/adapters/openai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,MAAM,MAAM,QAAQ,CAAC;AAe5B,+EAA+E;AAC/E,gBAAgB;AAChB,+EAA+E;AAE/E,MAAM,OAAO,YAAY;IACf,MAAM,CAAS;IACf,YAAY,CAAS;IAE7B,YAAY,SAA6B,EAAE;QACzC,uGAAuG;QACvG,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,WAAW,CAAC;QAE1E,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,C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