@holokai/holo-provider-bedrock 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/dist/bedrock.auditor.d.ts +16 -0
- package/dist/bedrock.auditor.d.ts.map +1 -0
- package/dist/bedrock.auditor.js +74 -0
- package/dist/bedrock.auditor.js.map +1 -0
- package/dist/bedrock.pricing.d.ts +3 -0
- package/dist/bedrock.pricing.d.ts.map +1 -0
- package/dist/bedrock.pricing.js +295 -0
- package/dist/bedrock.pricing.js.map +1 -0
- package/dist/bedrock.provider.d.ts +24 -0
- package/dist/bedrock.provider.d.ts.map +1 -0
- package/dist/bedrock.provider.js +174 -0
- package/dist/bedrock.provider.js.map +1 -0
- package/dist/bedrock.response.factory.d.ts +11 -0
- package/dist/bedrock.response.factory.d.ts.map +1 -0
- package/dist/bedrock.response.factory.js +9 -0
- package/dist/bedrock.response.factory.js.map +1 -0
- package/dist/bedrock.translator.d.ts +30 -0
- package/dist/bedrock.translator.d.ts.map +1 -0
- package/dist/bedrock.translator.js +96 -0
- package/dist/bedrock.translator.js.map +1 -0
- package/dist/bedrock.wire.adapter.d.ts +9 -0
- package/dist/bedrock.wire.adapter.d.ts.map +1 -0
- package/dist/bedrock.wire.adapter.js +15 -0
- package/dist/bedrock.wire.adapter.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.d.ts +3 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +11 -0
- package/dist/manifest.js.map +1 -0
- package/dist/plugin.d.ts +52 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +145 -0
- package/dist/plugin.js.map +1 -0
- package/dist/translators/bedrock.message.translator.d.ts +10 -0
- package/dist/translators/bedrock.message.translator.d.ts.map +1 -0
- package/dist/translators/bedrock.message.translator.js +142 -0
- package/dist/translators/bedrock.message.translator.js.map +1 -0
- package/dist/translators/bedrock.request.translator.d.ts +15 -0
- package/dist/translators/bedrock.request.translator.d.ts.map +1 -0
- package/dist/translators/bedrock.request.translator.js +92 -0
- package/dist/translators/bedrock.request.translator.js.map +1 -0
- package/dist/translators/bedrock.response.translator.d.ts +13 -0
- package/dist/translators/bedrock.response.translator.d.ts.map +1 -0
- package/dist/translators/bedrock.response.translator.js +54 -0
- package/dist/translators/bedrock.response.translator.js.map +1 -0
- package/dist/translators/bedrock.tool.translator.d.ts +12 -0
- package/dist/translators/bedrock.tool.translator.d.ts.map +1 -0
- package/dist/translators/bedrock.tool.translator.js +52 -0
- package/dist/translators/bedrock.tool.translator.js.map +1 -0
- package/dist/translators/index.d.ts +6 -0
- package/dist/translators/index.d.ts.map +1 -0
- package/dist/translators/index.js +6 -0
- package/dist/translators/index.js.map +1 -0
- package/dist/translators/streaming/bedrock.content.delta.translator.d.ts +10 -0
- package/dist/translators/streaming/bedrock.content.delta.translator.d.ts.map +1 -0
- package/dist/translators/streaming/bedrock.content.delta.translator.js +36 -0
- package/dist/translators/streaming/bedrock.content.delta.translator.js.map +1 -0
- package/dist/translators/streaming/bedrock.message.stop.translator.d.ts +10 -0
- package/dist/translators/streaming/bedrock.message.stop.translator.d.ts.map +1 -0
- package/dist/translators/streaming/bedrock.message.stop.translator.js +47 -0
- package/dist/translators/streaming/bedrock.message.stop.translator.js.map +1 -0
- package/dist/translators/streaming/bedrock.stream.translator.d.ts +15 -0
- package/dist/translators/streaming/bedrock.stream.translator.d.ts.map +1 -0
- package/dist/translators/streaming/bedrock.stream.translator.js +39 -0
- package/dist/translators/streaming/bedrock.stream.translator.js.map +1 -0
- package/dist/translators/streaming/index.d.ts +4 -0
- package/dist/translators/streaming/index.d.ts.map +1 -0
- package/dist/translators/streaming/index.js +4 -0
- package/dist/translators/streaming/index.js.map +1 -0
- package/dist/types/config.types.d.ts +16 -0
- package/dist/types/config.types.d.ts.map +1 -0
- package/dist/types/config.types.js +2 -0
- package/dist/types/config.types.js.map +1 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/request.types.d.ts +10 -0
- package/dist/types/request.types.d.ts.map +1 -0
- package/dist/types/request.types.js +7 -0
- package/dist/types/request.types.js.map +1 -0
- package/dist/types/response.types.d.ts +13 -0
- package/dist/types/response.types.d.ts.map +1 -0
- package/dist/types/response.types.js +2 -0
- package/dist/types/response.types.js.map +1 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +3 -0
- package/dist/version.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HoloRequest } from '@holokai/holo-types/holo';
|
|
2
|
+
import { BaseTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
import type { BedrockConverseRequest } from '../types';
|
|
4
|
+
import { BedrockMessageTranslator } from './bedrock.message.translator';
|
|
5
|
+
import { BedrockToolTranslator } from './bedrock.tool.translator';
|
|
6
|
+
export declare class BedrockRequestTranslator extends BaseTranslator<HoloRequest, BedrockConverseRequest> {
|
|
7
|
+
private readonly messageTranslator;
|
|
8
|
+
private readonly toolTranslator;
|
|
9
|
+
protected holoDefaults: Partial<HoloRequest>;
|
|
10
|
+
protected providerDefaults: Partial<BedrockConverseRequest>;
|
|
11
|
+
constructor(messageTranslator: BedrockMessageTranslator, toolTranslator: BedrockToolTranslator);
|
|
12
|
+
protected fromHoloImpl(source: HoloRequest): Promise<Partial<BedrockConverseRequest>>;
|
|
13
|
+
protected toHoloImpl(source: BedrockConverseRequest): Promise<Partial<HoloRequest>>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=bedrock.request.translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.request.translator.d.ts","sourceRoot":"","sources":["../../src/translators/bedrock.request.translator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAc,WAAW,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAC,qBAAqB,EAAuC,MAAM,2BAA2B,CAAC;AAGtG,qBAAa,wBAAyB,SAAQ,cAAc,CAAC,WAAW,EAAE,sBAAsB,CAAC;IAKzF,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,cAAc;IALnC,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,WAAW,CAAC,CAAM;IAClD,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAM;gBAG5C,iBAAiB,EAAE,wBAAwB,EAC3C,cAAc,EAAE,qBAAqB;cAK1C,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,sBAAsB,CAAC,CAAC;cA6B3E,UAAU,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;CA0B5F"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { pickDefined } from '@holokai/holo-sdk';
|
|
2
|
+
import { BaseTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
import { fromHoloToolChoice, toHoloToolChoice } from './bedrock.tool.translator';
|
|
4
|
+
export class BedrockRequestTranslator extends BaseTranslator {
|
|
5
|
+
messageTranslator;
|
|
6
|
+
toolTranslator;
|
|
7
|
+
holoDefaults = {};
|
|
8
|
+
providerDefaults = {};
|
|
9
|
+
constructor(messageTranslator, toolTranslator) {
|
|
10
|
+
super();
|
|
11
|
+
this.messageTranslator = messageTranslator;
|
|
12
|
+
this.toolTranslator = toolTranslator;
|
|
13
|
+
}
|
|
14
|
+
async fromHoloImpl(source) {
|
|
15
|
+
const { systemMessages, otherMessages } = extractSystemMessages(source.messages);
|
|
16
|
+
const system = buildSystemBlocks(systemMessages, source.system);
|
|
17
|
+
const messages = await this.messageTranslator.fromHoloArray(otherMessages);
|
|
18
|
+
const tools = source.tools?.length
|
|
19
|
+
? await this.toolTranslator.fromHoloArray(source.tools)
|
|
20
|
+
: undefined;
|
|
21
|
+
return pickDefined({
|
|
22
|
+
modelId: source.model,
|
|
23
|
+
messages,
|
|
24
|
+
system,
|
|
25
|
+
inferenceConfig: pickDefined({
|
|
26
|
+
maxTokens: source.max_tokens,
|
|
27
|
+
temperature: source.temperature,
|
|
28
|
+
topP: source.top_p,
|
|
29
|
+
stopSequences: source.stop_sequences,
|
|
30
|
+
}),
|
|
31
|
+
toolConfig: tools?.length
|
|
32
|
+
? pickDefined({
|
|
33
|
+
tools,
|
|
34
|
+
toolChoice: fromHoloToolChoice(source.tool_choice),
|
|
35
|
+
})
|
|
36
|
+
: undefined,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async toHoloImpl(source) {
|
|
40
|
+
const messages = source.messages
|
|
41
|
+
? await this.messageTranslator.toHoloArray(source.messages)
|
|
42
|
+
: undefined;
|
|
43
|
+
const systemText = source.system
|
|
44
|
+
?.map(s => s.text)
|
|
45
|
+
.filter(Boolean)
|
|
46
|
+
.join('\n');
|
|
47
|
+
const tools = source.toolConfig?.tools
|
|
48
|
+
? await this.toolTranslator.toHoloArray(source.toolConfig.tools)
|
|
49
|
+
: undefined;
|
|
50
|
+
return pickDefined({
|
|
51
|
+
model: source.modelId ?? '',
|
|
52
|
+
messages: messages,
|
|
53
|
+
system: systemText,
|
|
54
|
+
temperature: source.inferenceConfig?.temperature,
|
|
55
|
+
top_p: source.inferenceConfig?.topP,
|
|
56
|
+
max_tokens: source.inferenceConfig?.maxTokens,
|
|
57
|
+
stop_sequences: source.inferenceConfig?.stopSequences,
|
|
58
|
+
tools,
|
|
59
|
+
tool_choice: toHoloToolChoice(source.toolConfig?.toolChoice),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
function extractSystemMessages(messages) {
|
|
64
|
+
if (!messages?.length)
|
|
65
|
+
return { systemMessages: [], otherMessages: [] };
|
|
66
|
+
const systemMessages = [];
|
|
67
|
+
const otherMessages = [];
|
|
68
|
+
for (const msg of messages) {
|
|
69
|
+
if (msg.role === 'system') {
|
|
70
|
+
systemMessages.push(msg);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
otherMessages.push(msg);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return { systemMessages, otherMessages };
|
|
77
|
+
}
|
|
78
|
+
function buildSystemBlocks(systemMessages, topLevelSystem) {
|
|
79
|
+
const blocks = [];
|
|
80
|
+
if (topLevelSystem) {
|
|
81
|
+
blocks.push({ text: topLevelSystem });
|
|
82
|
+
}
|
|
83
|
+
for (const msg of systemMessages) {
|
|
84
|
+
const text = typeof msg.content === 'string'
|
|
85
|
+
? msg.content
|
|
86
|
+
: msg.content?.filter(c => c.type === 'text').map(c => c.text).join('\n');
|
|
87
|
+
if (text)
|
|
88
|
+
blocks.push({ text });
|
|
89
|
+
}
|
|
90
|
+
return blocks.length > 0 ? blocks : undefined;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=bedrock.request.translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.request.translator.js","sourceRoot":"","sources":["../../src/translators/bedrock.request.translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAG1D,OAAO,EAAwB,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AAGtG,MAAM,OAAO,wBAAyB,SAAQ,cAAmD;IAKxE;IACA;IALX,YAAY,GAAyB,EAAE,CAAC;IACxC,gBAAgB,GAAoC,EAAE,CAAC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AAC;QAC7B,CAAC;aAAM,CAAC;YACJ,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC5B,CAAC;IACL,CAAC;IACD,OAAO,EAAC,cAAc,EAAE,aAAa,EAAC,CAAC;AAC3C,CAAC;AAED,SAAS,iBAAiB,CAAC,cAA6B,EAAE,cAAuB;IAC7E,MAAM,MAAM,GAAyB,EAAE,CAAC;IAExC,IAAI,cAAc,EAAE,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,cAAc,EAAC,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,MAAM,GAAG,IAAI,cAAc,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;YACxC,CAAC,CAAC,GAAG,CAAC,OAAO;YACb,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAE,CAAS,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvF,IAAI,IAAI;YAAE,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HoloResponse } from '@holokai/holo-types/holo';
|
|
2
|
+
import { BaseTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
import type { BedrockConverseResponse } from '../types';
|
|
4
|
+
import { BedrockMessageTranslator } from './bedrock.message.translator';
|
|
5
|
+
export declare class BedrockResponseTranslator extends BaseTranslator<HoloResponse, BedrockConverseResponse> {
|
|
6
|
+
private readonly messageTranslator;
|
|
7
|
+
protected holoDefaults: Partial<HoloResponse>;
|
|
8
|
+
protected providerDefaults: Partial<BedrockConverseResponse>;
|
|
9
|
+
constructor(messageTranslator: BedrockMessageTranslator);
|
|
10
|
+
protected fromHoloImpl(_source: HoloResponse): Promise<Partial<BedrockConverseResponse>>;
|
|
11
|
+
protected toHoloImpl(source: BedrockConverseResponse): Promise<Partial<HoloResponse>>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=bedrock.response.translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.response.translator.d.ts","sourceRoot":"","sources":["../../src/translators/bedrock.response.translator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,YAAY,EAAY,MAAM,0BAA0B,CAAC;AACrG,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAC,uBAAuB,EAAC,MAAM,UAAU,CAAC;AACtD,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAC;AAEtE,qBAAa,yBAA0B,SAAQ,cAAc,CAAC,YAAY,EAAE,uBAAuB,CAAC;IAIpF,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAH9C,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,CAAM;IACnD,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,uBAAuB,CAAC,CAAM;gBAErC,iBAAiB,EAAE,wBAAwB;cAIxD,YAAY,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;cAI9E,UAAU,CAAC,MAAM,EAAE,uBAAuB,GAAG,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;CA2B9F"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { pickDefined } from '@holokai/holo-sdk';
|
|
2
|
+
import { BaseTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
export class BedrockResponseTranslator extends BaseTranslator {
|
|
4
|
+
messageTranslator;
|
|
5
|
+
holoDefaults = {};
|
|
6
|
+
providerDefaults = {};
|
|
7
|
+
constructor(messageTranslator) {
|
|
8
|
+
super();
|
|
9
|
+
this.messageTranslator = messageTranslator;
|
|
10
|
+
}
|
|
11
|
+
async fromHoloImpl(_source) {
|
|
12
|
+
return {};
|
|
13
|
+
}
|
|
14
|
+
async toHoloImpl(source) {
|
|
15
|
+
const output = [];
|
|
16
|
+
if (source.output?.message) {
|
|
17
|
+
const holoMsg = await this.messageTranslator.toHolo(source.output.message);
|
|
18
|
+
output.push(holoMsg);
|
|
19
|
+
}
|
|
20
|
+
const usage = source.usage
|
|
21
|
+
? pickDefined({
|
|
22
|
+
input_tokens: source.usage.inputTokens,
|
|
23
|
+
output_tokens: source.usage.outputTokens,
|
|
24
|
+
total_tokens: (source.usage.inputTokens ?? 0) + (source.usage.outputTokens ?? 0) || undefined,
|
|
25
|
+
cache_read_tokens: source.usage.cacheReadInputTokens,
|
|
26
|
+
cache_write_tokens: source.usage.cacheWriteInputTokens,
|
|
27
|
+
})
|
|
28
|
+
: undefined;
|
|
29
|
+
const finish_reason = mapStopReason(source.stopReason);
|
|
30
|
+
return pickDefined({
|
|
31
|
+
model: '',
|
|
32
|
+
output,
|
|
33
|
+
finish_reason,
|
|
34
|
+
usage,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function mapStopReason(reason) {
|
|
39
|
+
switch (reason) {
|
|
40
|
+
case 'end_turn':
|
|
41
|
+
case 'stop':
|
|
42
|
+
return 'stop';
|
|
43
|
+
case 'max_tokens':
|
|
44
|
+
return 'length';
|
|
45
|
+
case 'tool_use':
|
|
46
|
+
return 'tool_calls';
|
|
47
|
+
case 'content_filtered':
|
|
48
|
+
case 'guardrail_intervened':
|
|
49
|
+
return 'content_filter';
|
|
50
|
+
default:
|
|
51
|
+
return 'stop';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=bedrock.response.translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.response.translator.js","sourceRoot":"","sources":["../../src/translators/bedrock.response.translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAI1D,MAAM,OAAO,yBAA0B,SAAQ,cAAqD;IAInE;IAHnB,YAAY,GAA0B,EAAE,CAAC;IACzC,gBAAgB,GAAqC,EAAE,CAAC;IAElE,YAA6B,iBAA2C;QACpE,KAAK,EAAE,CAAC;QADiB,sBAAiB,GAAjB,iBAAiB,CAA0B;IAExE,CAAC;IAES,KAAK,CAAC,YAAY,CAAC,OAAqB;QAC9C,OAAO,EAAE,CAAC;IACd,CAAC;IAES,KAAK,CAAC,UAAU,CAAC,MAA+B;QACtD,MAAM,MAAM,GAAkB,EAAE,CAAC;QAEjC,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC;YACzB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC3E,MAAM,CAAC,IAAI,CAAC,OAAsB,CAAC,CAAC;QACxC,CAAC;QAED,MAAM,KAAK,GAA0B,MAAM,CAAC,KAAK;YAC7C,CAAC,CAAC,WAAW,CAAC;gBACV,YAAY,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW;gBACtC,aAAa,EAAE,MAAM,CAAC,KAAK,CAAC,YAAY;gBACxC,YAAY,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,CAAC,IAAI,SAAS;gBAC7F,iBAAiB,EAAE,MAAM,CAAC,KAAK,CAAC,oBAAoB;gBACpD,kBAAkB,EAAE,MAAM,CAAC,KAAK,CAAC,qBAAqB;aACzD,CAAc;YACf,CAAC,CAAC,SAAS,CAAC;QAEhB,MAAM,aAAa,GAAqB,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAEzE,OAAO,WAAW,CAAC;YACf,KAAK,EAAE,EAAY;YACnB,MAAM;YACN,aAAa;YACb,KAAK;SACR,CAA0B,CAAC;IAChC,CAAC;CACJ;AAED,SAAS,aAAa,CAAC,MAAe;IAClC,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM;YACP,OAAO,MAAM,CAAC;QAClB,KAAK,YAAY;YACb,OAAO,QAAQ,CAAC;QACpB,KAAK,UAAU;YACX,OAAO,YAAY,CAAC;QACxB,KAAK,kBAAkB,CAAC;QACxB,KAAK,sBAAsB;YACvB,OAAO,gBAAgB,CAAC;QAC5B;YACI,OAAO,MAAM,CAAC;IACtB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HoloTool, HoloToolChoice } from '@holokai/holo-types/holo';
|
|
2
|
+
import { BaseTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
import type { Tool, ToolChoice } from '@aws-sdk/client-bedrock-runtime';
|
|
4
|
+
export declare class BedrockToolTranslator extends BaseTranslator<HoloTool, Tool> {
|
|
5
|
+
protected holoDefaults: Partial<HoloTool>;
|
|
6
|
+
protected providerDefaults: Partial<Tool>;
|
|
7
|
+
protected fromHoloImpl(source: HoloTool): Promise<Partial<Tool>>;
|
|
8
|
+
protected toHoloImpl(source: Tool): Promise<Partial<HoloTool>>;
|
|
9
|
+
}
|
|
10
|
+
export declare function fromHoloToolChoice(choice?: HoloToolChoice): ToolChoice | undefined;
|
|
11
|
+
export declare function toHoloToolChoice(choice?: ToolChoice): HoloToolChoice | undefined;
|
|
12
|
+
//# sourceMappingURL=bedrock.tool.translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.tool.translator.d.ts","sourceRoot":"","sources":["../../src/translators/bedrock.tool.translator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,QAAQ,EAAE,cAAc,EAAC,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAC1D,OAAO,KAAK,EAAC,IAAI,EAAE,UAAU,EAAoB,MAAM,iCAAiC,CAAC;AAEzF,qBAAa,qBAAsB,SAAQ,cAAc,CAAC,QAAQ,EAAE,IAAI,CAAC;IACrE,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAM;IAC/C,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAM;cAE/B,YAAY,CAAC,MAAM,EAAE,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;cAMtD,UAAU,CAAC,MAAM,EAAE,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;CAUvE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,UAAU,GAAG,SAAS,CAclF;AAED,wBAAgB,gBAAgB,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,cAAc,GAAG,SAAS,CAMhF"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { BaseTranslator } from '@holokai/holo-sdk/provider';
|
|
2
|
+
export class BedrockToolTranslator extends BaseTranslator {
|
|
3
|
+
holoDefaults = {};
|
|
4
|
+
providerDefaults = {};
|
|
5
|
+
async fromHoloImpl(source) {
|
|
6
|
+
const spec = { name: source.name, inputSchema: { json: source.parameters ?? {} } };
|
|
7
|
+
if (source.description)
|
|
8
|
+
spec.description = source.description;
|
|
9
|
+
return { toolSpec: spec };
|
|
10
|
+
}
|
|
11
|
+
async toHoloImpl(source) {
|
|
12
|
+
if (!source.toolSpec)
|
|
13
|
+
return {};
|
|
14
|
+
const result = {};
|
|
15
|
+
if (source.toolSpec.name)
|
|
16
|
+
result.name = source.toolSpec.name;
|
|
17
|
+
if (source.toolSpec.description)
|
|
18
|
+
result.description = source.toolSpec.description;
|
|
19
|
+
if (source.toolSpec.inputSchema) {
|
|
20
|
+
result.parameters = source.toolSpec.inputSchema.json;
|
|
21
|
+
}
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export function fromHoloToolChoice(choice) {
|
|
26
|
+
if (!choice)
|
|
27
|
+
return undefined;
|
|
28
|
+
switch (choice.type) {
|
|
29
|
+
case 'auto':
|
|
30
|
+
return { auto: {} };
|
|
31
|
+
case 'none':
|
|
32
|
+
return undefined;
|
|
33
|
+
case 'required':
|
|
34
|
+
return { any: {} };
|
|
35
|
+
case 'specific':
|
|
36
|
+
return { tool: { name: choice.name } };
|
|
37
|
+
default:
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
export function toHoloToolChoice(choice) {
|
|
42
|
+
if (!choice)
|
|
43
|
+
return undefined;
|
|
44
|
+
if (choice.auto)
|
|
45
|
+
return { type: 'auto' };
|
|
46
|
+
if (choice.any)
|
|
47
|
+
return { type: 'required' };
|
|
48
|
+
if (choice.tool)
|
|
49
|
+
return { type: 'specific', name: choice.tool.name };
|
|
50
|
+
return undefined;
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=bedrock.tool.translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.tool.translator.js","sourceRoot":"","sources":["../../src/translators/bedrock.tool.translator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAG1D,MAAM,OAAO,qBAAsB,SAAQ,cAA8B;IAC3D,YAAY,GAAsB,EAAE,CAAC;IACrC,gBAAgB,GAAkB,EAAE,CAAC;IAErC,KAAK,CAAC,YAAY,CAAC,MAAgB;QACzC,MAAM,IAAI,GAAsB,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE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,MAAM,UAAU,gBAAgB,CAAC,MAAmB;IAChD,IAAI,CAAC,MAAM;QAAE,OAAO,SAAS,CAAC;IAC9B,IAAI,MAAM,CAAC,IAAI;QAAE,OAAO,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;IACvC,IAAI,MAAM,CAAC,GAAG;QAAE,OAAO,EAAC,IAAI,EAAE,UAAU,EAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,IAAI;QAAE,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAK,EAAC,CAAC;IACpE,OAAO,SAAS,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { BedrockMessageTranslator } from './bedrock.message.translator';
|
|
2
|
+
export { BedrockToolTranslator, fromHoloToolChoice, toHoloToolChoice } from './bedrock.tool.translator';
|
|
3
|
+
export { BedrockRequestTranslator } from './bedrock.request.translator';
|
|
4
|
+
export { BedrockResponseTranslator } from './bedrock.response.translator';
|
|
5
|
+
export { BedrockContentDeltaTranslator, BedrockMessageStopTranslator, BedrockStreamTranslator } from './streaming';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/translators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAC,qBAAqB,EAAE,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AACtG,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAC,yBAAyB,EAAC,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAC,6BAA6B,EAAE,4BAA4B,EAAE,uBAAuB,EAAC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { BedrockMessageTranslator } from './bedrock.message.translator';
|
|
2
|
+
export { BedrockToolTranslator, fromHoloToolChoice, toHoloToolChoice } from './bedrock.tool.translator';
|
|
3
|
+
export { BedrockRequestTranslator } from './bedrock.request.translator';
|
|
4
|
+
export { BedrockResponseTranslator } from './bedrock.response.translator';
|
|
5
|
+
export { BedrockContentDeltaTranslator, BedrockMessageStopTranslator, BedrockStreamTranslator } from './streaming';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/translators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAC,qBAAqB,EAAE,kBAAkB,EAAE,gBAAgB,EAAC,MAAM,2BAA2B,CAAC;AACtG,OAAO,EAAC,wBAAwB,EAAC,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAC,yBAAyB,EAAC,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAC,6BAA6B,EAAE,4BAA4B,EAAE,uBAAuB,EAAC,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HoloStreamChunk } from '@holokai/holo-types/holo';
|
|
2
|
+
import { StreamTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
import type { ConverseStreamOutput } from '@aws-sdk/client-bedrock-runtime';
|
|
4
|
+
export declare class BedrockContentDeltaTranslator extends StreamTranslator<HoloStreamChunk, ConverseStreamOutput> {
|
|
5
|
+
protected holoDefaults: Partial<HoloStreamChunk>;
|
|
6
|
+
protected providerDefaults: Partial<ConverseStreamOutput>;
|
|
7
|
+
protected toHoloManyImpl(source: ConverseStreamOutput): Promise<Partial<HoloStreamChunk>[]>;
|
|
8
|
+
protected fromHoloManyImpl(source: HoloStreamChunk): Promise<Partial<ConverseStreamOutput>[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=bedrock.content.delta.translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.content.delta.translator.d.ts","sourceRoot":"","sources":["../../../src/translators/streaming/bedrock.content.delta.translator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AAE1E,qBAAa,6BAA8B,SAAQ,gBAAgB,CAAC,eAAe,EAAE,oBAAoB,CAAC;IACtG,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC,CAAM;IACtD,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAM;cAE/C,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;cAajF,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC;CAkBtG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { pickDefined } from '@holokai/holo-sdk';
|
|
2
|
+
import { StreamTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
export class BedrockContentDeltaTranslator extends StreamTranslator {
|
|
4
|
+
holoDefaults = {};
|
|
5
|
+
providerDefaults = {};
|
|
6
|
+
async toHoloManyImpl(source) {
|
|
7
|
+
if (!source.contentBlockDelta?.delta?.text)
|
|
8
|
+
return [];
|
|
9
|
+
return [pickDefined({
|
|
10
|
+
delta: {
|
|
11
|
+
provider: 'bedrock',
|
|
12
|
+
type: 'content_delta',
|
|
13
|
+
delta: { content: source.contentBlockDelta.delta.text },
|
|
14
|
+
provider_delta: source,
|
|
15
|
+
}
|
|
16
|
+
})];
|
|
17
|
+
}
|
|
18
|
+
async fromHoloManyImpl(source) {
|
|
19
|
+
const d = source.delta;
|
|
20
|
+
if (!d || d.type !== 'content_delta')
|
|
21
|
+
return [];
|
|
22
|
+
if (d.provider === 'bedrock' && d.provider_delta) {
|
|
23
|
+
return [d.provider_delta];
|
|
24
|
+
}
|
|
25
|
+
const text = d.delta?.content;
|
|
26
|
+
if (typeof text !== 'string' || !text.length)
|
|
27
|
+
return [];
|
|
28
|
+
return [{
|
|
29
|
+
contentBlockDelta: {
|
|
30
|
+
contentBlockIndex: 0,
|
|
31
|
+
delta: { text },
|
|
32
|
+
}
|
|
33
|
+
}];
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=bedrock.content.delta.translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.content.delta.translator.js","sourceRoot":"","sources":["../../../src/translators/streaming/bedrock.content.delta.translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAG5D,MAAM,OAAO,6BAA8B,SAAQ,gBAAuD;IAC5F,YAAY,GAA6B,EAAE,CAAC;IAC5C,gBAAgB,GAAkC,EAAE,CAAC;IAErD,KAAK,CAAC,cAAc,CAAC,MAA4B;QACvD,IAAI,CAAC,MAAM,CAAC,iBAAiB,EAAE,KAAK,EAAE,IAAI;YAAE,OAAO,EAAE,CAAC;QAEtD,OAAO,CAAC,WAAW,CAAC;gBAChB,KAAK,EAAE;oBACH,QAAQ,EAAE,SAAS;oBACnB,IAAI,EAAE,eAAwB;oBAC9B,KAAK,EAAE,EAAC,OAAO,EAAE,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,IAAI,EAAC;oBACrD,cAAc,EAAE,MAAM;iBACzB;aACJ,CAA6B,CAAC,CAAC;IACpC,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,MAAuB;QACpD,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;QACvB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,eAAe;YAAE,OAAO,EAAE,CAAC;QAEhD,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;YAC/C,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC9B,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,OAAO,CAAC;QAC9B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,EAAE,CAAC;QAExD,OAAO,CAAC;gBACJ,iBAAiB,EAAE;oBACf,iBAAiB,EAAE,CAAC;oBACpB,KAAK,EAAE,EAAC,IAAI,EAAC;iBAChB;aACJ,CAAC,CAAC;IACP,CAAC;CACJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { HoloStreamChunk } from '@holokai/holo-types/holo';
|
|
2
|
+
import { StreamTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
import type { ConverseStreamOutput } from '@aws-sdk/client-bedrock-runtime';
|
|
4
|
+
export declare class BedrockMessageStopTranslator extends StreamTranslator<HoloStreamChunk, ConverseStreamOutput> {
|
|
5
|
+
protected holoDefaults: Partial<HoloStreamChunk>;
|
|
6
|
+
protected providerDefaults: Partial<ConverseStreamOutput>;
|
|
7
|
+
protected toHoloManyImpl(source: ConverseStreamOutput): Promise<Partial<HoloStreamChunk>[]>;
|
|
8
|
+
protected fromHoloManyImpl(source: HoloStreamChunk): Promise<Partial<ConverseStreamOutput>[]>;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=bedrock.message.stop.translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.message.stop.translator.d.ts","sourceRoot":"","sources":["../../../src/translators/streaming/bedrock.message.stop.translator.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AAE1E,qBAAa,4BAA6B,SAAQ,gBAAgB,CAAC,eAAe,EAAE,oBAAoB,CAAC;IACrG,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC,CAAM;IACtD,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAM;cAE/C,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;cAcjF,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC;CAYtG"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { pickDefined } from '@holokai/holo-sdk';
|
|
2
|
+
import { StreamTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
export class BedrockMessageStopTranslator extends StreamTranslator {
|
|
4
|
+
holoDefaults = {};
|
|
5
|
+
providerDefaults = {};
|
|
6
|
+
async toHoloManyImpl(source) {
|
|
7
|
+
if (!source.messageStop)
|
|
8
|
+
return [];
|
|
9
|
+
return [pickDefined({
|
|
10
|
+
delta: {
|
|
11
|
+
provider: 'bedrock',
|
|
12
|
+
type: 'message_stop',
|
|
13
|
+
delta: {},
|
|
14
|
+
provider_delta: source,
|
|
15
|
+
},
|
|
16
|
+
finish_reason: mapStopReason(source.messageStop.stopReason),
|
|
17
|
+
})];
|
|
18
|
+
}
|
|
19
|
+
async fromHoloManyImpl(source) {
|
|
20
|
+
const d = source.delta;
|
|
21
|
+
if (!d || d.type !== 'message_stop')
|
|
22
|
+
return [];
|
|
23
|
+
if (d.provider === 'bedrock' && d.provider_delta) {
|
|
24
|
+
return [d.provider_delta];
|
|
25
|
+
}
|
|
26
|
+
return [{
|
|
27
|
+
messageStop: { stopReason: 'end_turn' },
|
|
28
|
+
}];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function mapStopReason(reason) {
|
|
32
|
+
switch (reason) {
|
|
33
|
+
case 'end_turn':
|
|
34
|
+
case 'stop':
|
|
35
|
+
return 'stop';
|
|
36
|
+
case 'max_tokens':
|
|
37
|
+
return 'length';
|
|
38
|
+
case 'tool_use':
|
|
39
|
+
return 'tool_calls';
|
|
40
|
+
case 'content_filtered':
|
|
41
|
+
case 'guardrail_intervened':
|
|
42
|
+
return 'content_filter';
|
|
43
|
+
default:
|
|
44
|
+
return 'stop';
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=bedrock.message.stop.translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.message.stop.translator.js","sourceRoot":"","sources":["../../../src/translators/streaming/bedrock.message.stop.translator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAE9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAG5D,MAAM,OAAO,4BAA6B,SAAQ,gBAAuD;IAC3F,YAAY,GAA6B,EAAE,CAAC;IAC5C,gBAAgB,GAAkC,EAAE,CAAC;IAErD,KAAK,CAAC,cAAc,CAAC,MAA4B;QACvD,IAAI,CAAC,MAAM,CAAC,WAAW;YAAE,OAAO,EAAE,CAAC;QAEnC,OAAO,CAAC,WAAW,CAAC;gBAChB,KAAK,EAAE;oBACH,QAAQ,EAAE,SAAS;oBACnB,IAAI,EAAE,cAAuB;oBAC7B,KAAK,EAAE,EAAE;oBACT,cAAc,EAAE,MAAM;iBACzB;gBACD,aAAa,EAAE,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC;aAC9D,CAA6B,CAAC,CAAC;IACpC,CAAC;IAES,KAAK,CAAC,gBAAgB,CAAC,MAAuB;QACpD,MAAM,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC;QACvB,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,cAAc;YAAE,OAAO,EAAE,CAAC;QAE/C,IAAI,CAAC,CAAC,QAAQ,KAAK,SAAS,IAAI,CAAC,CAAC,cAAc,EAAE,CAAC;YAC/C,OAAO,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC9B,CAAC;QAED,OAAO,CAAC;gBACJ,WAAW,EAAE,EAAC,UAAU,EAAE,UAAU,EAAC;aACxC,CAAC,CAAC;IACP,CAAC;CACJ;AAED,SAAS,aAAa,CAAC,MAAe;IAClC,QAAQ,MAAM,EAAE,CAAC;QACb,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM;YACP,OAAO,MAAM,CAAC;QAClB,KAAK,YAAY;YACb,OAAO,QAAQ,CAAC;QACpB,KAAK,UAAU;YACX,OAAO,YAAY,CAAC;QACxB,KAAK,kBAAkB,CAAC;QACxB,KAAK,sBAAsB;YACvB,OAAO,gBAAgB,CAAC;QAC5B;YACI,OAAO,MAAM,CAAC;IACtB,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HoloStreamChunk } from '@holokai/holo-types/holo';
|
|
2
|
+
import { StreamTranslator } from '@holokai/holo-sdk/provider';
|
|
3
|
+
import type { ConverseStreamOutput } from '@aws-sdk/client-bedrock-runtime';
|
|
4
|
+
import { BedrockContentDeltaTranslator } from './bedrock.content.delta.translator';
|
|
5
|
+
import { BedrockMessageStopTranslator } from './bedrock.message.stop.translator';
|
|
6
|
+
export declare class BedrockStreamTranslator extends StreamTranslator<HoloStreamChunk, ConverseStreamOutput> {
|
|
7
|
+
private readonly contentDeltaTranslator;
|
|
8
|
+
private readonly messageStopTranslator;
|
|
9
|
+
protected holoDefaults: Partial<HoloStreamChunk>;
|
|
10
|
+
protected providerDefaults: Partial<ConverseStreamOutput>;
|
|
11
|
+
constructor(contentDeltaTranslator: BedrockContentDeltaTranslator, messageStopTranslator: BedrockMessageStopTranslator);
|
|
12
|
+
protected toHoloManyImpl(source: ConverseStreamOutput): Promise<Partial<HoloStreamChunk>[]>;
|
|
13
|
+
protected fromHoloManyImpl(source: HoloStreamChunk): Promise<Partial<ConverseStreamOutput>[]>;
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=bedrock.stream.translator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.stream.translator.d.ts","sourceRoot":"","sources":["../../../src/translators/streaming/bedrock.stream.translator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAC,6BAA6B,EAAC,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAE/E,qBAAa,uBAAwB,SAAQ,gBAAgB,CAAC,eAAe,EAAE,oBAAoB,CAAC;IAK5F,OAAO,CAAC,QAAQ,CAAC,sBAAsB;IACvC,OAAO,CAAC,QAAQ,CAAC,qBAAqB;IAL1C,SAAS,CAAC,YAAY,EAAE,OAAO,CAAC,eAAe,CAAC,CAAM;IACtD,SAAS,CAAC,gBAAgB,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAM;gBAG1C,sBAAsB,EAAE,6BAA6B,EACrD,qBAAqB,EAAE,4BAA4B;cAKxD,cAAc,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,CAAC;cAcjF,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,EAAE,CAAC;CAiBtG"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { StreamTranslator } from '@holokai/holo-sdk/provider';
|
|
2
|
+
export class BedrockStreamTranslator extends StreamTranslator {
|
|
3
|
+
contentDeltaTranslator;
|
|
4
|
+
messageStopTranslator;
|
|
5
|
+
holoDefaults = {};
|
|
6
|
+
providerDefaults = {};
|
|
7
|
+
constructor(contentDeltaTranslator, messageStopTranslator) {
|
|
8
|
+
super();
|
|
9
|
+
this.contentDeltaTranslator = contentDeltaTranslator;
|
|
10
|
+
this.messageStopTranslator = messageStopTranslator;
|
|
11
|
+
}
|
|
12
|
+
async toHoloManyImpl(source) {
|
|
13
|
+
const results = [];
|
|
14
|
+
if (source.contentBlockDelta) {
|
|
15
|
+
results.push(...await this.contentDeltaTranslator.toHoloMany(source));
|
|
16
|
+
}
|
|
17
|
+
if (source.messageStop) {
|
|
18
|
+
results.push(...await this.messageStopTranslator.toHoloMany(source));
|
|
19
|
+
}
|
|
20
|
+
return results;
|
|
21
|
+
}
|
|
22
|
+
async fromHoloManyImpl(source) {
|
|
23
|
+
const d = source.delta;
|
|
24
|
+
if (!d)
|
|
25
|
+
return [];
|
|
26
|
+
if (d.provider === 'bedrock' && d.provider_delta) {
|
|
27
|
+
return [d.provider_delta];
|
|
28
|
+
}
|
|
29
|
+
switch (d.type) {
|
|
30
|
+
case 'content_delta':
|
|
31
|
+
return this.contentDeltaTranslator.fromHoloMany(source);
|
|
32
|
+
case 'message_stop':
|
|
33
|
+
return this.messageStopTranslator.fromHoloMany(source);
|
|
34
|
+
default:
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=bedrock.stream.translator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bedrock.stream.translator.js","sourceRoot":"","sources":["../../../src/translators/streaming/bedrock.stream.translator.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAK5D,MAAM,OAAO,uBAAwB,SAAQ,gBAAuD;IAK3E;I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|
1
|
+
export { BedrockContentDeltaTranslator } from './bedrock.content.delta.translator';
|
|
2
|
+
export { BedrockMessageStopTranslator } from './bedrock.message.stop.translator';
|
|
3
|
+
export { BedrockStreamTranslator } from './bedrock.stream.translator';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/translators/streaming/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { BedrockContentDeltaTranslator } from './bedrock.content.delta.translator';
|
|
2
|
+
export { BedrockMessageStopTranslator } from './bedrock.message.stop.translator';
|
|
3
|
+
export { BedrockStreamTranslator } from './bedrock.stream.translator';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/translators/streaming/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,6BAA6B,EAAC,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAC,4BAA4B,EAAC,MAAM,mCAAmC,CAAC;AAC/E,OAAO,EAAC,uBAAuB,EAAC,MAAM,6BAA6B,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface BedrockCredentials {
|
|
2
|
+
accessKeyId: string;
|
|
3
|
+
secretAccessKey: string;
|
|
4
|
+
sessionToken?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface BedrockProviderConfig {
|
|
7
|
+
region: string;
|
|
8
|
+
credentials?: BedrockCredentials;
|
|
9
|
+
endpoint?: string;
|
|
10
|
+
maxAttempts?: number;
|
|
11
|
+
requestTimeout?: number;
|
|
12
|
+
connectionTimeout?: number;
|
|
13
|
+
customUserAgent?: string;
|
|
14
|
+
tls?: boolean;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=config.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.types.d.ts","sourceRoot":"","sources":["../../src/types/config.types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,kBAAkB,CAAC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,GAAG,CAAC,EAAE,OAAO,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.types.js","sourceRoot":"","sources":["../../src/types/config.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConverseCommandInput } from '@aws-sdk/client-bedrock-runtime';
|
|
2
|
+
export type BedrockConverseRequest = ConverseCommandInput;
|
|
3
|
+
export interface BedrockEmbedRequest {
|
|
4
|
+
modelId: string;
|
|
5
|
+
body: Record<string, unknown>;
|
|
6
|
+
}
|
|
7
|
+
export type BedrockRequest = BedrockConverseRequest | BedrockEmbedRequest;
|
|
8
|
+
export declare function isTitanEmbed(modelId: string): boolean;
|
|
9
|
+
export declare function isCohereEmbed(modelId: string): boolean;
|
|
10
|
+
//# sourceMappingURL=request.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.types.d.ts","sourceRoot":"","sources":["../../src/types/request.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,iCAAiC,CAAC;AAE1E,MAAM,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAE1D,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,cAAc,GAAG,sBAAsB,GAAG,mBAAmB,CAAC;AAE1E,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.types.js","sourceRoot":"","sources":["../../src/types/request.types.ts"],"names":[],"mappings":"AAWA,MAAM,UAAU,YAAY,CAAC,OAAe;IACxC,OAAO,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe;IACzC,OAAO,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ConverseCommandOutput } from '@aws-sdk/client-bedrock-runtime';
|
|
2
|
+
export type BedrockConverseResponse = ConverseCommandOutput;
|
|
3
|
+
export interface TitanEmbedResponse {
|
|
4
|
+
embedding: number[];
|
|
5
|
+
inputTextTokenCount?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface CohereEmbedResponse {
|
|
8
|
+
embeddings: number[][];
|
|
9
|
+
id?: string;
|
|
10
|
+
texts?: string[];
|
|
11
|
+
}
|
|
12
|
+
export type BedrockEmbedResponse = TitanEmbedResponse | CohereEmbedResponse;
|
|
13
|
+
//# sourceMappingURL=response.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.types.d.ts","sourceRoot":"","sources":["../../src/types/response.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,iCAAiC,CAAC;AAE3E,MAAM,MAAM,uBAAuB,GAAG,qBAAqB,CAAC;AAE5D,MAAM,WAAW,kBAAkB;IAC/B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,MAAM,EAAE,EAAE,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,oBAAoB,GAAG,kBAAkB,GAAG,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"response.types.js","sourceRoot":"","sources":["../../src/types/response.types.ts"],"names":[],"mappings":""}
|