a2a-mesh-adapters 1.0.0
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 +171 -0
- package/README.md +20 -0
- package/dist/index.cjs +386 -0
- package/dist/index.d.cts +184 -0
- package/dist/index.d.mts +184 -0
- package/dist/index.d.ts +184 -0
- package/dist/index.mjs +378 -0
- package/package.json +82 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { A2AServer, AnyAgentCard, A2AServerOptions, Task, Message, Artifact, ExtensibleArtifact } from 'a2a-mesh';
|
|
2
|
+
import OpenAI from 'openai';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file BaseAdapter.ts
|
|
6
|
+
* Abstract base adapter for A2A implementations.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare abstract class BaseAdapter extends A2AServer {
|
|
10
|
+
constructor(card: AnyAgentCard, options?: A2AServerOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Must handle a single task and return generated artifacts.
|
|
13
|
+
*/
|
|
14
|
+
abstract handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @file OpenAIAdapter.ts
|
|
19
|
+
* Adapter wrapping modern OpenAI Chat/Responses API.
|
|
20
|
+
* Experimental: Supports textual input and output.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare class OpenAIAdapter extends BaseAdapter {
|
|
24
|
+
private client;
|
|
25
|
+
private model;
|
|
26
|
+
private systemPrompt;
|
|
27
|
+
constructor(card: AnyAgentCard, client: OpenAI, model?: string, systemPrompt?: string);
|
|
28
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
29
|
+
private extractText;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @file LangChainAdapter.ts
|
|
34
|
+
* Adapter wrapping a LangChain JS v1 runnable / compiled graph.
|
|
35
|
+
* Experimental: Maps task history to LangChain messages and invokes the runnable.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
interface LangChainRunnable {
|
|
39
|
+
invoke(input: unknown, options?: unknown): Promise<unknown>;
|
|
40
|
+
}
|
|
41
|
+
declare class LangChainAdapter extends BaseAdapter {
|
|
42
|
+
private runnable;
|
|
43
|
+
constructor(card: AnyAgentCard, runnable: LangChainRunnable);
|
|
44
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
45
|
+
private extractText;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @file AnthropicAdapter.ts
|
|
50
|
+
* Anthropic Claude Messages API adapter.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
interface AnthropicContentTextBlock {
|
|
54
|
+
type: 'text';
|
|
55
|
+
text: string;
|
|
56
|
+
}
|
|
57
|
+
interface AnthropicContentToolUseBlock {
|
|
58
|
+
type: 'tool_use';
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
input: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
type AnthropicContentBlock = AnthropicContentTextBlock | AnthropicContentToolUseBlock;
|
|
64
|
+
interface AnthropicMessageResponse {
|
|
65
|
+
content: AnthropicContentBlock[];
|
|
66
|
+
usage: {
|
|
67
|
+
input_tokens: number;
|
|
68
|
+
output_tokens: number;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface AnthropicTextDeltaEvent {
|
|
72
|
+
type: 'content_block_delta';
|
|
73
|
+
delta: {
|
|
74
|
+
type: 'text_delta';
|
|
75
|
+
text: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
interface AnthropicClientLike {
|
|
79
|
+
messages: {
|
|
80
|
+
create(payload: Record<string, unknown>): Promise<AnthropicMessageResponse> | AsyncIterable<AnthropicTextDeltaEvent>;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Adapter for Anthropic Claude Messages-compatible runtimes.
|
|
85
|
+
*
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
*/
|
|
88
|
+
declare class AnthropicAdapter extends BaseAdapter {
|
|
89
|
+
private readonly client;
|
|
90
|
+
private readonly model;
|
|
91
|
+
private readonly systemPrompt?;
|
|
92
|
+
private readonly maxTokens;
|
|
93
|
+
constructor(card: AnyAgentCard, client: AnthropicClientLike, model?: string, systemPrompt?: string | undefined, maxTokens?: number);
|
|
94
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @file GoogleADKAdapter.ts
|
|
99
|
+
* HTTP adapter for deployed Google Agent Development Kit agents.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Remote HTTP adapter for Google Agent Development Kit deployments.
|
|
104
|
+
*
|
|
105
|
+
* @experimental
|
|
106
|
+
* @since 1.0.0
|
|
107
|
+
*/
|
|
108
|
+
declare class GoogleADKAdapter extends BaseAdapter {
|
|
109
|
+
private readonly adkEndpoint;
|
|
110
|
+
private readonly apiKey?;
|
|
111
|
+
constructor(card: AnyAgentCard, adkEndpoint: string, apiKey?: string | undefined);
|
|
112
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @file LlamaIndexAdapter.ts
|
|
117
|
+
* Adapter for LlamaIndex query and chat engines.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
interface LlamaIndexNodeWithScore {
|
|
121
|
+
score?: number;
|
|
122
|
+
node?: {
|
|
123
|
+
metadata?: Record<string, unknown>;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
interface QueryEngineLike {
|
|
127
|
+
query(input: string | {
|
|
128
|
+
query: string;
|
|
129
|
+
}): Promise<string | {
|
|
130
|
+
response?: string;
|
|
131
|
+
sourceNodes?: LlamaIndexNodeWithScore[];
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
interface ChatEngineLike {
|
|
135
|
+
chat(input: string | {
|
|
136
|
+
message: string;
|
|
137
|
+
stream?: boolean;
|
|
138
|
+
chatHistory?: Array<{
|
|
139
|
+
role: 'user' | 'assistant';
|
|
140
|
+
content: string;
|
|
141
|
+
}>;
|
|
142
|
+
}): Promise<string | {
|
|
143
|
+
response?: string;
|
|
144
|
+
message?: string;
|
|
145
|
+
sourceNodes?: LlamaIndexNodeWithScore[];
|
|
146
|
+
} | AsyncIterable<{
|
|
147
|
+
response: string;
|
|
148
|
+
}>>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Adapter for LlamaIndex query and chat engines.
|
|
152
|
+
*
|
|
153
|
+
* @since 1.0.0
|
|
154
|
+
*/
|
|
155
|
+
declare class LlamaIndexAdapter extends BaseAdapter {
|
|
156
|
+
private readonly engine;
|
|
157
|
+
constructor(card: AnyAgentCard, engine: QueryEngineLike | ChatEngineLike);
|
|
158
|
+
handleTask(task: Task, message: Message): Promise<ExtensibleArtifact[]>;
|
|
159
|
+
private isChatEngine;
|
|
160
|
+
private toArtifact;
|
|
161
|
+
private isAsyncIterable;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @file CrewAIAdapter.ts
|
|
166
|
+
* Thin HTTP bridge adapter for CrewAI Python services.
|
|
167
|
+
*
|
|
168
|
+
* @beta
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Thin HTTP bridge adapter for CrewAI Python services.
|
|
173
|
+
*
|
|
174
|
+
* @beta
|
|
175
|
+
* @since 1.0.0
|
|
176
|
+
*/
|
|
177
|
+
declare class CrewAIAdapter extends BaseAdapter {
|
|
178
|
+
private readonly bridgeUrl;
|
|
179
|
+
constructor(card: AnyAgentCard, bridgeUrl: string);
|
|
180
|
+
handleTask(task: Task, message: Message): Promise<ExtensibleArtifact[]>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export { AnthropicAdapter, BaseAdapter, CrewAIAdapter, GoogleADKAdapter, LangChainAdapter, LlamaIndexAdapter, OpenAIAdapter };
|
|
184
|
+
export type { ChatEngineLike, LangChainRunnable, LlamaIndexNodeWithScore, QueryEngineLike };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { A2AServer, AnyAgentCard, A2AServerOptions, Task, Message, Artifact, ExtensibleArtifact } from 'a2a-mesh';
|
|
2
|
+
import OpenAI from 'openai';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file BaseAdapter.ts
|
|
6
|
+
* Abstract base adapter for A2A implementations.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare abstract class BaseAdapter extends A2AServer {
|
|
10
|
+
constructor(card: AnyAgentCard, options?: A2AServerOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Must handle a single task and return generated artifacts.
|
|
13
|
+
*/
|
|
14
|
+
abstract handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @file OpenAIAdapter.ts
|
|
19
|
+
* Adapter wrapping modern OpenAI Chat/Responses API.
|
|
20
|
+
* Experimental: Supports textual input and output.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare class OpenAIAdapter extends BaseAdapter {
|
|
24
|
+
private client;
|
|
25
|
+
private model;
|
|
26
|
+
private systemPrompt;
|
|
27
|
+
constructor(card: AnyAgentCard, client: OpenAI, model?: string, systemPrompt?: string);
|
|
28
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
29
|
+
private extractText;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @file LangChainAdapter.ts
|
|
34
|
+
* Adapter wrapping a LangChain JS v1 runnable / compiled graph.
|
|
35
|
+
* Experimental: Maps task history to LangChain messages and invokes the runnable.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
interface LangChainRunnable {
|
|
39
|
+
invoke(input: unknown, options?: unknown): Promise<unknown>;
|
|
40
|
+
}
|
|
41
|
+
declare class LangChainAdapter extends BaseAdapter {
|
|
42
|
+
private runnable;
|
|
43
|
+
constructor(card: AnyAgentCard, runnable: LangChainRunnable);
|
|
44
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
45
|
+
private extractText;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @file AnthropicAdapter.ts
|
|
50
|
+
* Anthropic Claude Messages API adapter.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
interface AnthropicContentTextBlock {
|
|
54
|
+
type: 'text';
|
|
55
|
+
text: string;
|
|
56
|
+
}
|
|
57
|
+
interface AnthropicContentToolUseBlock {
|
|
58
|
+
type: 'tool_use';
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
input: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
type AnthropicContentBlock = AnthropicContentTextBlock | AnthropicContentToolUseBlock;
|
|
64
|
+
interface AnthropicMessageResponse {
|
|
65
|
+
content: AnthropicContentBlock[];
|
|
66
|
+
usage: {
|
|
67
|
+
input_tokens: number;
|
|
68
|
+
output_tokens: number;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface AnthropicTextDeltaEvent {
|
|
72
|
+
type: 'content_block_delta';
|
|
73
|
+
delta: {
|
|
74
|
+
type: 'text_delta';
|
|
75
|
+
text: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
interface AnthropicClientLike {
|
|
79
|
+
messages: {
|
|
80
|
+
create(payload: Record<string, unknown>): Promise<AnthropicMessageResponse> | AsyncIterable<AnthropicTextDeltaEvent>;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Adapter for Anthropic Claude Messages-compatible runtimes.
|
|
85
|
+
*
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
*/
|
|
88
|
+
declare class AnthropicAdapter extends BaseAdapter {
|
|
89
|
+
private readonly client;
|
|
90
|
+
private readonly model;
|
|
91
|
+
private readonly systemPrompt?;
|
|
92
|
+
private readonly maxTokens;
|
|
93
|
+
constructor(card: AnyAgentCard, client: AnthropicClientLike, model?: string, systemPrompt?: string | undefined, maxTokens?: number);
|
|
94
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @file GoogleADKAdapter.ts
|
|
99
|
+
* HTTP adapter for deployed Google Agent Development Kit agents.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Remote HTTP adapter for Google Agent Development Kit deployments.
|
|
104
|
+
*
|
|
105
|
+
* @experimental
|
|
106
|
+
* @since 1.0.0
|
|
107
|
+
*/
|
|
108
|
+
declare class GoogleADKAdapter extends BaseAdapter {
|
|
109
|
+
private readonly adkEndpoint;
|
|
110
|
+
private readonly apiKey?;
|
|
111
|
+
constructor(card: AnyAgentCard, adkEndpoint: string, apiKey?: string | undefined);
|
|
112
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @file LlamaIndexAdapter.ts
|
|
117
|
+
* Adapter for LlamaIndex query and chat engines.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
interface LlamaIndexNodeWithScore {
|
|
121
|
+
score?: number;
|
|
122
|
+
node?: {
|
|
123
|
+
metadata?: Record<string, unknown>;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
interface QueryEngineLike {
|
|
127
|
+
query(input: string | {
|
|
128
|
+
query: string;
|
|
129
|
+
}): Promise<string | {
|
|
130
|
+
response?: string;
|
|
131
|
+
sourceNodes?: LlamaIndexNodeWithScore[];
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
interface ChatEngineLike {
|
|
135
|
+
chat(input: string | {
|
|
136
|
+
message: string;
|
|
137
|
+
stream?: boolean;
|
|
138
|
+
chatHistory?: Array<{
|
|
139
|
+
role: 'user' | 'assistant';
|
|
140
|
+
content: string;
|
|
141
|
+
}>;
|
|
142
|
+
}): Promise<string | {
|
|
143
|
+
response?: string;
|
|
144
|
+
message?: string;
|
|
145
|
+
sourceNodes?: LlamaIndexNodeWithScore[];
|
|
146
|
+
} | AsyncIterable<{
|
|
147
|
+
response: string;
|
|
148
|
+
}>>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Adapter for LlamaIndex query and chat engines.
|
|
152
|
+
*
|
|
153
|
+
* @since 1.0.0
|
|
154
|
+
*/
|
|
155
|
+
declare class LlamaIndexAdapter extends BaseAdapter {
|
|
156
|
+
private readonly engine;
|
|
157
|
+
constructor(card: AnyAgentCard, engine: QueryEngineLike | ChatEngineLike);
|
|
158
|
+
handleTask(task: Task, message: Message): Promise<ExtensibleArtifact[]>;
|
|
159
|
+
private isChatEngine;
|
|
160
|
+
private toArtifact;
|
|
161
|
+
private isAsyncIterable;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @file CrewAIAdapter.ts
|
|
166
|
+
* Thin HTTP bridge adapter for CrewAI Python services.
|
|
167
|
+
*
|
|
168
|
+
* @beta
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Thin HTTP bridge adapter for CrewAI Python services.
|
|
173
|
+
*
|
|
174
|
+
* @beta
|
|
175
|
+
* @since 1.0.0
|
|
176
|
+
*/
|
|
177
|
+
declare class CrewAIAdapter extends BaseAdapter {
|
|
178
|
+
private readonly bridgeUrl;
|
|
179
|
+
constructor(card: AnyAgentCard, bridgeUrl: string);
|
|
180
|
+
handleTask(task: Task, message: Message): Promise<ExtensibleArtifact[]>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export { AnthropicAdapter, BaseAdapter, CrewAIAdapter, GoogleADKAdapter, LangChainAdapter, LlamaIndexAdapter, OpenAIAdapter };
|
|
184
|
+
export type { ChatEngineLike, LangChainRunnable, LlamaIndexNodeWithScore, QueryEngineLike };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import { A2AServer, AnyAgentCard, A2AServerOptions, Task, Message, Artifact, ExtensibleArtifact } from 'a2a-mesh';
|
|
2
|
+
import OpenAI from 'openai';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file BaseAdapter.ts
|
|
6
|
+
* Abstract base adapter for A2A implementations.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
declare abstract class BaseAdapter extends A2AServer {
|
|
10
|
+
constructor(card: AnyAgentCard, options?: A2AServerOptions);
|
|
11
|
+
/**
|
|
12
|
+
* Must handle a single task and return generated artifacts.
|
|
13
|
+
*/
|
|
14
|
+
abstract handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @file OpenAIAdapter.ts
|
|
19
|
+
* Adapter wrapping modern OpenAI Chat/Responses API.
|
|
20
|
+
* Experimental: Supports textual input and output.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare class OpenAIAdapter extends BaseAdapter {
|
|
24
|
+
private client;
|
|
25
|
+
private model;
|
|
26
|
+
private systemPrompt;
|
|
27
|
+
constructor(card: AnyAgentCard, client: OpenAI, model?: string, systemPrompt?: string);
|
|
28
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
29
|
+
private extractText;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* @file LangChainAdapter.ts
|
|
34
|
+
* Adapter wrapping a LangChain JS v1 runnable / compiled graph.
|
|
35
|
+
* Experimental: Maps task history to LangChain messages and invokes the runnable.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
interface LangChainRunnable {
|
|
39
|
+
invoke(input: unknown, options?: unknown): Promise<unknown>;
|
|
40
|
+
}
|
|
41
|
+
declare class LangChainAdapter extends BaseAdapter {
|
|
42
|
+
private runnable;
|
|
43
|
+
constructor(card: AnyAgentCard, runnable: LangChainRunnable);
|
|
44
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
45
|
+
private extractText;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @file AnthropicAdapter.ts
|
|
50
|
+
* Anthropic Claude Messages API adapter.
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
interface AnthropicContentTextBlock {
|
|
54
|
+
type: 'text';
|
|
55
|
+
text: string;
|
|
56
|
+
}
|
|
57
|
+
interface AnthropicContentToolUseBlock {
|
|
58
|
+
type: 'tool_use';
|
|
59
|
+
id: string;
|
|
60
|
+
name: string;
|
|
61
|
+
input: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
type AnthropicContentBlock = AnthropicContentTextBlock | AnthropicContentToolUseBlock;
|
|
64
|
+
interface AnthropicMessageResponse {
|
|
65
|
+
content: AnthropicContentBlock[];
|
|
66
|
+
usage: {
|
|
67
|
+
input_tokens: number;
|
|
68
|
+
output_tokens: number;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
interface AnthropicTextDeltaEvent {
|
|
72
|
+
type: 'content_block_delta';
|
|
73
|
+
delta: {
|
|
74
|
+
type: 'text_delta';
|
|
75
|
+
text: string;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
interface AnthropicClientLike {
|
|
79
|
+
messages: {
|
|
80
|
+
create(payload: Record<string, unknown>): Promise<AnthropicMessageResponse> | AsyncIterable<AnthropicTextDeltaEvent>;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Adapter for Anthropic Claude Messages-compatible runtimes.
|
|
85
|
+
*
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
*/
|
|
88
|
+
declare class AnthropicAdapter extends BaseAdapter {
|
|
89
|
+
private readonly client;
|
|
90
|
+
private readonly model;
|
|
91
|
+
private readonly systemPrompt?;
|
|
92
|
+
private readonly maxTokens;
|
|
93
|
+
constructor(card: AnyAgentCard, client: AnthropicClientLike, model?: string, systemPrompt?: string | undefined, maxTokens?: number);
|
|
94
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @file GoogleADKAdapter.ts
|
|
99
|
+
* HTTP adapter for deployed Google Agent Development Kit agents.
|
|
100
|
+
*/
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* Remote HTTP adapter for Google Agent Development Kit deployments.
|
|
104
|
+
*
|
|
105
|
+
* @experimental
|
|
106
|
+
* @since 1.0.0
|
|
107
|
+
*/
|
|
108
|
+
declare class GoogleADKAdapter extends BaseAdapter {
|
|
109
|
+
private readonly adkEndpoint;
|
|
110
|
+
private readonly apiKey?;
|
|
111
|
+
constructor(card: AnyAgentCard, adkEndpoint: string, apiKey?: string | undefined);
|
|
112
|
+
handleTask(task: Task, message: Message): Promise<Artifact[]>;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* @file LlamaIndexAdapter.ts
|
|
117
|
+
* Adapter for LlamaIndex query and chat engines.
|
|
118
|
+
*/
|
|
119
|
+
|
|
120
|
+
interface LlamaIndexNodeWithScore {
|
|
121
|
+
score?: number;
|
|
122
|
+
node?: {
|
|
123
|
+
metadata?: Record<string, unknown>;
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
interface QueryEngineLike {
|
|
127
|
+
query(input: string | {
|
|
128
|
+
query: string;
|
|
129
|
+
}): Promise<string | {
|
|
130
|
+
response?: string;
|
|
131
|
+
sourceNodes?: LlamaIndexNodeWithScore[];
|
|
132
|
+
}>;
|
|
133
|
+
}
|
|
134
|
+
interface ChatEngineLike {
|
|
135
|
+
chat(input: string | {
|
|
136
|
+
message: string;
|
|
137
|
+
stream?: boolean;
|
|
138
|
+
chatHistory?: Array<{
|
|
139
|
+
role: 'user' | 'assistant';
|
|
140
|
+
content: string;
|
|
141
|
+
}>;
|
|
142
|
+
}): Promise<string | {
|
|
143
|
+
response?: string;
|
|
144
|
+
message?: string;
|
|
145
|
+
sourceNodes?: LlamaIndexNodeWithScore[];
|
|
146
|
+
} | AsyncIterable<{
|
|
147
|
+
response: string;
|
|
148
|
+
}>>;
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Adapter for LlamaIndex query and chat engines.
|
|
152
|
+
*
|
|
153
|
+
* @since 1.0.0
|
|
154
|
+
*/
|
|
155
|
+
declare class LlamaIndexAdapter extends BaseAdapter {
|
|
156
|
+
private readonly engine;
|
|
157
|
+
constructor(card: AnyAgentCard, engine: QueryEngineLike | ChatEngineLike);
|
|
158
|
+
handleTask(task: Task, message: Message): Promise<ExtensibleArtifact[]>;
|
|
159
|
+
private isChatEngine;
|
|
160
|
+
private toArtifact;
|
|
161
|
+
private isAsyncIterable;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @file CrewAIAdapter.ts
|
|
166
|
+
* Thin HTTP bridge adapter for CrewAI Python services.
|
|
167
|
+
*
|
|
168
|
+
* @beta
|
|
169
|
+
*/
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Thin HTTP bridge adapter for CrewAI Python services.
|
|
173
|
+
*
|
|
174
|
+
* @beta
|
|
175
|
+
* @since 1.0.0
|
|
176
|
+
*/
|
|
177
|
+
declare class CrewAIAdapter extends BaseAdapter {
|
|
178
|
+
private readonly bridgeUrl;
|
|
179
|
+
constructor(card: AnyAgentCard, bridgeUrl: string);
|
|
180
|
+
handleTask(task: Task, message: Message): Promise<ExtensibleArtifact[]>;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export { AnthropicAdapter, BaseAdapter, CrewAIAdapter, GoogleADKAdapter, LangChainAdapter, LlamaIndexAdapter, OpenAIAdapter };
|
|
184
|
+
export type { ChatEngineLike, LangChainRunnable, LlamaIndexNodeWithScore, QueryEngineLike };
|