@mcp-abap-adt/llm-proxy 0.0.1
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/LICENSE +22 -0
- package/README.md +526 -0
- package/dist/agent.d.ts +49 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/agent.js +96 -0
- package/dist/agent.js.map +1 -0
- package/dist/agents/anthropic-agent.d.ts +32 -0
- package/dist/agents/anthropic-agent.d.ts.map +1 -0
- package/dist/agents/anthropic-agent.js +80 -0
- package/dist/agents/anthropic-agent.js.map +1 -0
- package/dist/agents/base.d.ts +64 -0
- package/dist/agents/base.d.ts.map +1 -0
- package/dist/agents/base.js +93 -0
- package/dist/agents/base.js.map +1 -0
- package/dist/agents/deepseek-agent.d.ts +31 -0
- package/dist/agents/deepseek-agent.d.ts.map +1 -0
- package/dist/agents/deepseek-agent.js +71 -0
- package/dist/agents/deepseek-agent.js.map +1 -0
- package/dist/agents/index.d.ts +9 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +9 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/openai-agent.d.ts +32 -0
- package/dist/agents/openai-agent.d.ts.map +1 -0
- package/dist/agents/openai-agent.js +69 -0
- package/dist/agents/openai-agent.js.map +1 -0
- package/dist/agents/prompt-based-agent.d.ts +28 -0
- package/dist/agents/prompt-based-agent.d.ts.map +1 -0
- package/dist/agents/prompt-based-agent.js +62 -0
- package/dist/agents/prompt-based-agent.js.map +1 -0
- package/dist/agents/sap-core-ai-agent.d.ts +22 -0
- package/dist/agents/sap-core-ai-agent.d.ts.map +1 -0
- package/dist/agents/sap-core-ai-agent.js +20 -0
- package/dist/agents/sap-core-ai-agent.js.map +1 -0
- package/dist/cli.d.ts +53 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +313 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +24 -0
- package/dist/index.js.map +1 -0
- package/dist/llm-providers/anthropic.d.ts +21 -0
- package/dist/llm-providers/anthropic.d.ts.map +1 -0
- package/dist/llm-providers/anthropic.js +58 -0
- package/dist/llm-providers/anthropic.js.map +1 -0
- package/dist/llm-providers/base.d.ts +28 -0
- package/dist/llm-providers/base.d.ts.map +1 -0
- package/dist/llm-providers/base.js +18 -0
- package/dist/llm-providers/base.js.map +1 -0
- package/dist/llm-providers/deepseek.d.ts +21 -0
- package/dist/llm-providers/deepseek.d.ts.map +1 -0
- package/dist/llm-providers/deepseek.js +50 -0
- package/dist/llm-providers/deepseek.js.map +1 -0
- package/dist/llm-providers/index.d.ts +13 -0
- package/dist/llm-providers/index.d.ts.map +1 -0
- package/dist/llm-providers/index.js +15 -0
- package/dist/llm-providers/index.js.map +1 -0
- package/dist/llm-providers/openai.d.ts +23 -0
- package/dist/llm-providers/openai.d.ts.map +1 -0
- package/dist/llm-providers/openai.js +59 -0
- package/dist/llm-providers/openai.js.map +1 -0
- package/dist/llm-providers/sap-core-ai.d.ts +72 -0
- package/dist/llm-providers/sap-core-ai.d.ts.map +1 -0
- package/dist/llm-providers/sap-core-ai.js +114 -0
- package/dist/llm-providers/sap-core-ai.js.map +1 -0
- package/dist/mcp/client.d.ts +119 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +271 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/types.d.ts +43 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeepSeek LLM Provider
|
|
3
|
+
*/
|
|
4
|
+
import type { LLMProviderConfig, LLMResponse, Message } from '../types.js';
|
|
5
|
+
import { BaseLLMProvider } from './base.js';
|
|
6
|
+
export interface DeepSeekConfig extends LLMProviderConfig {
|
|
7
|
+
model?: string;
|
|
8
|
+
temperature?: number;
|
|
9
|
+
maxTokens?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare class DeepSeekProvider extends BaseLLMProvider {
|
|
12
|
+
private client;
|
|
13
|
+
private model;
|
|
14
|
+
constructor(config: DeepSeekConfig);
|
|
15
|
+
chat(messages: Message[]): Promise<LLMResponse>;
|
|
16
|
+
/**
|
|
17
|
+
* Format messages for DeepSeek API
|
|
18
|
+
*/
|
|
19
|
+
private formatMessages;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=deepseek.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepseek.d.ts","sourceRoot":"","sources":["../../src/llm-providers/deepseek.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,cAAe,SAAQ,iBAAiB;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE,cAAc;IAe5B,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAuBrD;;OAEG;IACH,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* DeepSeek LLM Provider
|
|
3
|
+
*/
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { BaseLLMProvider } from './base.js';
|
|
6
|
+
export class DeepSeekProvider extends BaseLLMProvider {
|
|
7
|
+
client;
|
|
8
|
+
model;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
this.validateConfig();
|
|
12
|
+
this.model = config.model || 'deepseek-chat';
|
|
13
|
+
this.client = axios.create({
|
|
14
|
+
baseURL: config.baseURL || 'https://api.deepseek.com/v1',
|
|
15
|
+
headers: {
|
|
16
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
async chat(messages) {
|
|
22
|
+
try {
|
|
23
|
+
const response = await this.client.post('/chat/completions', {
|
|
24
|
+
model: this.model,
|
|
25
|
+
messages: this.formatMessages(messages),
|
|
26
|
+
temperature: this.config.temperature || 0.7,
|
|
27
|
+
max_tokens: this.config.maxTokens || 2000,
|
|
28
|
+
});
|
|
29
|
+
const choice = response.data.choices[0];
|
|
30
|
+
return {
|
|
31
|
+
content: choice.message.content || '',
|
|
32
|
+
finishReason: choice.finish_reason,
|
|
33
|
+
raw: response.data,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
throw new Error(`DeepSeek API error: ${error.response?.data?.error?.message || error.message}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Format messages for DeepSeek API
|
|
42
|
+
*/
|
|
43
|
+
formatMessages(messages) {
|
|
44
|
+
return messages.map((msg) => ({
|
|
45
|
+
role: msg.role,
|
|
46
|
+
content: msg.content,
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=deepseek.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deepseek.js","sourceRoot":"","sources":["../../src/llm-providers/deepseek.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAA6B,MAAM,OAAO,CAAC;AAElD,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAQ5C,MAAM,OAAO,gBAAiB,SAAQ,eAAe;IAC3C,MAAM,CAAgB;IACtB,KAAK,CAA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,CAAC,QAAmB;QACxC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Provider exports
|
|
3
|
+
*
|
|
4
|
+
* NOTE: All LLM providers are accessed through SAP AI Core.
|
|
5
|
+
* Direct integrations with OpenAI/Anthropic/DeepSeek are removed.
|
|
6
|
+
* Use SapCoreAIProvider with appropriate model names to access different providers.
|
|
7
|
+
*/
|
|
8
|
+
export { type AnthropicConfig, AnthropicProvider } from './anthropic.js';
|
|
9
|
+
export { BaseLLMProvider, type LLMProvider } from './base.js';
|
|
10
|
+
export { type DeepSeekConfig, DeepSeekProvider } from './deepseek.js';
|
|
11
|
+
export { type OpenAIConfig, OpenAIProvider } from './openai.js';
|
|
12
|
+
export { type SapCoreAIConfig, SapCoreAIProvider } from './sap-core-ai.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/llm-providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,KAAK,eAAe,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAE,KAAK,cAAc,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtE,OAAO,EAAE,KAAK,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,KAAK,eAAe,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM Provider exports
|
|
3
|
+
*
|
|
4
|
+
* NOTE: All LLM providers are accessed through SAP AI Core.
|
|
5
|
+
* Direct integrations with OpenAI/Anthropic/DeepSeek are removed.
|
|
6
|
+
* Use SapCoreAIProvider with appropriate model names to access different providers.
|
|
7
|
+
*/
|
|
8
|
+
export { AnthropicProvider } from './anthropic.js';
|
|
9
|
+
export { BaseLLMProvider } from './base.js';
|
|
10
|
+
export { DeepSeekProvider } from './deepseek.js';
|
|
11
|
+
// Legacy exports (deprecated - use SapCoreAIProvider instead)
|
|
12
|
+
// These are kept for backward compatibility but will be removed in future versions
|
|
13
|
+
export { OpenAIProvider } from './openai.js';
|
|
14
|
+
export { SapCoreAIProvider } from './sap-core-ai.js';
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/llm-providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAwB,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAoB,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAuB,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtE,8DAA8D;AAC9D,mFAAmF;AACnF,OAAO,EAAqB,cAAc,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAwB,iBAAiB,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI LLM Provider
|
|
3
|
+
*/
|
|
4
|
+
import type { LLMProviderConfig, LLMResponse, Message } from '../types.js';
|
|
5
|
+
import { BaseLLMProvider } from './base.js';
|
|
6
|
+
export interface OpenAIConfig extends LLMProviderConfig {
|
|
7
|
+
model?: string;
|
|
8
|
+
temperature?: number;
|
|
9
|
+
maxTokens?: number;
|
|
10
|
+
organization?: string;
|
|
11
|
+
project?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare class OpenAIProvider extends BaseLLMProvider {
|
|
14
|
+
private client;
|
|
15
|
+
private model;
|
|
16
|
+
constructor(config: OpenAIConfig);
|
|
17
|
+
chat(messages: Message[]): Promise<LLMResponse>;
|
|
18
|
+
/**
|
|
19
|
+
* Format messages for OpenAI API
|
|
20
|
+
*/
|
|
21
|
+
private formatMessages;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../src/llm-providers/openai.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAE5C,MAAM,WAAW,YAAa,SAAQ,iBAAiB;IACrD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,qBAAa,cAAe,SAAQ,eAAe;IACjD,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,KAAK,CAAS;gBAEV,MAAM,EAAE,YAAY;IA2B1B,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAuBrD;;OAEG;IACH,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenAI LLM Provider
|
|
3
|
+
*/
|
|
4
|
+
import axios from 'axios';
|
|
5
|
+
import { BaseLLMProvider } from './base.js';
|
|
6
|
+
export class OpenAIProvider extends BaseLLMProvider {
|
|
7
|
+
client;
|
|
8
|
+
model;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
super(config);
|
|
11
|
+
this.validateConfig();
|
|
12
|
+
this.model = config.model || 'gpt-4o-mini';
|
|
13
|
+
const headers = {
|
|
14
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
15
|
+
'Content-Type': 'application/json',
|
|
16
|
+
};
|
|
17
|
+
// Add organization header if provided
|
|
18
|
+
if (config.organization) {
|
|
19
|
+
headers['OpenAI-Organization'] = config.organization;
|
|
20
|
+
}
|
|
21
|
+
// Add project header if provided
|
|
22
|
+
if (config.project) {
|
|
23
|
+
headers['OpenAI-Project'] = config.project;
|
|
24
|
+
}
|
|
25
|
+
this.client = axios.create({
|
|
26
|
+
baseURL: config.baseURL || 'https://api.openai.com/v1',
|
|
27
|
+
headers,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async chat(messages) {
|
|
31
|
+
try {
|
|
32
|
+
const response = await this.client.post('/chat/completions', {
|
|
33
|
+
model: this.model,
|
|
34
|
+
messages: this.formatMessages(messages),
|
|
35
|
+
temperature: this.config.temperature || 0.7,
|
|
36
|
+
max_tokens: this.config.maxTokens || 2000,
|
|
37
|
+
});
|
|
38
|
+
const choice = response.data.choices[0];
|
|
39
|
+
return {
|
|
40
|
+
content: choice.message.content || '',
|
|
41
|
+
finishReason: choice.finish_reason,
|
|
42
|
+
raw: response.data,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
catch (error) {
|
|
46
|
+
throw new Error(`OpenAI API error: ${error.response?.data?.error?.message || error.message}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Format messages for OpenAI API
|
|
51
|
+
*/
|
|
52
|
+
formatMessages(messages) {
|
|
53
|
+
return messages.map((msg) => ({
|
|
54
|
+
role: msg.role,
|
|
55
|
+
content: msg.content,
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=openai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|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EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,IAAI,IAAI;aAC1C,CAAC,CAAC;YAEH,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAExC,OAAO;gBACL,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE;gBACrC,YAAY,EAAE,MAAM,CAAC,aAAa;gBAClC,GAAG,EAAE,QAAQ,CAAC,IAAI;aACnB,CAAC;QACJ,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CACb,qBAAqB,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,CAC7E,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;OAEG;IACK,cAAc,CAAC,QAAmB;QACxC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAP Core AI LLM Provider
|
|
3
|
+
*
|
|
4
|
+
* Implementation of LLMProvider interface for SAP Core AI service.
|
|
5
|
+
* This provider uses SAP Cloud SDK for authentication and destination handling.
|
|
6
|
+
*
|
|
7
|
+
* All LLM providers (OpenAI, Anthropic, DeepSeek, etc.) are accessed through SAP AI Core.
|
|
8
|
+
* SAP AI Core acts as a proxy/gateway to different LLM providers.
|
|
9
|
+
*
|
|
10
|
+
* Architecture:
|
|
11
|
+
* - Agent → SAP Core AI Provider → SAP AI Core → External LLM (OpenAI/Anthropic/DeepSeek)
|
|
12
|
+
* - SAP AI Core handles authentication, routing, and provider selection
|
|
13
|
+
*/
|
|
14
|
+
import type { LLMProviderConfig, LLMResponse, Message } from '../types.js';
|
|
15
|
+
export interface SapCoreAIConfig extends LLMProviderConfig {
|
|
16
|
+
/**
|
|
17
|
+
* SAP Destination name for Core AI service
|
|
18
|
+
*/
|
|
19
|
+
destinationName: string;
|
|
20
|
+
/**
|
|
21
|
+
* Model name (optional, defaults to service default)
|
|
22
|
+
* Model selection determines which underlying LLM provider to use
|
|
23
|
+
* Examples: 'gpt-4o-mini', 'claude-3-5-sonnet', 'deepseek-chat'
|
|
24
|
+
*/
|
|
25
|
+
model?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Temperature (optional)
|
|
28
|
+
*/
|
|
29
|
+
temperature?: number;
|
|
30
|
+
/**
|
|
31
|
+
* Max tokens (optional)
|
|
32
|
+
*/
|
|
33
|
+
maxTokens?: number;
|
|
34
|
+
/**
|
|
35
|
+
* HTTP client function for making requests
|
|
36
|
+
* If not provided, will use axios (requires direct URL configuration)
|
|
37
|
+
* If provided, should use SAP Cloud SDK executeHttpRequest
|
|
38
|
+
*/
|
|
39
|
+
httpClient?: (config: {
|
|
40
|
+
destinationName: string;
|
|
41
|
+
method: string;
|
|
42
|
+
url: string;
|
|
43
|
+
headers?: Record<string, string>;
|
|
44
|
+
data?: any;
|
|
45
|
+
}) => Promise<{
|
|
46
|
+
data: any;
|
|
47
|
+
}>;
|
|
48
|
+
/**
|
|
49
|
+
* Optional logger instance
|
|
50
|
+
*/
|
|
51
|
+
log?: any;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* SAP Core AI Provider implementation
|
|
55
|
+
*
|
|
56
|
+
* Uses SAP Cloud SDK executeHttpRequest for authentication and destination handling.
|
|
57
|
+
* All LLM providers are accessed through SAP AI Core, not directly.
|
|
58
|
+
*/
|
|
59
|
+
export declare class SapCoreAIProvider {
|
|
60
|
+
private destinationName;
|
|
61
|
+
private model;
|
|
62
|
+
private config;
|
|
63
|
+
private httpClient;
|
|
64
|
+
private log?;
|
|
65
|
+
constructor(config: SapCoreAIConfig);
|
|
66
|
+
chat(messages: Message[]): Promise<LLMResponse>;
|
|
67
|
+
/**
|
|
68
|
+
* Format messages for SAP Core AI API
|
|
69
|
+
*/
|
|
70
|
+
private formatMessages;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=sap-core-ai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sap-core-ai.d.ts","sourceRoot":"","sources":["../../src/llm-providers/sap-core-ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3E,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE;QACpB,eAAe,EAAE,MAAM,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;QACf,GAAG,EAAE,MAAM,CAAC;QACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACjC,IAAI,CAAC,EAAE,GAAG,CAAC;KACZ,KAAK,OAAO,CAAC;QAAE,IAAI,EAAE,GAAG,CAAA;KAAE,CAAC,CAAC;IAE7B;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,eAAe,CAAS;IAChC,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,UAAU,CAAgC;IAClD,OAAO,CAAC,GAAG,CAAC,CAAM;gBAEN,MAAM,EAAE,eAAe;IAY7B,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAmFrD;;OAEG;IACH,OAAO,CAAC,cAAc;CAMvB"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SAP Core AI LLM Provider
|
|
3
|
+
*
|
|
4
|
+
* Implementation of LLMProvider interface for SAP Core AI service.
|
|
5
|
+
* This provider uses SAP Cloud SDK for authentication and destination handling.
|
|
6
|
+
*
|
|
7
|
+
* All LLM providers (OpenAI, Anthropic, DeepSeek, etc.) are accessed through SAP AI Core.
|
|
8
|
+
* SAP AI Core acts as a proxy/gateway to different LLM providers.
|
|
9
|
+
*
|
|
10
|
+
* Architecture:
|
|
11
|
+
* - Agent → SAP Core AI Provider → SAP AI Core → External LLM (OpenAI/Anthropic/DeepSeek)
|
|
12
|
+
* - SAP AI Core handles authentication, routing, and provider selection
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* SAP Core AI Provider implementation
|
|
16
|
+
*
|
|
17
|
+
* Uses SAP Cloud SDK executeHttpRequest for authentication and destination handling.
|
|
18
|
+
* All LLM providers are accessed through SAP AI Core, not directly.
|
|
19
|
+
*/
|
|
20
|
+
export class SapCoreAIProvider {
|
|
21
|
+
destinationName;
|
|
22
|
+
model;
|
|
23
|
+
config;
|
|
24
|
+
httpClient;
|
|
25
|
+
log; // Optional logger
|
|
26
|
+
constructor(config) {
|
|
27
|
+
if (!config.destinationName) {
|
|
28
|
+
throw new Error('SAP destination name is required for SapCoreAIProvider');
|
|
29
|
+
}
|
|
30
|
+
this.destinationName = config.destinationName;
|
|
31
|
+
this.model = config.model || 'gpt-4o-mini'; // Default model
|
|
32
|
+
this.config = config;
|
|
33
|
+
this.httpClient = config.httpClient;
|
|
34
|
+
this.log = config.log;
|
|
35
|
+
}
|
|
36
|
+
async chat(messages) {
|
|
37
|
+
try {
|
|
38
|
+
if (this.log) {
|
|
39
|
+
this.log.debug('Sending chat request to SAP Core AI', {
|
|
40
|
+
destination: this.destinationName,
|
|
41
|
+
model: this.model,
|
|
42
|
+
messageCount: messages.length,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// Format messages for SAP Core AI API
|
|
46
|
+
const requestBody = {
|
|
47
|
+
model: this.model,
|
|
48
|
+
messages: this.formatMessages(messages),
|
|
49
|
+
temperature: this.config.temperature || 0.7,
|
|
50
|
+
max_tokens: this.config.maxTokens || 2000,
|
|
51
|
+
};
|
|
52
|
+
let response;
|
|
53
|
+
if (this.httpClient) {
|
|
54
|
+
// Use provided HTTP client (typically SAP Cloud SDK)
|
|
55
|
+
// Ensure URL doesn't have trailing slash (SAP AI Core is strict about this)
|
|
56
|
+
const url = '/v1/chat/completions'.replace(/\/$/, '');
|
|
57
|
+
response = await this.httpClient({
|
|
58
|
+
destinationName: this.destinationName,
|
|
59
|
+
method: 'POST',
|
|
60
|
+
url: url,
|
|
61
|
+
headers: {
|
|
62
|
+
'Content-Type': 'application/json',
|
|
63
|
+
},
|
|
64
|
+
data: requestBody,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
// Fallback: use axios (requires direct URL configuration)
|
|
69
|
+
// This is for standalone testing without SAP SDK
|
|
70
|
+
const axios = await import('axios');
|
|
71
|
+
const baseURL = process.env.SAP_CORE_AI_URL || 'https://api.ai.core.sap';
|
|
72
|
+
response = await axios.default.post(`${baseURL}/v1/chat/completions`, requestBody, {
|
|
73
|
+
headers: {
|
|
74
|
+
'Content-Type': 'application/json',
|
|
75
|
+
},
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
const choice = response.data.choices?.[0];
|
|
79
|
+
if (!choice) {
|
|
80
|
+
throw new Error('No response from SAP Core AI');
|
|
81
|
+
}
|
|
82
|
+
if (this.log) {
|
|
83
|
+
this.log.debug('Received response from SAP Core AI', {
|
|
84
|
+
finishReason: choice.finish_reason,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
content: choice.message?.content || '',
|
|
89
|
+
finishReason: choice.finish_reason,
|
|
90
|
+
raw: response.data,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
if (this.log) {
|
|
95
|
+
this.log.error('SAP Core AI API error', {
|
|
96
|
+
destination: this.destinationName,
|
|
97
|
+
error: error.message,
|
|
98
|
+
response: error.response?.data,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
throw new Error(`SAP Core AI API error: ${error.response?.data?.error?.message || error.message}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Format messages for SAP Core AI API
|
|
106
|
+
*/
|
|
107
|
+
formatMessages(messages) {
|
|
108
|
+
return messages.map((msg) => ({
|
|
109
|
+
role: msg.role,
|
|
110
|
+
content: msg.content,
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
//# sourceMappingURL=sap-core-ai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sap-core-ai.js","sourceRoot":"","sources":["../../src/llm-providers/sap-core-ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA8CH;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IACpB,eAAe,CAAS;IACxB,KAAK,CAAS;IACd,MAAM,CAAkB;IACxB,UAAU,CAAgC;IAC1C,GAAG,CAAO,CAAC,kBAAkB;IAErC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC;YAC5B,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAC;QAC5E,CAAC;QAED,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;QAC9C,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,aAAa,CAAC,CAAC,gBAAgB;QAC5D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,UAAU,GAA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Q,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;SACrB,CAAC,CAAC,CAAC;IACN,CAAC;CACF"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Client Wrapper
|
|
3
|
+
*
|
|
4
|
+
* Wraps the MCP SDK client to provide a simpler interface for the agent
|
|
5
|
+
*/
|
|
6
|
+
import type { ToolCall, ToolResult } from '../types.js';
|
|
7
|
+
export type TransportType = 'stdio' | 'sse' | 'stream-http' | 'auto' | 'embedded';
|
|
8
|
+
export interface MCPClientConfig {
|
|
9
|
+
/**
|
|
10
|
+
* Transport type:
|
|
11
|
+
* - 'stdio': Standard input/output (for local processes)
|
|
12
|
+
* - 'sse': Server-Sent Events (GET endpoint)
|
|
13
|
+
* - 'stream-http': Streamable HTTP (POST endpoint, bidirectional NDJSON)
|
|
14
|
+
* - 'auto': Automatically detect from URL (defaults to 'stream-http' for HTTP URLs)
|
|
15
|
+
* - 'embedded': Direct MCP server instance (same process, no transport)
|
|
16
|
+
*
|
|
17
|
+
* If URL is provided and transport is 'auto', it will be detected automatically:
|
|
18
|
+
* - URLs containing '/sse' or ending with '/sse' -> 'sse'
|
|
19
|
+
* - URLs containing '/stream/http' or '/http' -> 'stream-http'
|
|
20
|
+
* - Otherwise defaults to 'stream-http'
|
|
21
|
+
*/
|
|
22
|
+
transport?: TransportType;
|
|
23
|
+
/**
|
|
24
|
+
* For embedded mode: Direct MCP server instance
|
|
25
|
+
* Use this when MCP server runs in the same process (e.g., imported as submodule)
|
|
26
|
+
* The server instance must have:
|
|
27
|
+
* - server.setRequestHandler() method for ListToolsRequestSchema and CallToolRequestSchema
|
|
28
|
+
* - Or provide tools list and tool call handler directly
|
|
29
|
+
*/
|
|
30
|
+
serverInstance?: any;
|
|
31
|
+
/**
|
|
32
|
+
* For embedded mode: Direct access to tools registry
|
|
33
|
+
* If provided, listTools() will use this instead of calling server
|
|
34
|
+
*/
|
|
35
|
+
toolsRegistry?: {
|
|
36
|
+
getAllTools: () => any[];
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* For embedded mode: Direct tool call handler
|
|
40
|
+
* If provided, callTool() will use this instead of calling server
|
|
41
|
+
*/
|
|
42
|
+
toolCallHandler?: (name: string, args: Record<string, any>) => Promise<any>;
|
|
43
|
+
/**
|
|
44
|
+
* Direct tools list provider (DI)
|
|
45
|
+
* Use this to supply tools without relying on MCP transport details.
|
|
46
|
+
*/
|
|
47
|
+
listToolsHandler?: () => Promise<any[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Direct tool call provider (DI)
|
|
50
|
+
* Use this to supply tool execution without relying on MCP transport details.
|
|
51
|
+
*/
|
|
52
|
+
callToolHandler?: (name: string, args: Record<string, any>) => Promise<any>;
|
|
53
|
+
/**
|
|
54
|
+
* For stdio: command and args to execute
|
|
55
|
+
*/
|
|
56
|
+
command?: string;
|
|
57
|
+
args?: string[];
|
|
58
|
+
/**
|
|
59
|
+
* For HTTP transports: URL endpoint
|
|
60
|
+
* Examples:
|
|
61
|
+
* - 'http://localhost:4004/mcp/stream/sse' -> SSE transport
|
|
62
|
+
* - 'http://localhost:4004/mcp/stream/http' -> Streamable HTTP transport
|
|
63
|
+
*/
|
|
64
|
+
url?: string;
|
|
65
|
+
/**
|
|
66
|
+
* Session ID for HTTP transports (optional, will be generated if not provided)
|
|
67
|
+
* For Streamable HTTP: first request should omit this, subsequent requests should include it
|
|
68
|
+
*/
|
|
69
|
+
sessionId?: string;
|
|
70
|
+
/**
|
|
71
|
+
* HTTP headers for authentication and configuration
|
|
72
|
+
*/
|
|
73
|
+
headers?: Record<string, string>;
|
|
74
|
+
/**
|
|
75
|
+
* Timeout in milliseconds (default: 30000)
|
|
76
|
+
*/
|
|
77
|
+
timeout?: number;
|
|
78
|
+
}
|
|
79
|
+
export declare class MCPClientWrapper {
|
|
80
|
+
private client;
|
|
81
|
+
private config;
|
|
82
|
+
private tools;
|
|
83
|
+
private detectedTransport;
|
|
84
|
+
private sessionId?;
|
|
85
|
+
constructor(config: MCPClientConfig);
|
|
86
|
+
/**
|
|
87
|
+
* Detect transport type from config
|
|
88
|
+
*/
|
|
89
|
+
private detectTransport;
|
|
90
|
+
/**
|
|
91
|
+
* Initialize MCP client connection
|
|
92
|
+
*/
|
|
93
|
+
connect(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Get detected transport type
|
|
96
|
+
*/
|
|
97
|
+
getTransport(): TransportType;
|
|
98
|
+
/**
|
|
99
|
+
* Get current session ID (for HTTP transports)
|
|
100
|
+
*/
|
|
101
|
+
getSessionId(): string | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Get list of available tools
|
|
104
|
+
*/
|
|
105
|
+
listTools(): Promise<any[]>;
|
|
106
|
+
/**
|
|
107
|
+
* Execute a tool call
|
|
108
|
+
*/
|
|
109
|
+
callTool(toolCall: ToolCall): Promise<ToolResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Execute multiple tool calls
|
|
112
|
+
*/
|
|
113
|
+
callTools(toolCalls: ToolCall[]): Promise<ToolResult[]>;
|
|
114
|
+
/**
|
|
115
|
+
* Disconnect from MCP server
|
|
116
|
+
*/
|
|
117
|
+
disconnect(): Promise<void>;
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/mcp/client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,KAAK,GACL,aAAa,GACb,MAAM,GACN,UAAU,CAAC;AAEf,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,a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