@zimtsui/brainswitch 0.0.56 → 0.0.59
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 +109 -54
- package/assets/verbatim/declarations.handlebars +11 -0
- package/assets/verbatim/instruction.md +49 -0
- package/build/adaptor.d.ts +40 -9
- package/build/adaptor.js +36 -38
- package/build/adaptor.js.map +1 -1
- package/build/api-types/anthropic/billing.d.ts +5 -5
- package/build/api-types/anthropic/billing.js +1 -2
- package/build/api-types/anthropic/billing.js.map +1 -1
- package/build/api-types/anthropic/tool-codec.d.ts +11 -12
- package/build/api-types/anthropic/tool-codec.js +27 -42
- package/build/api-types/anthropic/tool-codec.js.map +1 -1
- package/build/api-types/google/billing.d.ts +5 -5
- package/build/api-types/google/billing.js +2 -3
- package/build/api-types/google/billing.js.map +1 -1
- package/build/api-types/google/restful-request.d.ts +1 -1
- package/build/api-types/google/restful-request.js +0 -1
- package/build/api-types/google/restful-request.js.map +1 -1
- package/build/api-types/google/tool-codec.d.ts +11 -11
- package/build/api-types/google/tool-codec.js +21 -19
- package/build/api-types/google/tool-codec.js.map +1 -1
- package/build/api-types/{openai-chatcompletion → openai-chatcompletions}/billing.d.ts +2 -3
- package/build/api-types/{openai-chatcompletion → openai-chatcompletions}/billing.js +0 -2
- package/build/api-types/openai-chatcompletions/billing.js.map +1 -0
- package/build/api-types/openai-chatcompletions/tool-codec.d.ts +17 -0
- package/build/api-types/{openai-chatcompletion → openai-chatcompletions}/tool-codec.js +26 -32
- package/build/api-types/openai-chatcompletions/tool-codec.js.map +1 -0
- package/build/api-types/openai-responses/billing.d.ts +5 -5
- package/build/api-types/openai-responses/billing.js +1 -2
- package/build/api-types/openai-responses/billing.js.map +1 -1
- package/build/api-types/openai-responses/tool-codec.d.ts +11 -11
- package/build/api-types/openai-responses/tool-codec.js +36 -32
- package/build/api-types/openai-responses/tool-codec.js.map +1 -1
- package/build/assets.d.ts +7 -0
- package/build/assets.js +8 -0
- package/build/assets.js.map +1 -0
- package/build/compatible-engine/session.d.ts +67 -0
- package/build/compatible-engine/session.js +92 -0
- package/build/compatible-engine/session.js.map +1 -0
- package/build/compatible-engine/structuring.d.ts +36 -0
- package/build/compatible-engine/structuring.js +34 -0
- package/build/compatible-engine/structuring.js.map +1 -0
- package/build/compatible-engine/validation.d.ts +21 -0
- package/build/compatible-engine/validation.js +82 -0
- package/build/compatible-engine/validation.js.map +1 -0
- package/build/compatible-engine.d/agentloop.d.ts +12 -0
- package/build/compatible-engine.d/agentloop.js +52 -0
- package/build/compatible-engine.d/agentloop.js.map +1 -0
- package/build/compatible-engine.d/aliyun/transport.d.ts +12 -0
- package/build/compatible-engine.d/aliyun/transport.js +7 -0
- package/build/compatible-engine.d/aliyun/transport.js.map +1 -0
- package/build/compatible-engine.d/aliyun.d.ts +24 -0
- package/build/compatible-engine.d/aliyun.js +46 -0
- package/build/compatible-engine.d/aliyun.js.map +1 -0
- package/build/compatible-engine.d/anthropic/choice-codec.d.ts +5 -0
- package/build/compatible-engine.d/anthropic/choice-codec.js +26 -0
- package/build/compatible-engine.d/anthropic/choice-codec.js.map +1 -0
- package/build/compatible-engine.d/anthropic/message-codec.d.ts +36 -0
- package/build/compatible-engine.d/anthropic/message-codec.js +86 -0
- package/build/compatible-engine.d/anthropic/message-codec.js.map +1 -0
- package/build/compatible-engine.d/anthropic/transport.d.ts +34 -0
- package/build/compatible-engine.d/anthropic/transport.js +150 -0
- package/build/compatible-engine.d/anthropic/transport.js.map +1 -0
- package/build/compatible-engine.d/anthropic.d.ts +26 -0
- package/build/compatible-engine.d/anthropic.js +46 -0
- package/build/compatible-engine.d/anthropic.js.map +1 -0
- package/build/compatible-engine.d/google/choice-codec.d.ts +5 -0
- package/build/compatible-engine.d/google/choice-codec.js +27 -0
- package/build/compatible-engine.d/google/choice-codec.js.map +1 -0
- package/build/compatible-engine.d/google/message-codec.d.ts +36 -0
- package/build/compatible-engine.d/google/message-codec.js +94 -0
- package/build/compatible-engine.d/google/message-codec.js.map +1 -0
- package/build/compatible-engine.d/google/transport.d.ts +30 -0
- package/build/{compatible.d → compatible-engine.d}/google/transport.js +22 -18
- package/build/compatible-engine.d/google/transport.js.map +1 -0
- package/build/compatible-engine.d/google.d.ts +26 -0
- package/build/compatible-engine.d/google.js +50 -0
- package/build/compatible-engine.d/google.js.map +1 -0
- package/build/compatible-engine.d/openai-chatcompletions/choice-codec.d.ts +5 -0
- package/build/compatible-engine.d/openai-chatcompletions/choice-codec.js +31 -0
- package/build/compatible-engine.d/openai-chatcompletions/choice-codec.js.map +1 -0
- package/build/compatible-engine.d/openai-chatcompletions/message-codec.d.ts +24 -0
- package/build/compatible-engine.d/openai-chatcompletions/message-codec.js +71 -0
- package/build/compatible-engine.d/openai-chatcompletions/message-codec.js.map +1 -0
- package/build/compatible-engine.d/openai-chatcompletions/transport.d/monolith.d.ts +38 -0
- package/build/{compatible.d/openai-chatcompletions.d → compatible-engine.d/openai-chatcompletions/transport.d}/monolith.js +25 -22
- package/build/compatible-engine.d/openai-chatcompletions/transport.d/monolith.js.map +1 -0
- package/build/compatible-engine.d/openai-chatcompletions/transport.d/stream.d.ts +37 -0
- package/build/compatible-engine.d/openai-chatcompletions/transport.d/stream.js +190 -0
- package/build/compatible-engine.d/openai-chatcompletions/transport.d/stream.js.map +1 -0
- package/build/compatible-engine.d/openai-chatcompletions/transport.d.ts +10 -0
- package/build/compatible-engine.d/openai-chatcompletions/transport.js +11 -0
- package/build/compatible-engine.d/openai-chatcompletions/transport.js.map +1 -0
- package/build/compatible-engine.d/openai-chatcompletions.d.ts +17 -0
- package/build/compatible-engine.d/openai-chatcompletions.js +14 -0
- package/build/compatible-engine.d/openai-chatcompletions.js.map +1 -0
- package/build/compatible-engine.d/openai-responses/choice-codec.d.ts +5 -0
- package/build/compatible-engine.d/openai-responses/choice-codec.js +30 -0
- package/build/compatible-engine.d/openai-responses/choice-codec.js.map +1 -0
- package/build/compatible-engine.d/openai-responses/message-codec.d.ts +36 -0
- package/build/compatible-engine.d/openai-responses/message-codec.js +96 -0
- package/build/compatible-engine.d/openai-responses/message-codec.js.map +1 -0
- package/build/compatible-engine.d/openai-responses/transport.d.ts +35 -0
- package/build/{compatible.d → compatible-engine.d}/openai-responses/transport.js +21 -29
- package/build/compatible-engine.d/openai-responses/transport.js.map +1 -0
- package/build/compatible-engine.d/openai-responses.d.ts +26 -0
- package/build/compatible-engine.d/openai-responses.js +46 -0
- package/build/compatible-engine.d/openai-responses.js.map +1 -0
- package/build/compatible-engine.d.ts +22 -0
- package/build/compatible-engine.js +29 -0
- package/build/compatible-engine.js.map +1 -0
- package/build/config.d.ts +1 -0
- package/build/config.js +1 -2
- package/build/config.js.map +1 -1
- package/build/endpoint-spec.d.ts +1 -0
- package/build/endpoint-spec.js +2 -1
- package/build/endpoint-spec.js.map +1 -1
- package/build/engine/session.d.ts +7 -0
- package/build/{session.js.map → engine/session.js.map} +1 -1
- package/build/engine/transport.d.ts +5 -0
- package/build/engine/transport.js +1 -0
- package/build/engine/transport.js.map +1 -0
- package/build/engine/validation.d.ts +9 -0
- package/build/engine/validation.js +1 -0
- package/build/engine/validation.js.map +1 -0
- package/build/engine.d.ts +49 -40
- package/build/engine.js +88 -70
- package/build/engine.js.map +1 -1
- package/build/exports.d.ts +14 -14
- package/build/exports.js +14 -14
- package/build/exports.js.map +1 -1
- package/build/function.d.ts +79 -66
- package/build/function.js +30 -47
- package/build/function.js.map +1 -1
- package/build/inference-context.d.ts +2 -2
- package/build/inference-context.js +0 -1
- package/build/inference-context.js.map +1 -1
- package/build/native-engines.d/google/message-codec.d.ts +18 -16
- package/build/native-engines.d/google/message-codec.js +31 -33
- package/build/native-engines.d/google/message-codec.js.map +1 -1
- package/build/native-engines.d/google/session.d.ts +44 -51
- package/build/native-engines.d/google/session.js +85 -81
- package/build/native-engines.d/google/session.js.map +1 -1
- package/build/native-engines.d/google/transport.d.ts +22 -19
- package/build/native-engines.d/google/transport.js +13 -13
- package/build/native-engines.d/google/transport.js.map +1 -1
- package/build/native-engines.d/google/validation.d.ts +22 -0
- package/build/native-engines.d/google/validation.js +20 -0
- package/build/native-engines.d/google/validation.js.map +1 -0
- package/build/native-engines.d/google.d/agentloop.d.ts +12 -0
- package/build/native-engines.d/google.d/agentloop.js +57 -0
- package/build/native-engines.d/google.d/agentloop.js.map +1 -0
- package/build/native-engines.d/google.d/exports.d.ts +3 -0
- package/build/native-engines.d/google.d/exports.js +4 -0
- package/build/native-engines.d/google.d/exports.js.map +1 -0
- package/build/native-engines.d/google.d.ts +42 -0
- package/build/native-engines.d/google.js +83 -0
- package/build/native-engines.d/google.js.map +1 -0
- package/build/native-engines.d/openai-responses/choice-codec.d.ts +5 -0
- package/build/native-engines.d/openai-responses/choice-codec.js +30 -0
- package/build/native-engines.d/openai-responses/choice-codec.js.map +1 -0
- package/build/native-engines.d/openai-responses/message-codec.d.ts +19 -17
- package/build/native-engines.d/openai-responses/message-codec.js +31 -25
- package/build/native-engines.d/openai-responses/message-codec.js.map +1 -1
- package/build/native-engines.d/openai-responses/session.d.ts +47 -45
- package/build/native-engines.d/openai-responses/session.js +75 -105
- package/build/native-engines.d/openai-responses/session.js.map +1 -1
- package/build/native-engines.d/openai-responses/structuring.d.ts +19 -0
- package/build/native-engines.d/openai-responses/structuring.js +19 -0
- package/build/native-engines.d/openai-responses/structuring.js.map +1 -0
- package/build/native-engines.d/openai-responses/tool.d.ts +15 -12
- package/build/native-engines.d/openai-responses/tool.js +1 -12
- package/build/native-engines.d/openai-responses/tool.js.map +1 -1
- package/build/native-engines.d/openai-responses/transport.d.ts +24 -25
- package/build/native-engines.d/openai-responses/transport.js +21 -41
- package/build/native-engines.d/openai-responses/transport.js.map +1 -1
- package/build/native-engines.d/openai-responses/validation.d.ts +20 -0
- package/build/native-engines.d/openai-responses/validation.js +80 -0
- package/build/native-engines.d/openai-responses/validation.js.map +1 -0
- package/build/native-engines.d/openai-responses.d/agentloop.d.ts +12 -0
- package/build/native-engines.d/openai-responses.d/agentloop.js +61 -0
- package/build/native-engines.d/openai-responses.d/agentloop.js.map +1 -0
- package/build/native-engines.d/openai-responses.d/exports.d.ts +4 -0
- package/build/native-engines.d/openai-responses.d/exports.js +5 -0
- package/build/native-engines.d/openai-responses.d/exports.js.map +1 -0
- package/build/native-engines.d/openai-responses.d.ts +44 -0
- package/build/native-engines.d/openai-responses.js +78 -0
- package/build/native-engines.d/openai-responses.js.map +1 -0
- package/build/throttle.d.ts +6 -5
- package/build/throttle.js +17 -14
- package/build/throttle.js.map +1 -1
- package/build/tsconfig.tsbuildinfo +1 -1
- package/build/verbatim/codec/declarations.d.ts +2 -0
- package/build/verbatim/codec/declarations.js +22 -0
- package/build/verbatim/codec/declarations.js.map +1 -0
- package/build/verbatim/codec/request.d.ts +7 -0
- package/build/verbatim/codec/request.js +53 -0
- package/build/verbatim/codec/request.js.map +1 -0
- package/build/verbatim/codec.d.ts +2 -0
- package/build/verbatim/codec.js +3 -0
- package/build/verbatim/codec.js.map +1 -0
- package/build/verbatim.d.ts +74 -0
- package/build/verbatim.js +17 -0
- package/build/verbatim.js.map +1 -0
- package/examples/agent.ts +65 -0
- package/examples/chat.ts +24 -0
- package/examples/config.ts +24 -0
- package/{test/src → examples}/tsconfig.json +6 -2
- package/examples/verbatim.ts +44 -0
- package/package.json +15 -13
- package/build/agentloop.d.ts +0 -12
- package/build/agentloop.js +0 -43
- package/build/agentloop.js.map +0 -1
- package/build/api-types/openai-chatcompletion/billing.js.map +0 -1
- package/build/api-types/openai-chatcompletion/tool-codec.d.ts +0 -18
- package/build/api-types/openai-chatcompletion/tool-codec.js.map +0 -1
- package/build/compatible/engine.d/aliyun.d.ts +0 -23
- package/build/compatible/engine.d/aliyun.js +0 -44
- package/build/compatible/engine.d/aliyun.js.map +0 -1
- package/build/compatible/engine.d/anthropic.d.ts +0 -23
- package/build/compatible/engine.d/anthropic.js +0 -41
- package/build/compatible/engine.d/anthropic.js.map +0 -1
- package/build/compatible/engine.d/google.d.ts +0 -23
- package/build/compatible/engine.d/google.js +0 -45
- package/build/compatible/engine.d/google.js.map +0 -1
- package/build/compatible/engine.d/openai-responses.d.ts +0 -23
- package/build/compatible/engine.d/openai-responses.js +0 -41
- package/build/compatible/engine.d/openai-responses.js.map +0 -1
- package/build/compatible/engine.d.ts +0 -18
- package/build/compatible/engine.js +0 -21
- package/build/compatible/engine.js.map +0 -1
- package/build/compatible/session.d.ts +0 -78
- package/build/compatible/session.js +0 -138
- package/build/compatible/session.js.map +0 -1
- package/build/compatible/tool-call-validator.d.ts +0 -11
- package/build/compatible/tool-call-validator.js +0 -12
- package/build/compatible/tool-call-validator.js.map +0 -1
- package/build/compatible.d/aliyun/transport.d.ts +0 -11
- package/build/compatible.d/aliyun/transport.js +0 -9
- package/build/compatible.d/aliyun/transport.js.map +0 -1
- package/build/compatible.d/anthropic/message-codec.d.ts +0 -31
- package/build/compatible.d/anthropic/message-codec.js +0 -88
- package/build/compatible.d/anthropic/message-codec.js.map +0 -1
- package/build/compatible.d/anthropic/transport.d.ts +0 -31
- package/build/compatible.d/anthropic/transport.js +0 -137
- package/build/compatible.d/anthropic/transport.js.map +0 -1
- package/build/compatible.d/google/message-codec.d.ts +0 -31
- package/build/compatible.d/google/message-codec.js +0 -98
- package/build/compatible.d/google/message-codec.js.map +0 -1
- package/build/compatible.d/google/transport.d.ts +0 -28
- package/build/compatible.d/google/transport.js.map +0 -1
- package/build/compatible.d/openai-chatcompletions/message-codec.d.ts +0 -19
- package/build/compatible.d/openai-chatcompletions/message-codec.js +0 -66
- package/build/compatible.d/openai-chatcompletions/message-codec.js.map +0 -1
- package/build/compatible.d/openai-chatcompletions/transport.d.ts +0 -9
- package/build/compatible.d/openai-chatcompletions/transport.js +0 -25
- package/build/compatible.d/openai-chatcompletions/transport.js.map +0 -1
- package/build/compatible.d/openai-chatcompletions.d/monolith.d.ts +0 -36
- package/build/compatible.d/openai-chatcompletions.d/monolith.js.map +0 -1
- package/build/compatible.d/openai-chatcompletions.d/stream.d.ts +0 -35
- package/build/compatible.d/openai-chatcompletions.d/stream.js +0 -196
- package/build/compatible.d/openai-chatcompletions.d/stream.js.map +0 -1
- package/build/compatible.d/openai-responses/message-codec.d.ts +0 -32
- package/build/compatible.d/openai-responses/message-codec.js +0 -105
- package/build/compatible.d/openai-responses/message-codec.js.map +0 -1
- package/build/compatible.d/openai-responses/transport.d.ts +0 -33
- package/build/compatible.d/openai-responses/transport.js.map +0 -1
- package/build/frontmatter.d.ts +0 -5
- package/build/frontmatter.js +0 -13
- package/build/frontmatter.js.map +0 -1
- package/build/native-engines.d/google/agentloop.d.ts +0 -12
- package/build/native-engines.d/google/agentloop.js +0 -42
- package/build/native-engines.d/google/agentloop.js.map +0 -1
- package/build/native-engines.d/google/engine.d.ts +0 -35
- package/build/native-engines.d/google/engine.js +0 -73
- package/build/native-engines.d/google/engine.js.map +0 -1
- package/build/native-engines.d/google/exports.d.ts +0 -5
- package/build/native-engines.d/google/exports.js +0 -6
- package/build/native-engines.d/google/exports.js.map +0 -1
- package/build/native-engines.d/openai-responses/agentloop.d.ts +0 -13
- package/build/native-engines.d/openai-responses/agentloop.js +0 -53
- package/build/native-engines.d/openai-responses/agentloop.js.map +0 -1
- package/build/native-engines.d/openai-responses/engine.d.ts +0 -32
- package/build/native-engines.d/openai-responses/engine.js +0 -63
- package/build/native-engines.d/openai-responses/engine.js.map +0 -1
- package/build/native-engines.d/openai-responses/exports.d.ts +0 -6
- package/build/native-engines.d/openai-responses/exports.js +0 -7
- package/build/native-engines.d/openai-responses/exports.js.map +0 -1
- package/build/native-engines.d/openai-responses/tool-call-validator.d.ts +0 -12
- package/build/native-engines.d/openai-responses/tool-call-validator.js +0 -33
- package/build/native-engines.d/openai-responses/tool-call-validator.js.map +0 -1
- package/build/session.d.ts +0 -7
- package/test/build/test-codecs.d.ts +0 -1
- package/test/build/test-codecs.js +0 -230
- package/test/build/test-codecs.js.map +0 -1
- package/test/build/test-compatible-engine.d.ts +0 -1
- package/test/build/test-compatible-engine.js +0 -27
- package/test/build/test-compatible-engine.js.map +0 -1
- package/test/build/test-compatible-engines.d.ts +0 -1
- package/test/build/test-compatible-engines.js +0 -112
- package/test/build/test-compatible-engines.js.map +0 -1
- package/test/build/test-engine.d.ts +0 -1
- package/test/build/test-engine.js +0 -97
- package/test/build/test-engine.js.map +0 -1
- package/test/build/test-helpers.d.ts +0 -46
- package/test/build/test-helpers.js +0 -45
- package/test/build/test-helpers.js.map +0 -1
- package/test/build/test-native-engines.d.ts +0 -1
- package/test/build/test-native-engines.js +0 -64
- package/test/build/test-native-engines.js.map +0 -1
- package/test/build/test.d.ts +0 -5
- package/test/build/test.js +0 -6
- package/test/build/test.js.map +0 -1
- package/test/build/tsconfig.tsbuildinfo +0 -1
- package/test/src/test-codecs.ts +0 -256
- package/test/src/test-compatible-engine.ts +0 -45
- package/test/src/test-compatible-engines.ts +0 -129
- package/test/src/test-engine.ts +0 -144
- package/test/src/test-helpers.ts +0 -53
- package/test/src/test-native-engines.ts +0 -75
- package/test/src/test.ts +0 -5
- /package/build/{session.js → engine/session.js} +0 -0
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CompatibleEngine } from '#@/compatible/engine.ts';
|
|
2
|
-
import { RoleMessage, type Session } from '#@/compatible/session.ts';
|
|
3
|
-
import { Function } from '#@/function.ts';
|
|
4
|
-
import { type InferenceContext } from '#@/inference-context.ts';
|
|
5
|
-
import { AnthropicToolCodec } from '#@/api-types/anthropic/tool-codec.ts';
|
|
6
|
-
import { AnthropicBilling } from '#@/api-types/anthropic/billing.ts';
|
|
7
|
-
import { ToolCallValidator } from '#@/compatible/tool-call-validator.ts';
|
|
8
|
-
import { AnthropicCompatibleMessageCodec } from '#@/compatible.d/anthropic/message-codec.ts';
|
|
9
|
-
import { AnthropicCompatibleTransport } from '#@/compatible.d/anthropic/transport.ts';
|
|
10
|
-
export declare class AnthropicCompatibleEngine<in out fdm extends Function.Declaration.Map> extends CompatibleEngine<fdm> {
|
|
11
|
-
protected toolCodec: AnthropicToolCodec<fdm>;
|
|
12
|
-
protected messageCodec: AnthropicCompatibleMessageCodec<fdm>;
|
|
13
|
-
protected billing: AnthropicBilling;
|
|
14
|
-
protected toolCallValidator: ToolCallValidator<fdm>;
|
|
15
|
-
protected transport: AnthropicCompatibleTransport<fdm>;
|
|
16
|
-
protected parallelToolCall: boolean;
|
|
17
|
-
constructor(options: AnthropicCompatibleEngine.Options<fdm>);
|
|
18
|
-
infer(wfctx: InferenceContext, session: Session<fdm>, signal?: AbortSignal): Promise<RoleMessage.Ai<fdm>>;
|
|
19
|
-
}
|
|
20
|
-
export declare namespace AnthropicCompatibleEngine {
|
|
21
|
-
interface Options<in out fdm extends Function.Declaration.Map> extends CompatibleEngine.Options<fdm> {
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CompatibleEngine } from '#@/compatible/engine.ts';
|
|
2
|
-
import { RoleMessage } from '#@/compatible/session.ts';
|
|
3
|
-
import { Function } from '#@/function.ts';
|
|
4
|
-
import {} from '#@/inference-context.ts';
|
|
5
|
-
import { AnthropicToolCodec } from '#@/api-types/anthropic/tool-codec.ts';
|
|
6
|
-
import { AnthropicBilling } from '#@/api-types/anthropic/billing.ts';
|
|
7
|
-
import { ToolCallValidator } from '#@/compatible/tool-call-validator.ts';
|
|
8
|
-
import { AnthropicCompatibleMessageCodec } from '#@/compatible.d/anthropic/message-codec.ts';
|
|
9
|
-
import { AnthropicCompatibleTransport } from '#@/compatible.d/anthropic/transport.ts';
|
|
10
|
-
export class AnthropicCompatibleEngine extends CompatibleEngine {
|
|
11
|
-
toolCodec;
|
|
12
|
-
messageCodec;
|
|
13
|
-
billing;
|
|
14
|
-
toolCallValidator;
|
|
15
|
-
transport;
|
|
16
|
-
parallelToolCall;
|
|
17
|
-
constructor(options) {
|
|
18
|
-
super(options);
|
|
19
|
-
this.parallelToolCall = options.parallelToolCall ?? false;
|
|
20
|
-
this.toolCodec = new AnthropicToolCodec({ fdm: this.fdm });
|
|
21
|
-
this.messageCodec = new AnthropicCompatibleMessageCodec({ toolCodec: this.toolCodec });
|
|
22
|
-
this.billing = new AnthropicBilling({ pricing: this.pricing });
|
|
23
|
-
this.toolCallValidator = new ToolCallValidator({ toolChoice: this.toolChoice });
|
|
24
|
-
this.transport = new AnthropicCompatibleTransport({
|
|
25
|
-
providerSpec: this.providerSpec,
|
|
26
|
-
inferenceSpec: this.inferenceParams,
|
|
27
|
-
fdm: this.fdm,
|
|
28
|
-
throttle: this.throttle,
|
|
29
|
-
toolChoice: this.toolChoice,
|
|
30
|
-
parallelToolCall: this.parallelToolCall,
|
|
31
|
-
messageCodec: this.messageCodec,
|
|
32
|
-
toolCodec: this.toolCodec,
|
|
33
|
-
billing: this.billing,
|
|
34
|
-
toolCallValidator: this.toolCallValidator,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
infer(wfctx, session, signal) {
|
|
38
|
-
return this.transport.fetch(wfctx, session, signal);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=anthropic.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../../src/compatible/engine.d/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAgB,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAyB,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAC7F,OAAO,EAAE,4BAA4B,EAAE,MAAM,wCAAwC,CAAC;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B,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;CACJ"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CompatibleEngine } from '#@/compatible/engine.ts';
|
|
2
|
-
import { RoleMessage, type Session } from '#@/compatible/session.ts';
|
|
3
|
-
import { Function } from '#@/function.ts';
|
|
4
|
-
import { type InferenceContext } from '#@/inference-context.ts';
|
|
5
|
-
import { GoogleCompatibleMessageCodec } from '#@/compatible.d/google/message-codec.ts';
|
|
6
|
-
import { GoogleToolCodec } from '#@/api-types/google/tool-codec.ts';
|
|
7
|
-
import { GoogleBilling } from '#@/api-types/google/billing.ts';
|
|
8
|
-
import { ToolCallValidator } from '#@/compatible/tool-call-validator.ts';
|
|
9
|
-
import { GoogleCompatibleTransport } from '#@/compatible.d/google/transport.ts';
|
|
10
|
-
export declare class GoogleCompatibleEngine<in out fdm extends Function.Declaration.Map> extends CompatibleEngine<fdm> {
|
|
11
|
-
protected toolCodec: GoogleToolCodec<fdm>;
|
|
12
|
-
protected messageCodec: GoogleCompatibleMessageCodec<fdm>;
|
|
13
|
-
protected billing: GoogleBilling;
|
|
14
|
-
protected toolCallValidator: ToolCallValidator<fdm>;
|
|
15
|
-
protected transport: GoogleCompatibleTransport<fdm>;
|
|
16
|
-
protected parallelToolCall: boolean;
|
|
17
|
-
constructor(options: GoogleCompatibleEngine.Options<fdm>);
|
|
18
|
-
infer(wfctx: InferenceContext, session: Session<fdm>, signal?: AbortSignal): Promise<RoleMessage.Ai<fdm>>;
|
|
19
|
-
}
|
|
20
|
-
export declare namespace GoogleCompatibleEngine {
|
|
21
|
-
interface Options<in out fdm extends Function.Declaration.Map> extends CompatibleEngine.Options<fdm> {
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { CompatibleEngine } from '#@/compatible/engine.ts';
|
|
2
|
-
import { RoleMessage } from '#@/compatible/session.ts';
|
|
3
|
-
import { Function } from '#@/function.ts';
|
|
4
|
-
import {} from '#@/inference-context.ts';
|
|
5
|
-
import { GoogleCompatibleMessageCodec } from '#@/compatible.d/google/message-codec.ts';
|
|
6
|
-
import { GoogleToolCodec } from '#@/api-types/google/tool-codec.ts';
|
|
7
|
-
import { GoogleBilling } from '#@/api-types/google/billing.ts';
|
|
8
|
-
import { ToolCallValidator } from '#@/compatible/tool-call-validator.ts';
|
|
9
|
-
import { GoogleCompatibleTransport } from '#@/compatible.d/google/transport.ts';
|
|
10
|
-
export class GoogleCompatibleEngine extends CompatibleEngine {
|
|
11
|
-
toolCodec;
|
|
12
|
-
messageCodec;
|
|
13
|
-
billing;
|
|
14
|
-
toolCallValidator;
|
|
15
|
-
transport;
|
|
16
|
-
parallelToolCall;
|
|
17
|
-
constructor(options) {
|
|
18
|
-
super(options);
|
|
19
|
-
this.parallelToolCall = options.parallelToolCall ?? true;
|
|
20
|
-
if (this.parallelToolCall) { }
|
|
21
|
-
else
|
|
22
|
-
throw new Error('Parallel tool calling is required by Google engine.');
|
|
23
|
-
this.toolCodec = new GoogleToolCodec({
|
|
24
|
-
fdm: this.fdm,
|
|
25
|
-
});
|
|
26
|
-
this.messageCodec = new GoogleCompatibleMessageCodec({ toolCodec: this.toolCodec });
|
|
27
|
-
this.billing = new GoogleBilling({ pricing: this.pricing });
|
|
28
|
-
this.toolCallValidator = new ToolCallValidator({ toolChoice: this.toolChoice });
|
|
29
|
-
this.transport = new GoogleCompatibleTransport({
|
|
30
|
-
inferenceParams: this.inferenceParams,
|
|
31
|
-
providerSpec: this.providerSpec,
|
|
32
|
-
fdm: this.fdm,
|
|
33
|
-
throttle: this.throttle,
|
|
34
|
-
toolChoice: this.toolChoice,
|
|
35
|
-
messageCodec: this.messageCodec,
|
|
36
|
-
toolCodec: this.toolCodec,
|
|
37
|
-
billing: this.billing,
|
|
38
|
-
toolCallValidator: this.toolCallValidator,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
infer(wfctx, session, signal) {
|
|
42
|
-
return this.transport.fetch(wfctx, session, signal);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=google.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../../src/compatible/engine.d/google.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAgB,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAyB,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,4BAA4B,EAAE,MAAM,yCAAyC,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAIhF,MAAM,OAAO,sBAAoE,SAAQ,gBAAqB;IAChG,SAAS,CAAuB;IAChC,YAAY,CAAoC;IAChD,OAAO,CAAgB;IACvB,iBAAiB,CAAyB;IAC1C,SAAS,CAAiC;IACjC,gBAAgB,CAAU;IAE7C,YAAmB,OAA4C;QAC3D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,IAAI,CAAC;QACzD,IAAI,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAA,CAAC;;YAAM,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;QAC1G,IAAI,CAAC,SAAS,GAAG,IAAI,eAAe,CAAC;YACjC,GAAG,EAAE,IAAI,CAAC,GAAG;SAChB,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,GAAG,IAAI,4BAA4B,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QACpF,IAAI,CAAC,OAAO,GAAG,IAAI,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;QAC5D,IAAI,CAAC,iBAAiB,GAAG,IAAI,iBAAiB,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,CAAC,CAAC;QAChF,IAAI,CAAC,SAAS,GAAG,IAAI,yBAAyB,CAAC;YAC3C,eAAe,EAAE,IAAI,CAAC,eAAe;YACrC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,GAAG,EAAE,IAAI,CAAC,GAAG;YACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC5C,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CACjB,KAAuB,EACvB,OAAqB,EACrB,MAAoB;QAEpB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;CACJ"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { CompatibleEngine } from '#@/compatible/engine.ts';
|
|
2
|
-
import { RoleMessage, type Session } from '#@/compatible/session.ts';
|
|
3
|
-
import { Function } from '#@/function.ts';
|
|
4
|
-
import { type InferenceContext } from '#@/inference-context.ts';
|
|
5
|
-
import { OpenAIResponsesToolCodec } from '#@/api-types/openai-responses/tool-codec.ts';
|
|
6
|
-
import { OpenAIResponsesBilling } from '#@/api-types/openai-responses/billing.ts';
|
|
7
|
-
import { ToolCallValidator } from '#@/compatible/tool-call-validator.ts';
|
|
8
|
-
import { OpenAIResponsesCompatibleMessageCodec } from '#@/compatible.d/openai-responses/message-codec.ts';
|
|
9
|
-
import { OpenAIResponsesCompatibleTransport } from '#@/compatible.d/openai-responses/transport.ts';
|
|
10
|
-
export declare class OpenAIResponsesCompatibleEngine<in out fdm extends Function.Declaration.Map> extends CompatibleEngine<fdm> {
|
|
11
|
-
protected toolCodec: OpenAIResponsesToolCodec<fdm>;
|
|
12
|
-
protected messageCodec: OpenAIResponsesCompatibleMessageCodec<fdm>;
|
|
13
|
-
protected billing: OpenAIResponsesBilling;
|
|
14
|
-
protected toolCallValidator: ToolCallValidator<fdm>;
|
|
15
|
-
protected transport: OpenAIResponsesCompatibleTransport<fdm>;
|
|
16
|
-
protected parallelToolCall: boolean;
|
|
17
|
-
constructor(options: OpenAIResponsesCompatibleEngine.Options<fdm>);
|
|
18
|
-
infer(wfctx: InferenceContext, session: Session<fdm>, signal?: AbortSignal): Promise<RoleMessage.Ai<fdm>>;
|
|
19
|
-
}
|
|
20
|
-
export declare namespace OpenAIResponsesCompatibleEngine {
|
|
21
|
-
interface Options<in out fdm extends Function.Declaration.Map> extends CompatibleEngine.Options<fdm> {
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { CompatibleEngine } from '#@/compatible/engine.ts';
|
|
2
|
-
import { RoleMessage } from '#@/compatible/session.ts';
|
|
3
|
-
import { Function } from '#@/function.ts';
|
|
4
|
-
import {} from '#@/inference-context.ts';
|
|
5
|
-
import { OpenAIResponsesToolCodec } from '#@/api-types/openai-responses/tool-codec.ts';
|
|
6
|
-
import { OpenAIResponsesBilling } from '#@/api-types/openai-responses/billing.ts';
|
|
7
|
-
import { ToolCallValidator } from '#@/compatible/tool-call-validator.ts';
|
|
8
|
-
import { OpenAIResponsesCompatibleMessageCodec } from '#@/compatible.d/openai-responses/message-codec.ts';
|
|
9
|
-
import { OpenAIResponsesCompatibleTransport } from '#@/compatible.d/openai-responses/transport.ts';
|
|
10
|
-
export class OpenAIResponsesCompatibleEngine extends CompatibleEngine {
|
|
11
|
-
toolCodec;
|
|
12
|
-
messageCodec;
|
|
13
|
-
billing;
|
|
14
|
-
toolCallValidator;
|
|
15
|
-
transport;
|
|
16
|
-
parallelToolCall;
|
|
17
|
-
constructor(options) {
|
|
18
|
-
super(options);
|
|
19
|
-
this.parallelToolCall = options.parallelToolCall ?? false;
|
|
20
|
-
this.toolCodec = new OpenAIResponsesToolCodec({ fdm: this.fdm });
|
|
21
|
-
this.messageCodec = new OpenAIResponsesCompatibleMessageCodec({ toolCodec: this.toolCodec });
|
|
22
|
-
this.billing = new OpenAIResponsesBilling({ pricing: this.pricing });
|
|
23
|
-
this.toolCallValidator = new ToolCallValidator({ toolChoice: this.toolChoice });
|
|
24
|
-
this.transport = new OpenAIResponsesCompatibleTransport({
|
|
25
|
-
inferenceSpec: this.inferenceParams,
|
|
26
|
-
providerSpec: this.providerSpec,
|
|
27
|
-
fdm: this.fdm,
|
|
28
|
-
throttle: this.throttle,
|
|
29
|
-
toolChoice: this.toolChoice,
|
|
30
|
-
parallelToolCall: this.parallelToolCall,
|
|
31
|
-
messageCodec: this.messageCodec,
|
|
32
|
-
toolCodec: this.toolCodec,
|
|
33
|
-
billing: this.billing,
|
|
34
|
-
toolCallValidator: this.toolCallValidator,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
infer(wfctx, session, signal) {
|
|
38
|
-
return this.transport.fetch(wfctx, session, signal);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
//# sourceMappingURL=openai-responses.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"openai-responses.js","sourceRoot":"","sources":["../../../src/compatible/engine.d/openai-responses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAgB,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,g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;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,gBAAgB,EAAE,IAAI,CAAC,gBAAgB;YACvC,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;SAC5C,CAAC,CAAC;IACP,CAAC;IAEe,KAAK,CACjB,KAAuB,EACvB,OAAqB,EACrB,MAAoB;QAEpB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACxD,CAAC;CACJ"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { RoleMessage, type Session } from '#@/compatible/session.ts';
|
|
2
|
-
import { Function } from '#@/function.ts';
|
|
3
|
-
import { Engine } from '#@/engine.ts';
|
|
4
|
-
export declare abstract class CompatibleEngine<in out fdm extends Function.Declaration.Map> extends Engine<fdm, RoleMessage.User<fdm>, RoleMessage.Ai<fdm>, RoleMessage.Developer, Session<fdm>> {
|
|
5
|
-
protected toolChoice: Function.ToolChoice<fdm>;
|
|
6
|
-
constructor(options: CompatibleEngine.Options<fdm>);
|
|
7
|
-
appendUserMessage(session: Session<fdm>, message: RoleMessage.User<fdm>): Session<fdm>;
|
|
8
|
-
pushUserMessage(session: Session<fdm>, message: RoleMessage.User<fdm>): Session<fdm>;
|
|
9
|
-
}
|
|
10
|
-
export declare namespace CompatibleEngine {
|
|
11
|
-
interface Options<in out fdm extends Function.Declaration.Map> extends Engine.Options<fdm>, CompatibleEngine.Options.Tools<fdm> {
|
|
12
|
-
}
|
|
13
|
-
namespace Options {
|
|
14
|
-
interface Tools<in out fdm extends Function.Declaration.Map> extends Engine.Options.Tools<fdm> {
|
|
15
|
-
toolChoice?: Function.ToolChoice<fdm>;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { RoleMessage } from '#@/compatible/session.ts';
|
|
2
|
-
import { Function } from '#@/function.ts';
|
|
3
|
-
import { Engine } from '#@/engine.ts';
|
|
4
|
-
export class CompatibleEngine extends Engine {
|
|
5
|
-
toolChoice;
|
|
6
|
-
constructor(options) {
|
|
7
|
-
super(options);
|
|
8
|
-
this.toolChoice = options.toolChoice ?? Function.ToolChoice.AUTO;
|
|
9
|
-
}
|
|
10
|
-
appendUserMessage(session, message) {
|
|
11
|
-
return {
|
|
12
|
-
developerMessage: session.developerMessage,
|
|
13
|
-
chatMessages: [...session.chatMessages, message],
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
pushUserMessage(session, message) {
|
|
17
|
-
session.chatMessages.push(message);
|
|
18
|
-
return session;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=engine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../src/compatible/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAgB,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAItC,MAAM,OAAgB,gBAA8D,SAChF,MAMC;IAES,UAAU,CAA2B;IAE/C,YAAmB,OAAsC;QACrD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC;IACrE,CAAC;IAEe,iBAAiB,CAC7B,OAAqB,EACrB,OAA8B;QAE9B,OAAO;YACH,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,YAAY,EAAE,CAAC,GAAG,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;SACnD,CAAC;IACN,CAAC;IAEe,eAAe,CAC3B,OAAqB,EACrB,OAA8B;QAE9B,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ"}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Function } from '#@/function.ts';
|
|
2
|
-
import { type GenericSession } from '#@/session.ts';
|
|
3
|
-
export interface Session<in out fdm extends Function.Declaration.Map> extends GenericSession<RoleMessage.User<fdm>, RoleMessage.Ai<fdm>, RoleMessage.Developer> {
|
|
4
|
-
}
|
|
5
|
-
export declare namespace Session {
|
|
6
|
-
type ChatMessage<fdm extends Function.Declaration.Map> = GenericSession.ChatMessage<RoleMessage.User<fdm>, RoleMessage.Ai<fdm>>;
|
|
7
|
-
}
|
|
8
|
-
export type RoleMessage = RoleMessage.Instance;
|
|
9
|
-
export declare namespace RoleMessage {
|
|
10
|
-
class SpecificMessageError extends Error {
|
|
11
|
-
constructor();
|
|
12
|
-
}
|
|
13
|
-
const NOMINAL: unique symbol;
|
|
14
|
-
abstract class Instance {
|
|
15
|
-
private readonly [NOMINAL];
|
|
16
|
-
abstract getText(): string;
|
|
17
|
-
abstract getOnlyText(): string;
|
|
18
|
-
}
|
|
19
|
-
namespace Part {
|
|
20
|
-
type Text = Text.Instance;
|
|
21
|
-
namespace Text {
|
|
22
|
-
function create(text: string): Text;
|
|
23
|
-
function paragraph(text: string): Text;
|
|
24
|
-
const NOMINAL: unique symbol;
|
|
25
|
-
class Instance {
|
|
26
|
-
text: string;
|
|
27
|
-
private readonly [NOMINAL];
|
|
28
|
-
constructor(text: string);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
type Ai<fdm extends Function.Declaration.Map> = Ai.Instance<fdm>;
|
|
33
|
-
namespace Ai {
|
|
34
|
-
function create<fdm extends Function.Declaration.Map>(parts: RoleMessage.Ai.Part<fdm>[]): RoleMessage.Ai<fdm>;
|
|
35
|
-
const NOMINAL: unique symbol;
|
|
36
|
-
class Instance<in out fdm extends Function.Declaration.Map> extends RoleMessage.Instance {
|
|
37
|
-
protected parts: RoleMessage.Ai.Part<fdm>[];
|
|
38
|
-
readonly [NOMINAL]: void;
|
|
39
|
-
constructor(parts: RoleMessage.Ai.Part<fdm>[]);
|
|
40
|
-
getParts(): RoleMessage.Ai.Part<fdm>[];
|
|
41
|
-
getText(): string;
|
|
42
|
-
getOnlyText(): string;
|
|
43
|
-
getOnlyFunctionCall(): Function.Call.From<fdm>;
|
|
44
|
-
getFunctionCalls(): Function.Call.From<fdm>[];
|
|
45
|
-
}
|
|
46
|
-
type Part<fdm extends Function.Declaration.Map> = RoleMessage.Part.Text | Function.Call.From<fdm>;
|
|
47
|
-
}
|
|
48
|
-
type User<fdm extends Function.Declaration.Map> = User.Instance<fdm>;
|
|
49
|
-
namespace User {
|
|
50
|
-
function create<fdm extends Function.Declaration.Map>(parts: RoleMessage.User.Part<fdm>[]): RoleMessage.User<fdm>;
|
|
51
|
-
const NOMINAL: unique symbol;
|
|
52
|
-
class Instance<in out fdm extends Function.Declaration.Map> extends RoleMessage.Instance {
|
|
53
|
-
protected parts: RoleMessage.User.Part<fdm>[];
|
|
54
|
-
private readonly [NOMINAL];
|
|
55
|
-
constructor(parts: RoleMessage.User.Part<fdm>[]);
|
|
56
|
-
getParts(): RoleMessage.User.Part<fdm>[];
|
|
57
|
-
getText(): string;
|
|
58
|
-
getOnlyText(): string;
|
|
59
|
-
getFunctionResponses(): Function.Response.Distributive<fdm>[];
|
|
60
|
-
getOnlyFunctionResponse(): Function.Response.Distributive<fdm>;
|
|
61
|
-
}
|
|
62
|
-
type Part<fdm extends Function.Declaration.Map> = RoleMessage.Part.Text | Function.Response.Distributive<fdm>;
|
|
63
|
-
}
|
|
64
|
-
type Developer = Developer.Instance;
|
|
65
|
-
namespace Developer {
|
|
66
|
-
function create(parts: Developer.Part[]): Developer;
|
|
67
|
-
const NOMINAL: unique symbol;
|
|
68
|
-
class Instance extends RoleMessage.Instance {
|
|
69
|
-
protected parts: Developer.Part[];
|
|
70
|
-
private readonly [NOMINAL];
|
|
71
|
-
constructor(parts: Developer.Part[]);
|
|
72
|
-
getParts(): Developer.Part[];
|
|
73
|
-
getText(): string;
|
|
74
|
-
getOnlyText(): string;
|
|
75
|
-
}
|
|
76
|
-
type Part = Part.Text;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
import { Function } from '#@/function.ts';
|
|
2
|
-
import {} from '#@/session.ts';
|
|
3
|
-
export var RoleMessage;
|
|
4
|
-
(function (RoleMessage) {
|
|
5
|
-
class SpecificMessageError extends Error {
|
|
6
|
-
constructor() {
|
|
7
|
-
super('This message is specific to a certain type of engines.');
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
RoleMessage.SpecificMessageError = SpecificMessageError;
|
|
11
|
-
RoleMessage.NOMINAL = Symbol();
|
|
12
|
-
class Instance {
|
|
13
|
-
}
|
|
14
|
-
RoleMessage.Instance = Instance;
|
|
15
|
-
let Part;
|
|
16
|
-
(function (Part) {
|
|
17
|
-
let Text;
|
|
18
|
-
(function (Text) {
|
|
19
|
-
function create(text) {
|
|
20
|
-
return new Instance(text);
|
|
21
|
-
}
|
|
22
|
-
Text.create = create;
|
|
23
|
-
function paragraph(text) {
|
|
24
|
-
return new Instance(text.trimEnd() + '\n\n');
|
|
25
|
-
}
|
|
26
|
-
Text.paragraph = paragraph;
|
|
27
|
-
Text.NOMINAL = Symbol();
|
|
28
|
-
class Instance {
|
|
29
|
-
text;
|
|
30
|
-
constructor(text) {
|
|
31
|
-
this.text = text;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
Text.Instance = Instance;
|
|
35
|
-
})(Text = Part.Text || (Part.Text = {}));
|
|
36
|
-
})(Part = RoleMessage.Part || (RoleMessage.Part = {}));
|
|
37
|
-
let Ai;
|
|
38
|
-
(function (Ai) {
|
|
39
|
-
function create(parts) {
|
|
40
|
-
return new Instance(parts);
|
|
41
|
-
}
|
|
42
|
-
Ai.create = create;
|
|
43
|
-
Ai.NOMINAL = Symbol();
|
|
44
|
-
class Instance extends RoleMessage.Instance {
|
|
45
|
-
parts;
|
|
46
|
-
constructor(parts) {
|
|
47
|
-
super();
|
|
48
|
-
this.parts = parts;
|
|
49
|
-
}
|
|
50
|
-
getParts() {
|
|
51
|
-
return this.parts;
|
|
52
|
-
}
|
|
53
|
-
getText() {
|
|
54
|
-
return this.parts.filter(part => part instanceof RoleMessage.Part.Text.Instance).map(part => part.text).join('');
|
|
55
|
-
}
|
|
56
|
-
getOnlyText() {
|
|
57
|
-
if (this.parts.every(part => part instanceof RoleMessage.Part.Text.Instance)) { }
|
|
58
|
-
else
|
|
59
|
-
throw new Error();
|
|
60
|
-
return this.getText();
|
|
61
|
-
}
|
|
62
|
-
getOnlyFunctionCall() {
|
|
63
|
-
const fcs = this.getFunctionCalls();
|
|
64
|
-
if (fcs.length === 1) { }
|
|
65
|
-
else
|
|
66
|
-
throw new Error();
|
|
67
|
-
return fcs[0];
|
|
68
|
-
}
|
|
69
|
-
getFunctionCalls() {
|
|
70
|
-
return this.parts.filter(part => part instanceof Function.Call);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
Ai.Instance = Instance;
|
|
74
|
-
})(Ai = RoleMessage.Ai || (RoleMessage.Ai = {}));
|
|
75
|
-
let User;
|
|
76
|
-
(function (User) {
|
|
77
|
-
function create(parts) {
|
|
78
|
-
return new Instance(parts);
|
|
79
|
-
}
|
|
80
|
-
User.create = create;
|
|
81
|
-
User.NOMINAL = Symbol();
|
|
82
|
-
class Instance extends RoleMessage.Instance {
|
|
83
|
-
parts;
|
|
84
|
-
constructor(parts) {
|
|
85
|
-
super();
|
|
86
|
-
this.parts = parts;
|
|
87
|
-
}
|
|
88
|
-
getParts() {
|
|
89
|
-
return this.parts;
|
|
90
|
-
}
|
|
91
|
-
getText() {
|
|
92
|
-
return this.parts.filter(part => part instanceof RoleMessage.Part.Text.Instance).map(part => part.text).join('');
|
|
93
|
-
}
|
|
94
|
-
getOnlyText() {
|
|
95
|
-
if (this.parts.every(part => part instanceof RoleMessage.Part.Text.Instance)) { }
|
|
96
|
-
else
|
|
97
|
-
throw new Error();
|
|
98
|
-
return this.getText();
|
|
99
|
-
}
|
|
100
|
-
getFunctionResponses() {
|
|
101
|
-
return this.parts.filter(part => part instanceof Function.Response);
|
|
102
|
-
}
|
|
103
|
-
getOnlyFunctionResponse() {
|
|
104
|
-
if (this.parts.length === 1 && this.parts[0] instanceof Function.Response) { }
|
|
105
|
-
else
|
|
106
|
-
throw new Error();
|
|
107
|
-
return this.parts[0];
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
User.Instance = Instance;
|
|
111
|
-
})(User = RoleMessage.User || (RoleMessage.User = {}));
|
|
112
|
-
let Developer;
|
|
113
|
-
(function (Developer) {
|
|
114
|
-
function create(parts) {
|
|
115
|
-
return new Instance(parts);
|
|
116
|
-
}
|
|
117
|
-
Developer.create = create;
|
|
118
|
-
Developer.NOMINAL = Symbol();
|
|
119
|
-
class Instance extends RoleMessage.Instance {
|
|
120
|
-
parts;
|
|
121
|
-
constructor(parts) {
|
|
122
|
-
super();
|
|
123
|
-
this.parts = parts;
|
|
124
|
-
}
|
|
125
|
-
getParts() {
|
|
126
|
-
return this.parts;
|
|
127
|
-
}
|
|
128
|
-
getText() {
|
|
129
|
-
return this.parts.map(part => part.text).join('');
|
|
130
|
-
}
|
|
131
|
-
getOnlyText() {
|
|
132
|
-
return this.getText();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
Developer.Instance = Instance;
|
|
136
|
-
})(Developer = RoleMessage.Developer || (RoleMessage.Developer = {}));
|
|
137
|
-
})(RoleMessage || (RoleMessage = {}));
|
|
138
|
-
//# sourceMappingURL=session.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sourceRoot":"","sources":["../../src/compatible/session.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM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;YACjE,CAAC;SACJ;QAtBY,aAAQ,WAsBpB,CAAA;IAEL,CAAC,EA7BgB,IAAI,GAAJ,gBAAI,KAAJ,gBAAI,QA6BpB;IAGD,IAAiB,SAAS,CAqBzB;IArBD,WAAiB,SAAS;QACtB,SAAgB,MAAM,CAAC,KAAuB;YAC1C,OAAO,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAFe,gBAAM,SAErB,CAAA;QACY,iBAAO,GAAG,MAAM,EAAE,CAAC;QAChC,MAAa,QAAS,SAAQ,WAAW,CAAC,QAAQ;YAEjB;YAA7B,YAA6B,KAAuB;gBAChD,KAAK,EAAE,CAAC;gBADiB,UAAK,GAAL,KAAK,CAAkB;YAEpD,CAAC;YACM,QAAQ;gBACX,OAAO,IAAI,CAAC,KAAK,CAAC;YACtB,CAAC;YACM,OAAO;gBACV,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACtD,CAAC;YACM,WAAW;gBACd,OAAO,IAAI,CAAC,OAAO,EAAE,CAAC;YAC1B,CAAC;SACJ;QAdY,kBAAQ,WAcpB,CAAA;IAEL,CAAC,EArBgB,SAAS,GAAT,qBAAS,KAAT,qBAAS,QAqBzB;AACL,CAAC,EAvHgB,WAAW,KAAX,WAAW,QAuH3B"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Function } from '#@/function.ts';
|
|
2
|
-
export declare class ToolCallValidator<in out fdm extends Function.Declaration.Map> {
|
|
3
|
-
protected ctx: ToolCallValidator.Context<fdm>;
|
|
4
|
-
constructor(ctx: ToolCallValidator.Context<fdm>);
|
|
5
|
-
validate(toolCalls: Function.Call.From<fdm>[]): void;
|
|
6
|
-
}
|
|
7
|
-
export declare namespace ToolCallValidator {
|
|
8
|
-
interface Context<in out fdm extends Function.Declaration.Map> {
|
|
9
|
-
toolChoice: Function.ToolChoice<fdm>;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { Function } from '#@/function.ts';
|
|
2
|
-
import { ResponseInvalid } from '#@/engine.ts';
|
|
3
|
-
export class ToolCallValidator {
|
|
4
|
-
ctx;
|
|
5
|
-
constructor(ctx) {
|
|
6
|
-
this.ctx = ctx;
|
|
7
|
-
}
|
|
8
|
-
validate(toolCalls) {
|
|
9
|
-
Function.Call.validate(toolCalls, this.ctx.toolChoice, new ResponseInvalid('Invalid function call', { cause: toolCalls }));
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=tool-call-validator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"tool-call-validator.js","sourceRoot":"","sources":["../../src/compatible/tool-call-validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,MAAM,OAAO,iBAAiB;IACG;IAA7B,YAA6B,GAAmC;QAAnC,QAAG,GAAH,GAAG,CAAgC;IAAG,CAAC;IAG7D,QAAQ,CACX,SAAoC;QAEpC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAClB,SAAS,EACT,IAAI,CAAC,GAAG,CAAC,UAAU,EACnB,IAAI,eAAe,CAAC,uBAAuB,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CACrE,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Function } from '#@/function.ts';
|
|
2
|
-
import { OpenAIChatCompletionsCompatibleStream } from '#@/compatible.d/openai-chatcompletions.d/stream.ts';
|
|
3
|
-
import OpenAI from 'openai';
|
|
4
|
-
export declare class AliyunTransport<in out fdm extends Function.Declaration.Map> extends OpenAIChatCompletionsCompatibleStream<fdm> {
|
|
5
|
-
protected getDeltaThoughts(delta: OpenAI.ChatCompletionChunk.Choice.Delta): string;
|
|
6
|
-
}
|
|
7
|
-
export declare namespace AliyunTransport {
|
|
8
|
-
interface ChatCompletionChunkChoiceDelta extends OpenAI.ChatCompletionChunk.Choice.Delta {
|
|
9
|
-
reasoning_content?: string;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Function } from '#@/function.ts';
|
|
2
|
-
import { OpenAIChatCompletionsCompatibleStream } from '#@/compatible.d/openai-chatcompletions.d/stream.ts';
|
|
3
|
-
import OpenAI from 'openai';
|
|
4
|
-
export class AliyunTransport extends OpenAIChatCompletionsCompatibleStream {
|
|
5
|
-
getDeltaThoughts(delta) {
|
|
6
|
-
return delta.reasoning_content ?? '';
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=transport.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"transport.js","sourceRoot":"","sources":["../../../src/compatible.d/aliyun/transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,qCAAqC,EAAE,MAAM,oDAAoD,CAAC;AAC3G,OAAO,MAAM,MAAM,QAAQ,CAAC;AAI5B,MAAM,OAAO,eAA6D,SACtE,qCAA0C;IAEvB,gBAAgB,CAAC,KAA8C;QAC9E,OAAQ,KAAwD,CAAC,iBAAiB,IAAI,EAAE,CAAC;IAC7F,CAAC;CAEJ"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { RoleMessage, type Session } from '#@/compatible/session.ts';
|
|
2
|
-
import { Function } from '#@/function.ts';
|
|
3
|
-
import Anthropic from '@anthropic-ai/sdk';
|
|
4
|
-
import type { AnthropicToolCodec } from '#@/api-types/anthropic/tool-codec.ts';
|
|
5
|
-
export declare class AnthropicCompatibleMessageCodec<in out fdm extends Function.Declaration.Map> {
|
|
6
|
-
protected ctx: AnthropicCompatibleMessageCodec.Context<fdm>;
|
|
7
|
-
constructor(ctx: AnthropicCompatibleMessageCodec.Context<fdm>);
|
|
8
|
-
convertFromUserMessage(userMessage: RoleMessage.User<fdm>): Anthropic.ContentBlockParam[];
|
|
9
|
-
convertFromAiMessage(aiMessage: RoleMessage.Ai<fdm>): Anthropic.ContentBlockParam[];
|
|
10
|
-
convertFromDeveloperMessage(developerMessage: RoleMessage.Developer): Anthropic.TextBlockParam[];
|
|
11
|
-
convertFromChatMessage(chatMessage: Session.ChatMessage<fdm>): Anthropic.MessageParam;
|
|
12
|
-
convertToAiMessage(raw: Anthropic.ContentBlock[]): AnthropicCompatibleMessageCodec.Message.Ai<fdm>;
|
|
13
|
-
}
|
|
14
|
-
export declare namespace AnthropicCompatibleMessageCodec {
|
|
15
|
-
interface Context<in out fdm extends Function.Declaration.Map> {
|
|
16
|
-
toolCodec: AnthropicToolCodec<fdm>;
|
|
17
|
-
}
|
|
18
|
-
namespace Message {
|
|
19
|
-
type Ai<fdm extends Function.Declaration.Map> = Ai.Instance<fdm>;
|
|
20
|
-
namespace Ai {
|
|
21
|
-
function create<fdm extends Function.Declaration.Map>(parts: RoleMessage.Ai.Part<fdm>[], raw: Anthropic.ContentBlock[]): Ai<fdm>;
|
|
22
|
-
const NOMINAL: unique symbol;
|
|
23
|
-
class Instance<in out fdm extends Function.Declaration.Map> extends RoleMessage.Ai.Instance<fdm> {
|
|
24
|
-
protected raw: Anthropic.ContentBlock[];
|
|
25
|
-
readonly [NOMINAL]: void;
|
|
26
|
-
constructor(parts: RoleMessage.Ai.Part<fdm>[], raw: Anthropic.ContentBlock[]);
|
|
27
|
-
getRaw(): Anthropic.ContentBlock[];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|