@zimtsui/brainswitch 0.0.55 → 0.0.57
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/DEVELOPMENT.md +13 -14
- package/README.md +110 -62
- package/assets/verbatim/declarations.handlebars +11 -0
- package/assets/verbatim/instruction.md +49 -0
- package/build/adaptor.d.ts +38 -7
- package/build/adaptor.js +35 -37
- package/build/adaptor.js.map +1 -1
- package/build/api-types/anthropic/billing.d.ts +12 -0
- package/build/api-types/anthropic/billing.js +14 -0
- package/build/api-types/anthropic/billing.js.map +1 -0
- package/build/api-types/anthropic/tool-codec.d.ts +16 -0
- package/build/api-types/anthropic/tool-codec.js +58 -0
- package/build/api-types/anthropic/tool-codec.js.map +1 -0
- package/build/api-types/google/billing.d.ts +12 -0
- package/build/api-types/google/billing.js +23 -0
- package/build/api-types/google/billing.js.map +1 -0
- package/build/api-types/google/restful-request.d.ts +8 -0
- package/build/api-types/google/restful-request.js +1 -0
- package/build/api-types/google/restful-request.js.map +1 -0
- package/build/api-types/google/tool-codec.d.ts +16 -0
- package/build/api-types/{google.js → google/tool-codec.js} +32 -29
- package/build/api-types/google/tool-codec.js.map +1 -0
- package/build/api-types/openai-chatcompletions/billing.d.ts +12 -0
- package/build/api-types/openai-chatcompletions/billing.js +14 -0
- 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-chatcompletions/tool-codec.js +80 -0
- package/build/api-types/openai-chatcompletions/tool-codec.js.map +1 -0
- package/build/api-types/openai-responses/billing.d.ts +12 -0
- package/build/api-types/openai-responses/billing.js +14 -0
- package/build/api-types/openai-responses/billing.js.map +1 -0
- package/build/api-types/openai-responses/tool-codec.d.ts +16 -0
- package/build/api-types/openai-responses/tool-codec.js +76 -0
- package/build/api-types/openai-responses/tool-codec.js.map +1 -0
- 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-engine.d/google/transport.js +78 -0
- 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-engine.d/openai-chatcompletions/transport.d/monolith.js +77 -0
- 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-engine.d/openai-responses/transport.js +80 -0
- 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 +17 -46
- package/build/compatible-engine.js +20 -58
- package/build/compatible-engine.js.map +1 -1
- package/build/config.d.ts +1 -0
- package/build/config.js +0 -1
- 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/engine/session.js +1 -0
- package/build/engine/session.js.map +1 -0
- 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 +60 -29
- package/build/engine.js +86 -19
- package/build/engine.js.map +1 -1
- package/build/exports.d.ts +4 -3
- package/build/exports.js +4 -3
- package/build/exports.js.map +1 -1
- package/build/function.d.ts +79 -54
- package/build/function.js +30 -46
- 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 +23 -0
- package/build/native-engines.d/google/message-codec.js +67 -0
- package/build/native-engines.d/google/message-codec.js.map +1 -0
- package/build/native-engines.d/google/session.d.ts +45 -51
- package/build/native-engines.d/google/session.js +84 -80
- package/build/native-engines.d/google/session.js.map +1 -1
- package/build/native-engines.d/google/transport.d.ts +34 -0
- package/build/native-engines.d/google/transport.js +81 -0
- package/build/native-engines.d/google/transport.js.map +1 -0
- 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 +23 -0
- package/build/native-engines.d/openai-responses/message-codec.js +75 -0
- package/build/native-engines.d/openai-responses/message-codec.js.map +1 -0
- package/build/native-engines.d/openai-responses/session.d.ts +47 -44
- package/build/native-engines.d/openai-responses/session.js +73 -103
- 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 +14 -11
- 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 +35 -0
- package/build/native-engines.d/openai-responses/transport.js +84 -0
- package/build/native-engines.d/openai-responses/transport.js.map +1 -0
- 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/{google → openai-responses.d}/exports.d.ts +1 -2
- package/build/native-engines.d/{google → openai-responses.d}/exports.js +1 -2
- 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 +5 -4
- 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/examples/tsconfig.json +34 -0
- package/examples/verbatim.ts +44 -0
- package/package.json +10 -9
- package/build/agentloop.d.ts +0 -12
- package/build/agentloop.js +0 -43
- package/build/agentloop.js.map +0 -1
- package/build/api-types/anthropic.d.ts +0 -29
- package/build/api-types/anthropic.js +0 -93
- package/build/api-types/anthropic.js.map +0 -1
- package/build/api-types/google.d.ts +0 -28
- package/build/api-types/google.js.map +0 -1
- package/build/api-types/openai-chat-completions.d.ts +0 -31
- package/build/api-types/openai-chat-completions.js +0 -113
- package/build/api-types/openai-chat-completions.js.map +0 -1
- package/build/api-types/openai-responses.d.ts +0 -23
- package/build/api-types/openai-responses.js +0 -71
- package/build/api-types/openai-responses.js.map +0 -1
- package/build/compatible-engines.d/aliyun.d.ts +0 -69
- package/build/compatible-engines.d/aliyun.js +0 -149
- package/build/compatible-engines.d/aliyun.js.map +0 -1
- package/build/compatible-engines.d/anthropic.d.ts +0 -78
- package/build/compatible-engines.d/anthropic.js +0 -312
- package/build/compatible-engines.d/anthropic.js.map +0 -1
- package/build/compatible-engines.d/google.d.ts +0 -83
- package/build/compatible-engines.d/google.js +0 -279
- package/build/compatible-engines.d/google.js.map +0 -1
- package/build/compatible-engines.d/openai-chatcompletions.d/monolith.d.ts +0 -15
- package/build/compatible-engines.d/openai-chatcompletions.d/monolith.js +0 -75
- package/build/compatible-engines.d/openai-chatcompletions.d/monolith.js.map +0 -1
- package/build/compatible-engines.d/openai-chatcompletions.d/stream.d.ts +0 -21
- package/build/compatible-engines.d/openai-chatcompletions.d/stream.js +0 -186
- package/build/compatible-engines.d/openai-chatcompletions.d/stream.js.map +0 -1
- package/build/compatible-engines.d/openai-chatcompletions.d.ts +0 -27
- package/build/compatible-engines.d/openai-chatcompletions.js +0 -76
- package/build/compatible-engines.d/openai-chatcompletions.js.map +0 -1
- package/build/compatible-engines.d/openai-responses.d.ts +0 -93
- package/build/compatible-engines.d/openai-responses.js +0 -300
- package/build/compatible-engines.d/openai-responses.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 -110
- package/build/native-engines.d/google/engine.js +0 -314
- package/build/native-engines.d/google/engine.js.map +0 -1
- 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 -112
- package/build/native-engines.d/openai-responses/engine.js +0 -344
- package/build/native-engines.d/openai-responses/engine.js.map +0 -1
- package/build/native-engines.d/openai-responses/exports.d.ts +0 -7
- package/build/native-engines.d/openai-responses/exports.js +0 -8
- package/build/native-engines.d/openai-responses/exports.js.map +0 -1
- package/build/session.d.ts +0 -77
- package/build/session.js +0 -137
- package/build/session.js.map +0 -1
- package/build/test.d.ts +0 -1
- package/build/test.js +0 -198
- package/build/test.js.map +0 -1
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { Function } from '../../function.ts';
|
|
2
|
-
import { RoleMessage, type ChatMessage, type Session } from './session.ts';
|
|
3
|
-
import { Engine } from '../../engine.ts';
|
|
4
|
-
import { type InferenceContext } from '../../inference-context.ts';
|
|
5
|
-
import * as Google from '@google/genai';
|
|
6
|
-
import * as Undici from 'undici';
|
|
7
|
-
import { GoogleEngine } from '../../api-types/google.ts';
|
|
8
|
-
import { CompatibleEngine } from '../../compatible-engine.ts';
|
|
9
|
-
import { Throttle } from '../../throttle.ts';
|
|
10
|
-
export interface GoogleNativeEngine<fdm extends Function.Declaration.Map> extends Engine {
|
|
11
|
-
/**
|
|
12
|
-
* @throws {@link USER_ABORTION} 用户中止
|
|
13
|
-
* @throws {@link InferenceTimeout} 推理超时
|
|
14
|
-
* @throws {@link ResponseInvalid} 模型抽风
|
|
15
|
-
* @throws {TypeError} 网络故障
|
|
16
|
-
*/
|
|
17
|
-
stateless(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
18
|
-
/**
|
|
19
|
-
* @param session mutable
|
|
20
|
-
*/
|
|
21
|
-
stateful(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
22
|
-
appendUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
23
|
-
/**
|
|
24
|
-
* @param session mutable
|
|
25
|
-
*/
|
|
26
|
-
pushUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
27
|
-
}
|
|
28
|
-
export declare namespace GoogleNativeEngine {
|
|
29
|
-
interface Options<in out fdm extends Function.Declaration.Map> extends Engine.Options<fdm>, CompatibleEngine.Options.Tools<fdm>, GoogleEngine.Options<fdm> {
|
|
30
|
-
codeExecution?: boolean;
|
|
31
|
-
urlContext?: boolean;
|
|
32
|
-
googleSearch?: boolean;
|
|
33
|
-
}
|
|
34
|
-
interface OwnProps<in out fdm extends Function.Declaration.Map> {
|
|
35
|
-
apiURL: URL;
|
|
36
|
-
codeExecution: boolean;
|
|
37
|
-
urlContext: boolean;
|
|
38
|
-
googleSearch: boolean;
|
|
39
|
-
toolChoice: Function.ToolChoice<fdm>;
|
|
40
|
-
}
|
|
41
|
-
interface ParentUnderhood<in out fdm extends Function.Declaration.Map> extends Engine.Underhood<fdm>, GoogleEngine.Underhood<fdm> {
|
|
42
|
-
}
|
|
43
|
-
namespace OwnProps {
|
|
44
|
-
function init<fdm extends Function.Declaration.Map>(this: ParentUnderhood<fdm>, options: Options<fdm>): OwnProps<fdm>;
|
|
45
|
-
}
|
|
46
|
-
interface Underhood<in out fdm extends Function.Declaration.Map> extends ParentUnderhood<fdm>, GoogleNativeEngine<fdm>, OwnProps<fdm> {
|
|
47
|
-
stateless(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
48
|
-
stateful(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
49
|
-
convertFromUserMessage(userMessage: RoleMessage.User<Function.Declaration.From<fdm>>): Google.Content;
|
|
50
|
-
convertFromAiMessage(aiMessage: RoleMessage.Ai<Function.Declaration.From<fdm>>): Google.Content;
|
|
51
|
-
convertFromDeveloperMessage(developerMessage: RoleMessage.Developer): Google.Content;
|
|
52
|
-
convertFromChatMessages(chatMessages: ChatMessage<Function.Declaration.From<fdm>>[]): Google.Content[];
|
|
53
|
-
convertToAiMessage(content: Google.Content): RoleMessage.Ai<Function.Declaration.From<fdm>>;
|
|
54
|
-
convertFromToolChoice(toolChoice: Function.ToolChoice<fdm>): Google.FunctionCallingConfig;
|
|
55
|
-
appendUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
56
|
-
pushUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
57
|
-
fetch(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
58
|
-
validateToolCallsByToolChoice(toolCalls: Function.Call.Distributive<Function.Declaration.From<fdm>>[]): void;
|
|
59
|
-
}
|
|
60
|
-
function stateless<fdm extends Function.Declaration.Map>(this: GoogleNativeEngine.Underhood<fdm>, wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
61
|
-
function stateful<fdm extends Function.Declaration.Map>(this: GoogleNativeEngine.Underhood<fdm>, wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
62
|
-
function appendUserMessage<fdm extends Function.Declaration.Map>(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
63
|
-
function pushUserMessage<fdm extends Function.Declaration.Map>(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
64
|
-
function convertToAiMessage<fdm extends Function.Declaration.Map>(this: GoogleNativeEngine.Underhood<fdm>, content: Google.Content): RoleMessage.Ai<Function.Declaration.From<fdm>>;
|
|
65
|
-
function convertFromAiMessage<fdm extends Function.Declaration.Map>(aiMessage: RoleMessage.Ai<Function.Declaration.From<fdm>>): Google.Content;
|
|
66
|
-
function convertFromUserMessage<fdm extends Function.Declaration.Map>(this: Engine.Underhood<fdm>, userMessage: RoleMessage.User<Function.Declaration.From<fdm>>): Google.Content;
|
|
67
|
-
function convertFromDeveloperMessage<fdm extends Function.Declaration.Map>(this: Engine.Underhood<fdm>, developerMessage: RoleMessage.Developer): Google.Content;
|
|
68
|
-
function convertFromChatMessages<fdm extends Function.Declaration.Map>(this: GoogleNativeEngine.Underhood<fdm>, chatMessages: ChatMessage<Function.Declaration.From<fdm>>[]): Google.Content[];
|
|
69
|
-
function convertFromToolChoice<fdm extends Function.Declaration.Map>(this: Engine.Underhood<fdm>, toolChoice: Function.ToolChoice<fdm>): Google.FunctionCallingConfig;
|
|
70
|
-
function fetch<fdm extends Function.Declaration.Map>(this: GoogleNativeEngine.Underhood<fdm>, wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
71
|
-
function validateToolCallsByToolChoice<fdm extends Function.Declaration.Map>(this: GoogleNativeEngine.Underhood<fdm>, toolCalls: Function.Call.Distributive<Function.Declaration.From<fdm>>[]): void;
|
|
72
|
-
class Instance<in out fdm extends Function.Declaration.Map> implements GoogleNativeEngine.Underhood<fdm> {
|
|
73
|
-
baseUrl: string;
|
|
74
|
-
apiKey: string;
|
|
75
|
-
model: string;
|
|
76
|
-
name: string;
|
|
77
|
-
inputPrice: number;
|
|
78
|
-
outputPrice: number;
|
|
79
|
-
cachePrice: number;
|
|
80
|
-
fdm: fdm;
|
|
81
|
-
additionalOptions?: Record<string, unknown>;
|
|
82
|
-
throttle: Throttle;
|
|
83
|
-
timeout?: number;
|
|
84
|
-
maxTokens?: number;
|
|
85
|
-
proxyAgent?: Undici.ProxyAgent;
|
|
86
|
-
parallelToolCall: boolean;
|
|
87
|
-
apiURL: URL;
|
|
88
|
-
codeExecution: boolean;
|
|
89
|
-
urlContext: boolean;
|
|
90
|
-
googleSearch: boolean;
|
|
91
|
-
toolChoice: Function.ToolChoice<fdm>;
|
|
92
|
-
constructor(options: GoogleNativeEngine.Options<fdm>);
|
|
93
|
-
stateless(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>>;
|
|
94
|
-
stateful(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>>;
|
|
95
|
-
appendUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>;
|
|
96
|
-
pushUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>;
|
|
97
|
-
validateToolCallsByToolChoice(toolCalls: Function.Call.Distributive<Function.Declaration.From<fdm>>[]): void;
|
|
98
|
-
convertFromFunctionCall(fc: Function.Call.Distributive<Function.Declaration.From<fdm>>): Google.FunctionCall;
|
|
99
|
-
convertToFunctionCall(googlefc: Google.FunctionCall): Function.Call.Distributive<Function.Declaration.From<fdm>>;
|
|
100
|
-
convertFromFunctionDeclarationEntry(fdentry: Function.Declaration.Entry.From<fdm>): Google.FunctionDeclaration;
|
|
101
|
-
convertFromUserMessage(userMessage: RoleMessage.User<Function.Declaration.From<fdm>>): Google.Content;
|
|
102
|
-
convertFromAiMessage(aiMessage: RoleMessage.Ai<Function.Declaration.From<fdm>>): Google.Content;
|
|
103
|
-
convertFromDeveloperMessage(developerMessage: RoleMessage.Developer): Google.Content;
|
|
104
|
-
convertFromChatMessages(chatMessages: ChatMessage<Function.Declaration.From<fdm>>[]): Google.Content[];
|
|
105
|
-
convertToAiMessage(content: Google.Content): RoleMessage.Ai<Function.Declaration.From<fdm>>;
|
|
106
|
-
convertFromToolChoice(toolChoice: Function.ToolChoice<fdm>): Google.FunctionCallingConfig;
|
|
107
|
-
fetch(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
108
|
-
}
|
|
109
|
-
function create<fdm extends Function.Declaration.Map>(options: GoogleNativeEngine.Options<fdm>): GoogleNativeEngine<fdm>;
|
|
110
|
-
}
|
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
import { Function } from "../../function.js";
|
|
2
|
-
import { RoleMessage } from "./session.js";
|
|
3
|
-
import { ResponseInvalid, Engine, USER_ABORTION, InferenceTimeout } from "../../engine.js";
|
|
4
|
-
import {} from "../../inference-context.js";
|
|
5
|
-
import * as Google from '@google/genai';
|
|
6
|
-
import * as Undici from 'undici';
|
|
7
|
-
import { GoogleEngine } from "../../api-types/google.js";
|
|
8
|
-
import { GoogleCompatibleEngine } from "../../compatible-engines.d/google.js";
|
|
9
|
-
import { CompatibleEngine } from "../../compatible-engine.js";
|
|
10
|
-
import { Throttle } from "../../throttle.js";
|
|
11
|
-
import { logger } from "../../telemetry.js";
|
|
12
|
-
export var GoogleNativeEngine;
|
|
13
|
-
(function (GoogleNativeEngine) {
|
|
14
|
-
let OwnProps;
|
|
15
|
-
(function (OwnProps) {
|
|
16
|
-
function init(options) {
|
|
17
|
-
return {
|
|
18
|
-
apiURL: new URL(`${this.baseUrl}/v1beta/models/${this.model}:generateContent`),
|
|
19
|
-
codeExecution: options.codeExecution ?? false,
|
|
20
|
-
urlContext: options.urlContext ?? false,
|
|
21
|
-
googleSearch: options.googleSearch ?? false,
|
|
22
|
-
toolChoice: options.toolChoice ?? Function.ToolChoice.AUTO,
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
OwnProps.init = init;
|
|
26
|
-
})(OwnProps = GoogleNativeEngine.OwnProps || (GoogleNativeEngine.OwnProps = {}));
|
|
27
|
-
async function stateless(wfctx, session) {
|
|
28
|
-
for (let retry = 0;; retry++) {
|
|
29
|
-
const signalTimeout = this.timeout ? AbortSignal.timeout(this.timeout) : undefined;
|
|
30
|
-
const signal = wfctx.signal && signalTimeout ? AbortSignal.any([
|
|
31
|
-
wfctx.signal,
|
|
32
|
-
signalTimeout,
|
|
33
|
-
]) : wfctx.signal || signalTimeout;
|
|
34
|
-
try {
|
|
35
|
-
return await this.fetch(wfctx, session, signal);
|
|
36
|
-
}
|
|
37
|
-
catch (e) {
|
|
38
|
-
if (wfctx.signal?.aborted)
|
|
39
|
-
throw USER_ABORTION; // 用户中止
|
|
40
|
-
else if (signalTimeout?.aborted)
|
|
41
|
-
e = new InferenceTimeout(undefined, { cause: e }); // 推理超时
|
|
42
|
-
else if (e instanceof ResponseInvalid) { } // 模型抽风
|
|
43
|
-
else if (e instanceof TypeError) { } // 网络故障
|
|
44
|
-
else
|
|
45
|
-
throw e;
|
|
46
|
-
if (retry < 3)
|
|
47
|
-
logger.message?.warn(e);
|
|
48
|
-
else
|
|
49
|
-
throw e;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
GoogleNativeEngine.stateless = stateless;
|
|
54
|
-
async function stateful(wfctx, session) {
|
|
55
|
-
const response = await this.stateless(wfctx, session);
|
|
56
|
-
session.chatMessages.push(response);
|
|
57
|
-
return response;
|
|
58
|
-
}
|
|
59
|
-
GoogleNativeEngine.stateful = stateful;
|
|
60
|
-
function appendUserMessage(session, message) {
|
|
61
|
-
return {
|
|
62
|
-
...session,
|
|
63
|
-
chatMessages: [...session.chatMessages, message],
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
GoogleNativeEngine.appendUserMessage = appendUserMessage;
|
|
67
|
-
function pushUserMessage(session, message) {
|
|
68
|
-
session.chatMessages.push(message);
|
|
69
|
-
return session;
|
|
70
|
-
}
|
|
71
|
-
GoogleNativeEngine.pushUserMessage = pushUserMessage;
|
|
72
|
-
function convertToAiMessage(content) {
|
|
73
|
-
if (content.parts) { }
|
|
74
|
-
else
|
|
75
|
-
throw new Error();
|
|
76
|
-
return RoleMessage.Ai.create(content.parts.flatMap(part => {
|
|
77
|
-
const parts = [];
|
|
78
|
-
let payload = false;
|
|
79
|
-
if (part.text) {
|
|
80
|
-
payload = true;
|
|
81
|
-
parts.push(RoleMessage.Part.Text.create(part.text));
|
|
82
|
-
}
|
|
83
|
-
if (part.functionCall) {
|
|
84
|
-
payload = true;
|
|
85
|
-
parts.push(this.convertToFunctionCall(part.functionCall));
|
|
86
|
-
}
|
|
87
|
-
if (this.codeExecution && part.executableCode) {
|
|
88
|
-
payload = true;
|
|
89
|
-
if (part.executableCode.code) { }
|
|
90
|
-
else
|
|
91
|
-
throw new Error();
|
|
92
|
-
if (part.executableCode.language) { }
|
|
93
|
-
else
|
|
94
|
-
throw new Error();
|
|
95
|
-
parts.push(RoleMessage.Ai.Part.ExecutableCode.create(part.executableCode.code, part.executableCode.language));
|
|
96
|
-
}
|
|
97
|
-
if (this.codeExecution && part.codeExecutionResult) {
|
|
98
|
-
payload = true;
|
|
99
|
-
if (part.codeExecutionResult.outcome) { }
|
|
100
|
-
else
|
|
101
|
-
throw new Error();
|
|
102
|
-
parts.push(RoleMessage.Ai.Part.CodeExecutionResult.create(part.codeExecutionResult.outcome, part.codeExecutionResult.output));
|
|
103
|
-
}
|
|
104
|
-
if (payload) { }
|
|
105
|
-
else
|
|
106
|
-
throw new ResponseInvalid('Unknown content part', { cause: content });
|
|
107
|
-
return parts;
|
|
108
|
-
}), content);
|
|
109
|
-
}
|
|
110
|
-
GoogleNativeEngine.convertToAiMessage = convertToAiMessage;
|
|
111
|
-
function convertFromAiMessage(aiMessage) {
|
|
112
|
-
return aiMessage.getRaw();
|
|
113
|
-
}
|
|
114
|
-
GoogleNativeEngine.convertFromAiMessage = convertFromAiMessage;
|
|
115
|
-
function convertFromUserMessage(userMessage) {
|
|
116
|
-
return (GoogleCompatibleEngine.convertFromUserMessage).call(this, userMessage);
|
|
117
|
-
}
|
|
118
|
-
GoogleNativeEngine.convertFromUserMessage = convertFromUserMessage;
|
|
119
|
-
function convertFromDeveloperMessage(developerMessage) {
|
|
120
|
-
return (GoogleCompatibleEngine.convertFromDeveloperMessage).call(this, developerMessage);
|
|
121
|
-
}
|
|
122
|
-
GoogleNativeEngine.convertFromDeveloperMessage = convertFromDeveloperMessage;
|
|
123
|
-
function convertFromChatMessages(chatMessages) {
|
|
124
|
-
return chatMessages.map(chatMessage => {
|
|
125
|
-
if (chatMessage instanceof RoleMessage.User.Instance)
|
|
126
|
-
return this.convertFromUserMessage(chatMessage);
|
|
127
|
-
else if (chatMessage instanceof RoleMessage.Ai.Instance)
|
|
128
|
-
return this.convertFromAiMessage(chatMessage);
|
|
129
|
-
else
|
|
130
|
-
throw new Error();
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
GoogleNativeEngine.convertFromChatMessages = convertFromChatMessages;
|
|
134
|
-
function convertFromToolChoice(toolChoice) {
|
|
135
|
-
return (GoogleCompatibleEngine.convertFromToolChoice).call(this, toolChoice);
|
|
136
|
-
}
|
|
137
|
-
GoogleNativeEngine.convertFromToolChoice = convertFromToolChoice;
|
|
138
|
-
async function fetch(wfctx, session, signal) {
|
|
139
|
-
const systemInstruction = session.developerMessage && this.convertFromDeveloperMessage(session.developerMessage);
|
|
140
|
-
const contents = this.convertFromChatMessages(session.chatMessages);
|
|
141
|
-
await this.throttle.requests(wfctx);
|
|
142
|
-
const fdentries = Object.entries(this.fdm);
|
|
143
|
-
const functionDeclarations = fdentries.map(fdentry => this.convertFromFunctionDeclarationEntry(fdentry));
|
|
144
|
-
const tools = [];
|
|
145
|
-
if (functionDeclarations.length)
|
|
146
|
-
tools.push({ functionDeclarations });
|
|
147
|
-
if (this.urlContext)
|
|
148
|
-
tools.push({ urlContext: {} });
|
|
149
|
-
if (this.googleSearch)
|
|
150
|
-
tools.push({ googleSearch: {} });
|
|
151
|
-
if (this.codeExecution)
|
|
152
|
-
tools.push({ codeExecution: {} });
|
|
153
|
-
const reqbody = {
|
|
154
|
-
contents,
|
|
155
|
-
tools: tools.length ? tools : undefined,
|
|
156
|
-
toolConfig: functionDeclarations.length ? {
|
|
157
|
-
functionCallingConfig: this.convertFromToolChoice(this.toolChoice),
|
|
158
|
-
} : undefined,
|
|
159
|
-
systemInstruction,
|
|
160
|
-
generationConfig: this.maxTokens || this.additionalOptions ? {
|
|
161
|
-
maxOutputTokens: this.maxTokens ?? undefined,
|
|
162
|
-
...this.additionalOptions,
|
|
163
|
-
} : undefined,
|
|
164
|
-
};
|
|
165
|
-
logger.message?.trace(reqbody);
|
|
166
|
-
const res = await Undici.fetch(this.apiURL, {
|
|
167
|
-
method: 'POST',
|
|
168
|
-
headers: new Headers({
|
|
169
|
-
'Content-Type': 'application/json',
|
|
170
|
-
'x-goog-api-key': this.apiKey,
|
|
171
|
-
}),
|
|
172
|
-
body: JSON.stringify(reqbody),
|
|
173
|
-
dispatcher: this.proxyAgent,
|
|
174
|
-
signal,
|
|
175
|
-
});
|
|
176
|
-
logger.message?.trace(res);
|
|
177
|
-
if (res.ok) { }
|
|
178
|
-
else
|
|
179
|
-
throw new Error(undefined, { cause: res });
|
|
180
|
-
const response = await res.json();
|
|
181
|
-
if (response.candidates?.[0]?.content?.parts?.length) { }
|
|
182
|
-
else
|
|
183
|
-
throw new ResponseInvalid('Content missing', { cause: response });
|
|
184
|
-
if (response.candidates[0].finishReason === Google.FinishReason.MAX_TOKENS)
|
|
185
|
-
throw new ResponseInvalid('Token limit exceeded.', { cause: response });
|
|
186
|
-
if (response.candidates[0].finishReason === Google.FinishReason.STOP) { }
|
|
187
|
-
else
|
|
188
|
-
throw new ResponseInvalid('Abnormal finish reason', { cause: response });
|
|
189
|
-
for (const part of response.candidates[0].content.parts) {
|
|
190
|
-
if (part.text)
|
|
191
|
-
logger.inference?.debug(part.text + '\n');
|
|
192
|
-
if (part.functionCall)
|
|
193
|
-
logger.message?.debug(part.functionCall);
|
|
194
|
-
}
|
|
195
|
-
if (response.usageMetadata?.promptTokenCount) { }
|
|
196
|
-
else
|
|
197
|
-
throw new Error('Prompt token count absent', { cause: response });
|
|
198
|
-
logger.message?.debug(response.usageMetadata);
|
|
199
|
-
const candidatesTokenCount = response.usageMetadata.candidatesTokenCount ?? 0;
|
|
200
|
-
const cacheHitTokenCount = response.usageMetadata.cachedContentTokenCount ?? 0;
|
|
201
|
-
const cacheMissTokenCount = response.usageMetadata.promptTokenCount - cacheHitTokenCount;
|
|
202
|
-
const thinkingTokenCount = response.usageMetadata.thoughtsTokenCount ?? 0;
|
|
203
|
-
const cost = this.inputPrice * cacheMissTokenCount / 1e6 +
|
|
204
|
-
this.cachePrice * cacheHitTokenCount / 1e6 +
|
|
205
|
-
this.outputPrice * candidatesTokenCount / 1e6 +
|
|
206
|
-
this.outputPrice * thinkingTokenCount / 1e6;
|
|
207
|
-
wfctx.cost?.(cost);
|
|
208
|
-
const aiMessage = this.convertToAiMessage(response.candidates[0].content);
|
|
209
|
-
this.validateToolCallsByToolChoice(aiMessage.getFunctionCalls());
|
|
210
|
-
return aiMessage;
|
|
211
|
-
}
|
|
212
|
-
GoogleNativeEngine.fetch = fetch;
|
|
213
|
-
function validateToolCallsByToolChoice(toolCalls) {
|
|
214
|
-
Function.Call.validate(toolCalls, this.toolChoice, new ResponseInvalid('Invalid function call', { cause: toolCalls }));
|
|
215
|
-
}
|
|
216
|
-
GoogleNativeEngine.validateToolCallsByToolChoice = validateToolCallsByToolChoice;
|
|
217
|
-
class Instance {
|
|
218
|
-
baseUrl;
|
|
219
|
-
apiKey;
|
|
220
|
-
model;
|
|
221
|
-
name;
|
|
222
|
-
inputPrice;
|
|
223
|
-
outputPrice;
|
|
224
|
-
cachePrice;
|
|
225
|
-
fdm;
|
|
226
|
-
additionalOptions;
|
|
227
|
-
throttle;
|
|
228
|
-
timeout;
|
|
229
|
-
maxTokens;
|
|
230
|
-
proxyAgent;
|
|
231
|
-
parallelToolCall;
|
|
232
|
-
apiURL;
|
|
233
|
-
codeExecution;
|
|
234
|
-
urlContext;
|
|
235
|
-
googleSearch;
|
|
236
|
-
toolChoice;
|
|
237
|
-
constructor(options) {
|
|
238
|
-
({
|
|
239
|
-
baseUrl: this.baseUrl,
|
|
240
|
-
apiKey: this.apiKey,
|
|
241
|
-
model: this.model,
|
|
242
|
-
name: this.name,
|
|
243
|
-
inputPrice: this.inputPrice,
|
|
244
|
-
outputPrice: this.outputPrice,
|
|
245
|
-
cachePrice: this.cachePrice,
|
|
246
|
-
fdm: this.fdm,
|
|
247
|
-
additionalOptions: this.additionalOptions,
|
|
248
|
-
throttle: this.throttle,
|
|
249
|
-
timeout: this.timeout,
|
|
250
|
-
maxTokens: this.maxTokens,
|
|
251
|
-
proxyAgent: this.proxyAgent,
|
|
252
|
-
} = (Engine.OwnProps.init).call(this, options));
|
|
253
|
-
({ parallelToolCall: this.parallelToolCall } = (GoogleEngine.OwnProps.init).call(this, options));
|
|
254
|
-
({
|
|
255
|
-
apiURL: this.apiURL,
|
|
256
|
-
codeExecution: this.codeExecution,
|
|
257
|
-
urlContext: this.urlContext,
|
|
258
|
-
googleSearch: this.googleSearch,
|
|
259
|
-
toolChoice: this.toolChoice,
|
|
260
|
-
} = (GoogleNativeEngine.OwnProps.init).call(this, options));
|
|
261
|
-
}
|
|
262
|
-
stateless(wfctx, session) {
|
|
263
|
-
return (GoogleNativeEngine.stateless).call(this, wfctx, session);
|
|
264
|
-
}
|
|
265
|
-
stateful(wfctx, session) {
|
|
266
|
-
return (GoogleNativeEngine.stateful).call(this, wfctx, session);
|
|
267
|
-
}
|
|
268
|
-
appendUserMessage(session, message) {
|
|
269
|
-
return (GoogleNativeEngine.appendUserMessage).call(this, session, message);
|
|
270
|
-
}
|
|
271
|
-
pushUserMessage(session, message) {
|
|
272
|
-
return (GoogleNativeEngine.pushUserMessage).call(this, session, message);
|
|
273
|
-
}
|
|
274
|
-
validateToolCallsByToolChoice(toolCalls) {
|
|
275
|
-
return (GoogleNativeEngine.validateToolCallsByToolChoice).call(this, toolCalls);
|
|
276
|
-
}
|
|
277
|
-
convertFromFunctionCall(fc) {
|
|
278
|
-
return (GoogleEngine.convertFromFunctionCall).call(this, fc);
|
|
279
|
-
}
|
|
280
|
-
convertToFunctionCall(googlefc) {
|
|
281
|
-
return (GoogleEngine.convertToFunctionCall).call(this, googlefc);
|
|
282
|
-
}
|
|
283
|
-
convertFromFunctionDeclarationEntry(fdentry) {
|
|
284
|
-
return (GoogleEngine.convertFromFunctionDeclarationEntry).call(this, fdentry);
|
|
285
|
-
}
|
|
286
|
-
convertFromUserMessage(userMessage) {
|
|
287
|
-
return (GoogleNativeEngine.convertFromUserMessage).call(this, userMessage);
|
|
288
|
-
}
|
|
289
|
-
convertFromAiMessage(aiMessage) {
|
|
290
|
-
return (GoogleNativeEngine.convertFromAiMessage).call(this, aiMessage);
|
|
291
|
-
}
|
|
292
|
-
convertFromDeveloperMessage(developerMessage) {
|
|
293
|
-
return (GoogleNativeEngine.convertFromDeveloperMessage).call(this, developerMessage);
|
|
294
|
-
}
|
|
295
|
-
convertFromChatMessages(chatMessages) {
|
|
296
|
-
return (GoogleNativeEngine.convertFromChatMessages).call(this, chatMessages);
|
|
297
|
-
}
|
|
298
|
-
convertToAiMessage(content) {
|
|
299
|
-
return (GoogleNativeEngine.convertToAiMessage).call(this, content);
|
|
300
|
-
}
|
|
301
|
-
convertFromToolChoice(toolChoice) {
|
|
302
|
-
return (GoogleNativeEngine.convertFromToolChoice).call(this, toolChoice);
|
|
303
|
-
}
|
|
304
|
-
fetch(wfctx, session, signal) {
|
|
305
|
-
return (GoogleNativeEngine.fetch).call(this, wfctx, session, signal);
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
GoogleNativeEngine.Instance = Instance;
|
|
309
|
-
function create(options) {
|
|
310
|
-
return new GoogleNativeEngine.Instance(options);
|
|
311
|
-
}
|
|
312
|
-
GoogleNativeEngine.create = create;
|
|
313
|
-
})(GoogleNativeEngine || (GoogleNativeEngine = {}));
|
|
314
|
-
//# sourceMappingURL=engine.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../src/native-engines.d/google/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAkC,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC3F,OAAO,EAAyB,MAAM,4BAA4B,CAAC;AACnE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAsB5C,MAAM,KAAW,kBAAkB,CA4XlC;AA5XD,WAAiB,kBAAkB;IAwB/B,IAAiB,QAAQ,CAaxB;IAbD,WAAiB,QAAQ;QACrB,SAAgB,IAAI,CAEhB,OAAqB;YAErB,OAAO;gBACH,MAAM,EAAE,IAAI,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,kBAAkB,IAAI,CAAC,KAAK,kBAAkB,CAAC;gBAC9E,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,KAAK;gBAC7C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,KAAK;gBACvC,YAAY,EAAE,OAAO,CAAC,YAAY,IAAI,KAAK;gBAC3C,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,QAAQ,CAAC,U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BAA4B,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;QACtF,CAAC;QACM,kBAAkB,CAAC,OAAuB;YAC7C,OAAO,CAAC,kBAAkB,CAAC,kBAAuB,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5E,CAAC;QACM,qBAAqB,CAAC,UAAoC;YAC7D,OAAO,CAAC,kBAAkB,CAAC,qBAA0B,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QAClF,CAAC;QAGM,KAAK,CAAC,KAAuB,EAAE,OAAgD,EAAE,MAAoB;YACxG,OAAO,CAAC,kBAAkB,CAAC,KAAU,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAC9E,CAAC;KAEJ;IAxGY,2BAAQ,WAwGpB,CAAA;IAED,SAAgB,MAAM,CAClB,OAAwC;QAExC,OAAO,IAAI,kBAAkB,CAAC,QAAQ,CAAM,OAAO,CAAC,CAAC;IACzD,CAAC;IAJe,yBAAM,SAIrB,CAAA;AACL,CAAC,EA5XgB,kBAAkB,KAAlB,kBAAkB,QA4XlC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/native-engines.d/google/exports.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type InferenceContext } from '../../inference-context.ts';
|
|
2
|
-
import { type Session } from './session.ts';
|
|
3
|
-
import { Function } from '../../function.ts';
|
|
4
|
-
import { Tool } from './tool.ts';
|
|
5
|
-
import { OpenAIResponsesNativeEngine } from './engine.ts';
|
|
6
|
-
import * as CompatibleAgentloopModule from '../../agentloop.ts';
|
|
7
|
-
/**
|
|
8
|
-
* @param session mutable
|
|
9
|
-
*/
|
|
10
|
-
export declare function agentloop<fdm extends Function.Declaration.Map>(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, engine: OpenAIResponsesNativeEngine<fdm>, tlm: Tool.Map<fdm>, limit?: number): AsyncGenerator<string, string, void>;
|
|
11
|
-
export declare namespace agentloop {
|
|
12
|
-
export import FunctionCallLimitExceeded = CompatibleAgentloopModule.agentloop.FunctionCallLimitExceeded;
|
|
13
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import {} from "../../inference-context.js";
|
|
2
|
-
import { RoleMessage } from "./session.js";
|
|
3
|
-
import { Function } from "../../function.js";
|
|
4
|
-
import { Tool } from "./tool.js";
|
|
5
|
-
import { OpenAIResponsesNativeEngine } from "./engine.js";
|
|
6
|
-
import * as CompatibleAgentloopModule from "../../agentloop.js";
|
|
7
|
-
/**
|
|
8
|
-
* @param session mutable
|
|
9
|
-
*/
|
|
10
|
-
export async function* agentloop(wfctx, session, engine, tlm, limit = Number.POSITIVE_INFINITY) {
|
|
11
|
-
for (let i = 0; i < limit; i++) {
|
|
12
|
-
const response = await engine.stateful(wfctx, session);
|
|
13
|
-
const tcs = response.getToolCalls();
|
|
14
|
-
if (!tcs.length)
|
|
15
|
-
return response.getOnlyText();
|
|
16
|
-
const ptcs = [];
|
|
17
|
-
for (const part of response.getParts()) {
|
|
18
|
-
if (part instanceof RoleMessage.Part.Text.Instance) {
|
|
19
|
-
yield part.text;
|
|
20
|
-
}
|
|
21
|
-
else if (part instanceof Function.Call) {
|
|
22
|
-
const fc = part;
|
|
23
|
-
const f = tlm[fc.name];
|
|
24
|
-
ptcs.push((async () => {
|
|
25
|
-
return Function.Response.create({
|
|
26
|
-
id: fc.id,
|
|
27
|
-
name: fc.name,
|
|
28
|
-
text: await f.call(tlm, fc.args),
|
|
29
|
-
});
|
|
30
|
-
})());
|
|
31
|
-
}
|
|
32
|
-
else if (part instanceof Tool.ApplyPatch.Call) {
|
|
33
|
-
const apc = part;
|
|
34
|
-
const tl = tlm[Tool.Choice.APPLY_PATCH];
|
|
35
|
-
ptcs.push((async () => {
|
|
36
|
-
return Tool.ApplyPatch.Response.create({
|
|
37
|
-
id: apc.raw.call_id,
|
|
38
|
-
failure: await tl.call(tlm, apc.raw.operation),
|
|
39
|
-
});
|
|
40
|
-
})());
|
|
41
|
-
}
|
|
42
|
-
else
|
|
43
|
-
throw new Error();
|
|
44
|
-
}
|
|
45
|
-
const trs = await Promise.all(ptcs);
|
|
46
|
-
engine.pushUserMessage(session, RoleMessage.User.create(trs));
|
|
47
|
-
}
|
|
48
|
-
throw new agentloop.FunctionCallLimitExceeded('Function call limit exceeded.');
|
|
49
|
-
}
|
|
50
|
-
(function (agentloop) {
|
|
51
|
-
agentloop.FunctionCallLimitExceeded = CompatibleAgentloopModule.agentloop.FunctionCallLimitExceeded;
|
|
52
|
-
})(agentloop || (agentloop = {}));
|
|
53
|
-
//# sourceMappingURL=agentloop.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"agentloop.js","sourceRoot":"","sources":["../../../src/native-engines.d/openai-responses/agentloop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,WAAW,EAAgB,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,KAAK,yBAAyB,MAAM,oBAAoB,CAAC;AAGhE;;GAEG;AACH,MAAM,CAAC,KAAK,SAAU,CAAC,CAAA,SAAS,CAC5B,KAAuB,EACvB,OAAgD,EAChD,MAAwC,EACxC,GAAkB,EAClB,KAAK,GAAG,MAAM,CAAC,iBAAiB;IAGhC,KAAK,IAAI,CAAC,GAAG,CA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C,KAAK,IAAI,EAAE;oBAClB,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC;wBACnC,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,OAAO;wBACnB,OAAO,EAAE,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC;qBACjD,CAAC,CAAC;gBACP,CAAC,CAAC,EAAE,CAAC,CAAC;YACV,CAAC;;gBAAM,MAAM,IAAI,KAAK,EAAE,CAAC;QAC7B,CAAC;QACD,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACpC,MAAM,CAAC,eAAe,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM,CAAM,GAAG,CAAC,CAAC,CAAC;IACvE,CAAC;IACD,MAAM,IAAI,SAAS,CAAC,yBAAyB,CAAC,+BAA+B,CAAC,CAAC;AACnF,CAAC;AAED,WAAiB,SAAS;IACR,mCAAyB,GAAG,yBAAyB,CAAC,SAAS,CAAC,yBAAyB,CAAC;AAC5G,CAAC,EAFgB,SAAS,KAAT,SAAS,QAEzB"}
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { Function } from '../../function.ts';
|
|
2
|
-
import { RoleMessage, type ChatMessage, type Session } from './session.ts';
|
|
3
|
-
import { Tool } from './tool.ts';
|
|
4
|
-
import { Engine } from '../../engine.ts';
|
|
5
|
-
import { type InferenceContext } from '../../inference-context.ts';
|
|
6
|
-
import OpenAI from 'openai';
|
|
7
|
-
import * as Undici from 'undici';
|
|
8
|
-
import { OpenAIResponsesEngine } from '../../api-types/openai-responses.ts';
|
|
9
|
-
import { Throttle } from '../../throttle.ts';
|
|
10
|
-
export interface OpenAIResponsesNativeEngine<fdm extends Function.Declaration.Map> extends Engine {
|
|
11
|
-
/**
|
|
12
|
-
* @throws {@link USER_ABORTION} 用户中止
|
|
13
|
-
* @throws {@link InferenceTimeout} 推理超时
|
|
14
|
-
* @throws {@link ResponseInvalid} 模型抽风
|
|
15
|
-
* @throws {TypeError} 网络故障
|
|
16
|
-
*/
|
|
17
|
-
stateless(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
18
|
-
/**
|
|
19
|
-
* @param session mutable
|
|
20
|
-
*/
|
|
21
|
-
stateful(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
22
|
-
appendUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
23
|
-
/**
|
|
24
|
-
* @param session mutable
|
|
25
|
-
*/
|
|
26
|
-
pushUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
27
|
-
}
|
|
28
|
-
export declare namespace OpenAIResponsesNativeEngine {
|
|
29
|
-
interface Options<in out fdm extends Function.Declaration.Map> extends Engine.Options<fdm>, OpenAIResponsesEngine.Options<fdm> {
|
|
30
|
-
applyPatch?: boolean;
|
|
31
|
-
toolChoice?: Tool.Choice<fdm>;
|
|
32
|
-
}
|
|
33
|
-
interface ParentUnderhood<in out fdm extends Function.Declaration.Map> extends Engine.Underhood<fdm>, OpenAIResponsesEngine.Underhood<fdm> {
|
|
34
|
-
}
|
|
35
|
-
interface OwnProps<in out fdm extends Function.Declaration.Map> {
|
|
36
|
-
apiURL: URL;
|
|
37
|
-
toolChoice: Tool.Choice<fdm>;
|
|
38
|
-
applyPatch: boolean;
|
|
39
|
-
}
|
|
40
|
-
namespace OwnProps {
|
|
41
|
-
function init<fdm extends Function.Declaration.Map>(this: ParentUnderhood<fdm>, options: Options<fdm>): OwnProps<fdm>;
|
|
42
|
-
}
|
|
43
|
-
interface Underhood<in out fdm extends Function.Declaration.Map> extends ParentUnderhood<fdm>, OpenAIResponsesNativeEngine<fdm>, OwnProps<fdm> {
|
|
44
|
-
stateless(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
45
|
-
stateful(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
46
|
-
appendUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
47
|
-
pushUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
48
|
-
convertToAiMessage(output: OpenAI.Responses.ResponseOutputItem[]): RoleMessage.Ai<Function.Declaration.From<fdm>>;
|
|
49
|
-
convertFromUserMessage(userMessage: RoleMessage.User<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseInput;
|
|
50
|
-
convertFromDeveloperMessage(developerMessage: RoleMessage.Developer): string;
|
|
51
|
-
convertFromChatMessage(chatMessage: ChatMessage<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseInput;
|
|
52
|
-
convertFromToolChoice(toolChoice: Tool.Choice<fdm>): OpenAI.Responses.ToolChoiceOptions | OpenAI.Responses.ToolChoiceAllowed;
|
|
53
|
-
makeMonolithParams(session: Session<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseCreateParamsNonStreaming;
|
|
54
|
-
logAiMessage(output: OpenAI.Responses.ResponseOutputItem[]): void;
|
|
55
|
-
fetch(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
56
|
-
fetchRaw(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
57
|
-
validateToolCallsByToolChoice(toolCalls: Tool.Call<Function.Declaration.From<fdm>>[]): void;
|
|
58
|
-
}
|
|
59
|
-
function stateless<fdm extends Function.Declaration.Map>(this: OpenAIResponsesNativeEngine.Underhood<fdm>, wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
60
|
-
function stateful<fdm extends Function.Declaration.Map>(this: OpenAIResponsesNativeEngine.Underhood<fdm>, wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
61
|
-
function appendUserMessage<fdm extends Function.Declaration.Map>(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
62
|
-
function pushUserMessage<fdm extends Function.Declaration.Map>(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm>>;
|
|
63
|
-
function convertToAiMessage<fdm extends Function.Declaration.Map>(this: OpenAIResponsesEngine.Underhood<fdm>, output: OpenAI.Responses.ResponseOutputItem[]): RoleMessage.Ai<Function.Declaration.From<fdm>>;
|
|
64
|
-
function convertFromUserMessage<fdm extends Function.Declaration.Map>(this: OpenAIResponsesEngine.Underhood<fdm>, userMessage: RoleMessage.User<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseInput;
|
|
65
|
-
function convertFromDeveloperMessage(developerMessage: RoleMessage.Developer): string;
|
|
66
|
-
function convertFromChatMessage<fdm extends Function.Declaration.Map>(this: OpenAIResponsesNativeEngine.Underhood<fdm>, chatMessage: ChatMessage<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseInput;
|
|
67
|
-
function convertFromToolChoice<fdm extends Function.Declaration.Map>(toolChoice: Tool.Choice<fdm>): OpenAI.Responses.ToolChoiceOptions | OpenAI.Responses.ToolChoiceAllowed;
|
|
68
|
-
function makeMonolithParams<fdm extends Function.Declaration.Map>(this: OpenAIResponsesNativeEngine.Underhood<fdm>, session: Session<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseCreateParamsNonStreaming;
|
|
69
|
-
function logAiMessage<fdm extends Function.Declaration.Map>(this: Engine.Underhood<fdm>, output: OpenAI.Responses.ResponseOutputItem[]): void;
|
|
70
|
-
function fetch<fdm extends Function.Declaration.Map>(this: OpenAIResponsesNativeEngine.Underhood<fdm>, wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
71
|
-
function fetchRaw<fdm extends Function.Declaration.Map>(this: OpenAIResponsesNativeEngine.Underhood<fdm>, wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm>>>;
|
|
72
|
-
function validateToolCallsByToolChoice<fdm extends Function.Declaration.Map>(this: OpenAIResponsesNativeEngine.Underhood<fdm>, toolCalls: Tool.Call<Function.Declaration.From<fdm>>[]): void;
|
|
73
|
-
class Instance<in out fdm extends Function.Declaration.Map> implements OpenAIResponsesNativeEngine.Underhood<fdm> {
|
|
74
|
-
baseUrl: string;
|
|
75
|
-
apiKey: string;
|
|
76
|
-
model: string;
|
|
77
|
-
name: string;
|
|
78
|
-
inputPrice: number;
|
|
79
|
-
outputPrice: number;
|
|
80
|
-
cachePrice: number;
|
|
81
|
-
fdm: fdm;
|
|
82
|
-
additionalOptions?: Record<string, unknown>;
|
|
83
|
-
throttle: Throttle;
|
|
84
|
-
timeout?: number;
|
|
85
|
-
maxTokens?: number;
|
|
86
|
-
proxyAgent?: Undici.ProxyAgent;
|
|
87
|
-
apiURL: URL;
|
|
88
|
-
parallelToolCall: boolean;
|
|
89
|
-
applyPatch: boolean;
|
|
90
|
-
toolChoice: Tool.Choice<fdm>;
|
|
91
|
-
constructor(options: OpenAIResponsesNativeEngine.Options<fdm>);
|
|
92
|
-
convertFromFunctionResponse(fr: Function.Response.Distributive<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseInputItem.FunctionCallOutput;
|
|
93
|
-
calcCost(usage: OpenAI.Responses.ResponseUsage): number;
|
|
94
|
-
convertFromFunctionDeclarationEntry(fdentry: Function.Declaration.Entry.From<fdm>): OpenAI.Responses.FunctionTool;
|
|
95
|
-
convertToFunctionCall(apifc: OpenAI.Responses.ResponseFunctionToolCall): Function.Call.Distributive<Function.Declaration.From<fdm>>;
|
|
96
|
-
stateless(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>>;
|
|
97
|
-
stateful(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>): Promise<RoleMessage.Ai<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>>;
|
|
98
|
-
appendUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>;
|
|
99
|
-
pushUserMessage(session: Session<Function.Declaration.From<fdm>>, message: RoleMessage.User<Function.Declaration.From<fdm>>): Session<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>;
|
|
100
|
-
fetch(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>>;
|
|
101
|
-
fetchRaw(wfctx: InferenceContext, session: Session<Function.Declaration.From<fdm>>, signal?: AbortSignal): Promise<RoleMessage.Ai<Function.Declaration.From<fdm, Extract<keyof fdm, string>>>>;
|
|
102
|
-
convertToAiMessage(output: OpenAI.Responses.ResponseOutputItem[]): RoleMessage.Ai<Function.Declaration.From<fdm>>;
|
|
103
|
-
convertFromChatMessage(chatMessage: ChatMessage<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseInput;
|
|
104
|
-
convertFromUserMessage(userMessage: RoleMessage.User<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseInput;
|
|
105
|
-
convertFromDeveloperMessage(developerMessage: RoleMessage.Developer): string;
|
|
106
|
-
convertFromToolChoice(toolChoice: Tool.Choice<fdm>): OpenAI.Responses.ToolChoiceOptions | OpenAI.Responses.ToolChoiceAllowed;
|
|
107
|
-
makeMonolithParams(session: Session<Function.Declaration.From<fdm>>): OpenAI.Responses.ResponseCreateParamsNonStreaming;
|
|
108
|
-
logAiMessage(output: OpenAI.Responses.ResponseOutputItem[]): void;
|
|
109
|
-
validateToolCallsByToolChoice(toolCalls: Tool.Call<Function.Declaration.From<fdm>>[]): void;
|
|
110
|
-
}
|
|
111
|
-
function create<fdm extends Function.Declaration.Map>(options: OpenAIResponsesNativeEngine.Options<fdm>): OpenAIResponsesNativeEngine<fdm>;
|
|
112
|
-
}
|