@opencode/ai 0.0.0-beta-19275
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 +682 -0
- package/dist/cache-policy.d.ts +2 -0
- package/dist/cache-policy.js +129 -0
- package/dist/image-client.d.ts +19 -0
- package/dist/image-client.js +28 -0
- package/dist/image.d.ts +110 -0
- package/dist/image.js +103 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +12 -0
- package/dist/llm.d.ts +252 -0
- package/dist/llm.js +74 -0
- package/dist/protocols/anthropic-messages.d.ts +957 -0
- package/dist/protocols/anthropic-messages.js +1414 -0
- package/dist/protocols/bedrock-converse.d.ts +499 -0
- package/dist/protocols/bedrock-converse.js +643 -0
- package/dist/protocols/bedrock-event-stream.d.ts +9 -0
- package/dist/protocols/bedrock-event-stream.js +97 -0
- package/dist/protocols/gemini.d.ts +285 -0
- package/dist/protocols/gemini.js +671 -0
- package/dist/protocols/google-images.d.ts +30 -0
- package/dist/protocols/google-images.js +181 -0
- package/dist/protocols/index.d.ts +12 -0
- package/dist/protocols/index.js +12 -0
- package/dist/protocols/meta-images.d.ts +26 -0
- package/dist/protocols/meta-images.js +89 -0
- package/dist/protocols/meta-messages.d.ts +350 -0
- package/dist/protocols/meta-messages.js +41 -0
- package/dist/protocols/meta-responses.d.ts +473 -0
- package/dist/protocols/meta-responses.js +173 -0
- package/dist/protocols/mistral-chat.d.ts +540 -0
- package/dist/protocols/mistral-chat.js +624 -0
- package/dist/protocols/open-responses-channel.d.ts +23 -0
- package/dist/protocols/open-responses-channel.js +141 -0
- package/dist/protocols/open-responses-continuation.d.ts +12 -0
- package/dist/protocols/open-responses-continuation.js +161 -0
- package/dist/protocols/open-responses.d.ts +1583 -0
- package/dist/protocols/open-responses.js +1206 -0
- package/dist/protocols/openai-chat.d.ts +860 -0
- package/dist/protocols/openai-chat.js +966 -0
- package/dist/protocols/openai-compatible-chat.d.ts +109 -0
- package/dist/protocols/openai-compatible-chat.js +19 -0
- package/dist/protocols/openai-compatible-responses.d.ts +172 -0
- package/dist/protocols/openai-compatible-responses.js +18 -0
- package/dist/protocols/openai-images.d.ts +32 -0
- package/dist/protocols/openai-images.js +183 -0
- package/dist/protocols/openai-responses.d.ts +1389 -0
- package/dist/protocols/openai-responses.js +260 -0
- package/dist/protocols/shared.d.ts +193 -0
- package/dist/protocols/shared.js +290 -0
- package/dist/protocols/utils/bedrock-auth.d.ts +60 -0
- package/dist/protocols/utils/bedrock-auth.js +85 -0
- package/dist/protocols/utils/bedrock-cache.d.ts +19 -0
- package/dist/protocols/utils/bedrock-cache.js +49 -0
- package/dist/protocols/utils/bedrock-media.d.ts +55 -0
- package/dist/protocols/utils/bedrock-media.js +73 -0
- package/dist/protocols/utils/cache.d.ts +6 -0
- package/dist/protocols/utils/cache.js +5 -0
- package/dist/protocols/utils/gemini-tool-schema.d.ts +2 -0
- package/dist/protocols/utils/gemini-tool-schema.js +103 -0
- package/dist/protocols/utils/image-input.d.ts +21 -0
- package/dist/protocols/utils/image-input.js +20 -0
- package/dist/protocols/utils/lifecycle.d.ts +24 -0
- package/dist/protocols/utils/lifecycle.js +72 -0
- package/dist/protocols/utils/meta-image.d.ts +2 -0
- package/dist/protocols/utils/meta-image.js +13 -0
- package/dist/protocols/utils/open-responses-options.d.ts +56 -0
- package/dist/protocols/utils/open-responses-options.js +61 -0
- package/dist/protocols/utils/openai-image.d.ts +5 -0
- package/dist/protocols/utils/openai-image.js +18 -0
- package/dist/protocols/utils/openai-options.d.ts +16 -0
- package/dist/protocols/utils/openai-options.js +14 -0
- package/dist/protocols/utils/partial-json-options.d.ts +62 -0
- package/dist/protocols/utils/partial-json-options.js +52 -0
- package/dist/protocols/utils/partial-json.d.ts +8 -0
- package/dist/protocols/utils/partial-json.js +279 -0
- package/dist/protocols/utils/responses-checkpoint.d.ts +4 -0
- package/dist/protocols/utils/responses-checkpoint.js +107 -0
- package/dist/protocols/utils/responses-compaction.d.ts +4 -0
- package/dist/protocols/utils/responses-compaction.js +129 -0
- package/dist/protocols/utils/responses-hosted-tools.d.ts +26 -0
- package/dist/protocols/utils/responses-hosted-tools.js +32 -0
- package/dist/protocols/utils/tool-schema.d.ts +8 -0
- package/dist/protocols/utils/tool-schema.js +54 -0
- package/dist/protocols/utils/tool-stream.d.ts +710 -0
- package/dist/protocols/utils/tool-stream.js +155 -0
- package/dist/protocols/xai-images.d.ts +26 -0
- package/dist/protocols/xai-images.js +106 -0
- package/dist/protocols/xai-responses.d.ts +250 -0
- package/dist/protocols/xai-responses.js +81 -0
- package/dist/protocols/zai-images.d.ts +22 -0
- package/dist/protocols/zai-images.js +79 -0
- package/dist/protocols.d.ts +1 -0
- package/dist/protocols.js +1 -0
- package/dist/provider-error.d.ts +15 -0
- package/dist/provider-error.js +125 -0
- package/dist/provider-package.d.ts +11 -0
- package/dist/provider-package.js +1 -0
- package/dist/provider.d.ts +23 -0
- package/dist/provider.js +2 -0
- package/dist/providers/amazon-bedrock/mantle/chat.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/chat.js +1 -0
- package/dist/providers/amazon-bedrock/mantle/responses.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle/responses.js +1 -0
- package/dist/providers/amazon-bedrock/mantle.d.ts +2 -0
- package/dist/providers/amazon-bedrock/mantle.js +1 -0
- package/dist/providers/amazon-bedrock-mantle.d.ts +371 -0
- package/dist/providers/amazon-bedrock-mantle.js +76 -0
- package/dist/providers/amazon-bedrock.d.ts +173 -0
- package/dist/providers/amazon-bedrock.js +41 -0
- package/dist/providers/anthropic-compatible.d.ts +304 -0
- package/dist/providers/anthropic-compatible.js +44 -0
- package/dist/providers/anthropic.d.ts +302 -0
- package/dist/providers/anthropic.js +39 -0
- package/dist/providers/azure/chat.d.ts +2 -0
- package/dist/providers/azure/chat.js +1 -0
- package/dist/providers/azure/responses.d.ts +2 -0
- package/dist/providers/azure/responses.js +1 -0
- package/dist/providers/azure.d.ts +599 -0
- package/dist/providers/azure.js +115 -0
- package/dist/providers/baseten.d.ts +229 -0
- package/dist/providers/baseten.js +38 -0
- package/dist/providers/cerebras.d.ts +228 -0
- package/dist/providers/cerebras.js +40 -0
- package/dist/providers/cloudflare-ai-gateway.d.ts +238 -0
- package/dist/providers/cloudflare-ai-gateway.js +59 -0
- package/dist/providers/cloudflare-workers-ai.d.ts +232 -0
- package/dist/providers/cloudflare-workers-ai.js +45 -0
- package/dist/providers/deepinfra.d.ts +228 -0
- package/dist/providers/deepinfra.js +43 -0
- package/dist/providers/deepseek.d.ts +229 -0
- package/dist/providers/deepseek.js +41 -0
- package/dist/providers/fireworks.d.ts +229 -0
- package/dist/providers/fireworks.js +38 -0
- package/dist/providers/google-vertex/chat.d.ts +2 -0
- package/dist/providers/google-vertex/chat.js +1 -0
- package/dist/providers/google-vertex/gemini.d.ts +2 -0
- package/dist/providers/google-vertex/gemini.js +1 -0
- package/dist/providers/google-vertex/messages.d.ts +2 -0
- package/dist/providers/google-vertex/messages.js +1 -0
- package/dist/providers/google-vertex/responses.d.ts +2 -0
- package/dist/providers/google-vertex/responses.js +1 -0
- package/dist/providers/google-vertex-chat.d.ts +133 -0
- package/dist/providers/google-vertex-chat.js +55 -0
- package/dist/providers/google-vertex-messages.d.ts +301 -0
- package/dist/providers/google-vertex-messages.js +75 -0
- package/dist/providers/google-vertex-responses.d.ts +198 -0
- package/dist/providers/google-vertex-responses.js +56 -0
- package/dist/providers/google-vertex-shared.d.ts +22 -0
- package/dist/providers/google-vertex-shared.js +61 -0
- package/dist/providers/google-vertex.d.ts +120 -0
- package/dist/providers/google-vertex.js +92 -0
- package/dist/providers/google.d.ts +115 -0
- package/dist/providers/google.js +42 -0
- package/dist/providers/groq.d.ts +315 -0
- package/dist/providers/groq.js +81 -0
- package/dist/providers/index.d.ts +28 -0
- package/dist/providers/index.js +28 -0
- package/dist/providers/meta/chat.d.ts +2 -0
- package/dist/providers/meta/chat.js +1 -0
- package/dist/providers/meta/messages.d.ts +2 -0
- package/dist/providers/meta/messages.js +1 -0
- package/dist/providers/meta/responses.d.ts +2 -0
- package/dist/providers/meta/responses.js +1 -0
- package/dist/providers/meta.d.ts +631 -0
- package/dist/providers/meta.js +113 -0
- package/dist/providers/minimax/chat.d.ts +4 -0
- package/dist/providers/minimax/chat.js +8 -0
- package/dist/providers/minimax/messages.d.ts +1 -0
- package/dist/providers/minimax/messages.js +1 -0
- package/dist/providers/minimax/responses.d.ts +4 -0
- package/dist/providers/minimax/responses.js +8 -0
- package/dist/providers/minimax.d.ts +593 -0
- package/dist/providers/minimax.js +89 -0
- package/dist/providers/mistral.d.ts +208 -0
- package/dist/providers/mistral.js +28 -0
- package/dist/providers/open-responses-options.d.ts +6 -0
- package/dist/providers/open-responses-options.js +1 -0
- package/dist/providers/openai/chat.d.ts +2 -0
- package/dist/providers/openai/chat.js +1 -0
- package/dist/providers/openai/responses.d.ts +2 -0
- package/dist/providers/openai/responses.js +1 -0
- package/dist/providers/openai-compatible/responses.d.ts +1 -0
- package/dist/providers/openai-compatible/responses.js +1 -0
- package/dist/providers/openai-compatible-responses.d.ts +196 -0
- package/dist/providers/openai-compatible-responses.js +32 -0
- package/dist/providers/openai-compatible.d.ts +131 -0
- package/dist/providers/openai-compatible.js +33 -0
- package/dist/providers/openai-options.d.ts +26 -0
- package/dist/providers/openai-options.js +41 -0
- package/dist/providers/openai.d.ts +405 -0
- package/dist/providers/openai.js +82 -0
- package/dist/providers/openrouter.d.ts +564 -0
- package/dist/providers/openrouter.js +114 -0
- package/dist/providers/togetherai.d.ts +228 -0
- package/dist/providers/togetherai.js +40 -0
- package/dist/providers/xai.d.ts +164 -0
- package/dist/providers/xai.js +84 -0
- package/dist/providers/zai.d.ts +24 -0
- package/dist/providers/zai.js +21 -0
- package/dist/providers.d.ts +1 -0
- package/dist/providers.js +1 -0
- package/dist/route/auth-options.d.ts +34 -0
- package/dist/route/auth-options.js +14 -0
- package/dist/route/auth.d.ts +51 -0
- package/dist/route/auth.js +87 -0
- package/dist/route/client.d.ts +430 -0
- package/dist/route/client.js +304 -0
- package/dist/route/endpoint.d.ts +28 -0
- package/dist/route/endpoint.js +21 -0
- package/dist/route/executor.d.ts +27 -0
- package/dist/route/executor.js +183 -0
- package/dist/route/framing.d.ts +29 -0
- package/dist/route/framing.js +14 -0
- package/dist/route/index.d.ts +16 -0
- package/dist/route/index.js +9 -0
- package/dist/route/protocol.d.ts +76 -0
- package/dist/route/protocol.js +16 -0
- package/dist/route/transport/http.d.ts +34 -0
- package/dist/route/transport/http.js +68 -0
- package/dist/route/transport/index.d.ts +41 -0
- package/dist/route/transport/index.js +4 -0
- package/dist/route/transport/websocket-channel.d.ts +57 -0
- package/dist/route/transport/websocket-channel.js +1 -0
- package/dist/route/transport/websocket.d.ts +56 -0
- package/dist/route/transport/websocket.js +366 -0
- package/dist/route.d.ts +1 -0
- package/dist/route.js +1 -0
- package/dist/schema/errors.d.ts +158 -0
- package/dist/schema/errors.js +120 -0
- package/dist/schema/events.d.ts +8123 -0
- package/dist/schema/events.js +550 -0
- package/dist/schema/ids.d.ts +17 -0
- package/dist/schema/ids.js +10 -0
- package/dist/schema/index.d.ts +5 -0
- package/dist/schema/index.js +5 -0
- package/dist/schema/messages.d.ts +646 -0
- package/dist/schema/messages.js +301 -0
- package/dist/schema/options.d.ts +157 -0
- package/dist/schema/options.js +187 -0
- package/dist/testing.d.ts +1693 -0
- package/dist/testing.js +129 -0
- package/dist/tool-history.d.ts +2 -0
- package/dist/tool-history.js +84 -0
- package/dist/tool-runtime.d.ts +15 -0
- package/dist/tool-runtime.js +62 -0
- package/dist/tool.d.ts +136 -0
- package/dist/tool.js +66 -0
- package/dist/utils/record.d.ts +2 -0
- package/dist/utils/record.js +2 -0
- package/dist/utils/sanitize.d.ts +1 -0
- package/dist/utils/sanitize.js +12 -0
- package/package.json +48 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import { MistralChat } from "../protocols/mistral-chat.js";
|
|
3
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
+
import type { RouteDefaultsInput } from "../route/client.js";
|
|
5
|
+
import { type ModelID } from "../schema/index.js";
|
|
6
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
+
export type ProviderOptions = MistralChat.ProviderOptionsInput;
|
|
8
|
+
export type LanguageModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
9
|
+
readonly baseURL?: string;
|
|
10
|
+
readonly providerOptions?: ProviderOptions;
|
|
11
|
+
};
|
|
12
|
+
export interface Settings extends ProviderPackage.Settings {
|
|
13
|
+
readonly apiKey?: string;
|
|
14
|
+
readonly baseURL?: string;
|
|
15
|
+
readonly providerOptions?: ProviderOptions;
|
|
16
|
+
}
|
|
17
|
+
export declare const route: import("../route/client.js").Route<{
|
|
18
|
+
readonly model: string;
|
|
19
|
+
readonly messages: readonly ({
|
|
20
|
+
readonly role: "system";
|
|
21
|
+
readonly content: string;
|
|
22
|
+
} | {
|
|
23
|
+
readonly role: "user";
|
|
24
|
+
readonly content: string | readonly ({
|
|
25
|
+
readonly type: "text";
|
|
26
|
+
readonly text: string;
|
|
27
|
+
} | {
|
|
28
|
+
readonly type: "image_url";
|
|
29
|
+
readonly image_url: string;
|
|
30
|
+
} | {
|
|
31
|
+
readonly type: "document_url";
|
|
32
|
+
readonly document_url: string;
|
|
33
|
+
})[];
|
|
34
|
+
} | {
|
|
35
|
+
readonly content: string | readonly ({
|
|
36
|
+
readonly [x: string]: unknown;
|
|
37
|
+
readonly type: "thinking";
|
|
38
|
+
readonly thinking: readonly {
|
|
39
|
+
readonly [x: string]: unknown;
|
|
40
|
+
readonly type?: string | undefined;
|
|
41
|
+
readonly text?: string | undefined;
|
|
42
|
+
}[];
|
|
43
|
+
} | {
|
|
44
|
+
readonly type: "text";
|
|
45
|
+
readonly text: string;
|
|
46
|
+
})[];
|
|
47
|
+
readonly role: "assistant";
|
|
48
|
+
readonly tool_calls?: readonly {
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly type: "function";
|
|
51
|
+
readonly function: {
|
|
52
|
+
readonly name: string;
|
|
53
|
+
readonly arguments: string;
|
|
54
|
+
};
|
|
55
|
+
}[] | undefined;
|
|
56
|
+
readonly prefix?: true | undefined;
|
|
57
|
+
} | {
|
|
58
|
+
readonly role: "tool";
|
|
59
|
+
readonly tool_call_id: string;
|
|
60
|
+
readonly name: string;
|
|
61
|
+
readonly content: string | readonly ({
|
|
62
|
+
readonly type: "text";
|
|
63
|
+
readonly text: string;
|
|
64
|
+
} | {
|
|
65
|
+
readonly type: "image_url";
|
|
66
|
+
readonly image_url: string;
|
|
67
|
+
} | {
|
|
68
|
+
readonly type: "document_url";
|
|
69
|
+
readonly document_url: string;
|
|
70
|
+
})[];
|
|
71
|
+
})[];
|
|
72
|
+
readonly stream: true;
|
|
73
|
+
readonly max_tokens?: number | undefined;
|
|
74
|
+
readonly tools?: readonly {
|
|
75
|
+
readonly type: "function";
|
|
76
|
+
readonly function: {
|
|
77
|
+
readonly name: string;
|
|
78
|
+
readonly description: string;
|
|
79
|
+
readonly parameters: {
|
|
80
|
+
readonly [x: string]: unknown;
|
|
81
|
+
};
|
|
82
|
+
readonly strict: false;
|
|
83
|
+
};
|
|
84
|
+
}[] | undefined;
|
|
85
|
+
readonly stop?: readonly string[] | undefined;
|
|
86
|
+
readonly temperature?: number | undefined;
|
|
87
|
+
readonly tool_choice?: "auto" | "none" | "any" | {
|
|
88
|
+
readonly type: "function";
|
|
89
|
+
readonly function: {
|
|
90
|
+
readonly name: string;
|
|
91
|
+
};
|
|
92
|
+
} | undefined;
|
|
93
|
+
readonly top_p?: number | undefined;
|
|
94
|
+
readonly random_seed?: number | undefined;
|
|
95
|
+
readonly frequency_penalty?: number | undefined;
|
|
96
|
+
readonly presence_penalty?: number | undefined;
|
|
97
|
+
readonly prompt_cache_key?: string | undefined;
|
|
98
|
+
readonly safe_prompt?: boolean | undefined;
|
|
99
|
+
readonly document_image_limit?: number | undefined;
|
|
100
|
+
readonly document_page_limit?: number | undefined;
|
|
101
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
102
|
+
readonly reasoning_effort?: string | undefined;
|
|
103
|
+
readonly prompt_mode?: "reasoning" | undefined;
|
|
104
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>;
|
|
105
|
+
export declare const routes: import("../route/client.js").Route<{
|
|
106
|
+
readonly model: string;
|
|
107
|
+
readonly messages: readonly ({
|
|
108
|
+
readonly role: "system";
|
|
109
|
+
readonly content: string;
|
|
110
|
+
} | {
|
|
111
|
+
readonly role: "user";
|
|
112
|
+
readonly content: string | readonly ({
|
|
113
|
+
readonly type: "text";
|
|
114
|
+
readonly text: string;
|
|
115
|
+
} | {
|
|
116
|
+
readonly type: "image_url";
|
|
117
|
+
readonly image_url: string;
|
|
118
|
+
} | {
|
|
119
|
+
readonly type: "document_url";
|
|
120
|
+
readonly document_url: string;
|
|
121
|
+
})[];
|
|
122
|
+
} | {
|
|
123
|
+
readonly content: string | readonly ({
|
|
124
|
+
readonly [x: string]: unknown;
|
|
125
|
+
readonly type: "thinking";
|
|
126
|
+
readonly thinking: readonly {
|
|
127
|
+
readonly [x: string]: unknown;
|
|
128
|
+
readonly type?: string | undefined;
|
|
129
|
+
readonly text?: string | undefined;
|
|
130
|
+
}[];
|
|
131
|
+
} | {
|
|
132
|
+
readonly type: "text";
|
|
133
|
+
readonly text: string;
|
|
134
|
+
})[];
|
|
135
|
+
readonly role: "assistant";
|
|
136
|
+
readonly tool_calls?: readonly {
|
|
137
|
+
readonly id: string;
|
|
138
|
+
readonly type: "function";
|
|
139
|
+
readonly function: {
|
|
140
|
+
readonly name: string;
|
|
141
|
+
readonly arguments: string;
|
|
142
|
+
};
|
|
143
|
+
}[] | undefined;
|
|
144
|
+
readonly prefix?: true | undefined;
|
|
145
|
+
} | {
|
|
146
|
+
readonly role: "tool";
|
|
147
|
+
readonly tool_call_id: string;
|
|
148
|
+
readonly name: string;
|
|
149
|
+
readonly content: string | readonly ({
|
|
150
|
+
readonly type: "text";
|
|
151
|
+
readonly text: string;
|
|
152
|
+
} | {
|
|
153
|
+
readonly type: "image_url";
|
|
154
|
+
readonly image_url: string;
|
|
155
|
+
} | {
|
|
156
|
+
readonly type: "document_url";
|
|
157
|
+
readonly document_url: string;
|
|
158
|
+
})[];
|
|
159
|
+
})[];
|
|
160
|
+
readonly stream: true;
|
|
161
|
+
readonly max_tokens?: number | undefined;
|
|
162
|
+
readonly tools?: readonly {
|
|
163
|
+
readonly type: "function";
|
|
164
|
+
readonly function: {
|
|
165
|
+
readonly name: string;
|
|
166
|
+
readonly description: string;
|
|
167
|
+
readonly parameters: {
|
|
168
|
+
readonly [x: string]: unknown;
|
|
169
|
+
};
|
|
170
|
+
readonly strict: false;
|
|
171
|
+
};
|
|
172
|
+
}[] | undefined;
|
|
173
|
+
readonly stop?: readonly string[] | undefined;
|
|
174
|
+
readonly temperature?: number | undefined;
|
|
175
|
+
readonly tool_choice?: "auto" | "none" | "any" | {
|
|
176
|
+
readonly type: "function";
|
|
177
|
+
readonly function: {
|
|
178
|
+
readonly name: string;
|
|
179
|
+
};
|
|
180
|
+
} | undefined;
|
|
181
|
+
readonly top_p?: number | undefined;
|
|
182
|
+
readonly random_seed?: number | undefined;
|
|
183
|
+
readonly frequency_penalty?: number | undefined;
|
|
184
|
+
readonly presence_penalty?: number | undefined;
|
|
185
|
+
readonly prompt_cache_key?: string | undefined;
|
|
186
|
+
readonly safe_prompt?: boolean | undefined;
|
|
187
|
+
readonly document_image_limit?: number | undefined;
|
|
188
|
+
readonly document_page_limit?: number | undefined;
|
|
189
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
190
|
+
readonly reasoning_effort?: string | undefined;
|
|
191
|
+
readonly prompt_mode?: "reasoning" | undefined;
|
|
192
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
193
|
+
export declare const configure: (input?: LanguageModelOptions) => {
|
|
194
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
195
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
196
|
+
configure: (input?: LanguageModelOptions) => /*elided*/ any;
|
|
197
|
+
};
|
|
198
|
+
export declare const provider: {
|
|
199
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
200
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
201
|
+
configure: (input?: LanguageModelOptions) => {
|
|
202
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
203
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<MistralChat.ProviderOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
204
|
+
configure: /*elided*/ any;
|
|
205
|
+
};
|
|
206
|
+
};
|
|
207
|
+
export declare const model: ProviderPackage.Definition<Settings, ProviderOptions>["model"];
|
|
208
|
+
export * as Mistral from "./mistral.js";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MistralChat } from "../protocols/mistral-chat.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
4
|
+
export const id = ProviderID.make("mistral");
|
|
5
|
+
export const route = MistralChat.route;
|
|
6
|
+
export const routes = [route];
|
|
7
|
+
export const configure = (input = {}) => {
|
|
8
|
+
const { apiKey: _apiKey, auth: _auth, baseURL, ...defaults } = input;
|
|
9
|
+
const configured = route.with({
|
|
10
|
+
...defaults,
|
|
11
|
+
endpoint: { baseURL: baseURL ?? MistralChat.DEFAULT_BASE_URL },
|
|
12
|
+
auth: AuthOptions.bearer(input, "MISTRAL_API_KEY"),
|
|
13
|
+
});
|
|
14
|
+
return {
|
|
15
|
+
id,
|
|
16
|
+
model: (modelID) => configured.model({ id: modelID }),
|
|
17
|
+
configure,
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export const provider = configure();
|
|
21
|
+
export const model = (modelID, settings) => configure({
|
|
22
|
+
apiKey: settings.apiKey,
|
|
23
|
+
baseURL: settings.baseURL,
|
|
24
|
+
headers: settings.headers === undefined ? undefined : { ...settings.headers },
|
|
25
|
+
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
26
|
+
providerOptions: settings.providerOptions,
|
|
27
|
+
}).model(modelID);
|
|
28
|
+
export * as Mistral from "./mistral.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Options } from "../protocols/utils/open-responses-options.js";
|
|
2
|
+
export type OpenResponsesOptionsInput = Options & {
|
|
3
|
+
readonly [key: string]: unknown;
|
|
4
|
+
};
|
|
5
|
+
export type OpenResponsesProviderOptionsInput = OpenResponsesOptionsInput;
|
|
6
|
+
export * as OpenResponsesProviderOptions from "./open-responses-options.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as OpenResponsesProviderOptions from "./open-responses-options.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { chatModel as model } from "../openai.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { model } from "../openai.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../openai-compatible-responses.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../openai-compatible-responses.js";
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
2
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
3
|
+
import type { RouteDefaultsInput } from "../route/client.js";
|
|
4
|
+
import { type ModelID } from "../schema/index.js";
|
|
5
|
+
import type { OpenResponsesProviderOptionsInput } from "./open-responses-options.js";
|
|
6
|
+
export type { OpenResponsesOptionsInput, OpenResponsesProviderOptionsInput } from "./open-responses-options.js";
|
|
7
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
8
|
+
export type Config = RouteDefaultsInput & ProviderAuthOption<"optional"> & {
|
|
9
|
+
readonly provider?: string;
|
|
10
|
+
readonly baseURL: string;
|
|
11
|
+
readonly providerOptions?: OpenResponsesProviderOptionsInput;
|
|
12
|
+
};
|
|
13
|
+
export interface Settings extends ProviderPackage.Settings {
|
|
14
|
+
readonly apiKey?: string;
|
|
15
|
+
readonly baseURL: string;
|
|
16
|
+
readonly provider?: string;
|
|
17
|
+
readonly providerOptions?: OpenResponsesProviderOptionsInput;
|
|
18
|
+
}
|
|
19
|
+
export declare const routes: import("../route/client.js").Route<{
|
|
20
|
+
readonly input: readonly ({
|
|
21
|
+
readonly [x: string]: unknown;
|
|
22
|
+
readonly id: string;
|
|
23
|
+
readonly type: "web_search_call";
|
|
24
|
+
readonly status?: string | undefined;
|
|
25
|
+
readonly action?: {
|
|
26
|
+
readonly [x: string]: unknown;
|
|
27
|
+
} | null | undefined;
|
|
28
|
+
} | {
|
|
29
|
+
readonly [x: string]: unknown;
|
|
30
|
+
readonly id: string;
|
|
31
|
+
readonly type: "file_search_call";
|
|
32
|
+
readonly status?: string | undefined;
|
|
33
|
+
readonly queries?: readonly string[] | undefined;
|
|
34
|
+
readonly results?: readonly {
|
|
35
|
+
readonly [x: string]: unknown;
|
|
36
|
+
}[] | null | undefined;
|
|
37
|
+
} | {
|
|
38
|
+
readonly [x: string]: unknown;
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly type: "code_interpreter_call";
|
|
41
|
+
readonly status?: string | undefined;
|
|
42
|
+
readonly code?: string | null | undefined;
|
|
43
|
+
readonly container_id?: string | null | undefined;
|
|
44
|
+
readonly outputs?: readonly {
|
|
45
|
+
readonly [x: string]: unknown;
|
|
46
|
+
}[] | null | undefined;
|
|
47
|
+
} | {
|
|
48
|
+
readonly [x: string]: unknown;
|
|
49
|
+
readonly id: string;
|
|
50
|
+
readonly type: "mcp_call";
|
|
51
|
+
readonly status?: string | undefined;
|
|
52
|
+
readonly name?: string | undefined;
|
|
53
|
+
readonly output?: string | null | undefined;
|
|
54
|
+
readonly error?: unknown;
|
|
55
|
+
readonly arguments?: string | undefined;
|
|
56
|
+
readonly server_label?: string | undefined;
|
|
57
|
+
} | {
|
|
58
|
+
readonly type: "reasoning";
|
|
59
|
+
readonly summary: readonly {
|
|
60
|
+
readonly type: "summary_text";
|
|
61
|
+
readonly text: string;
|
|
62
|
+
}[];
|
|
63
|
+
readonly id?: string | undefined;
|
|
64
|
+
readonly encrypted_content?: string | null | undefined;
|
|
65
|
+
} | {
|
|
66
|
+
readonly type: "compaction";
|
|
67
|
+
readonly encrypted_content: string;
|
|
68
|
+
readonly id?: string | null | undefined;
|
|
69
|
+
} | {
|
|
70
|
+
readonly role: "system";
|
|
71
|
+
readonly content: string;
|
|
72
|
+
} | {
|
|
73
|
+
readonly role: "developer";
|
|
74
|
+
readonly content: string;
|
|
75
|
+
} | {
|
|
76
|
+
readonly content: readonly ({
|
|
77
|
+
readonly type: "input_image";
|
|
78
|
+
readonly image_url: string;
|
|
79
|
+
readonly detail?: string | undefined;
|
|
80
|
+
} | {
|
|
81
|
+
readonly type: "input_file";
|
|
82
|
+
readonly filename: string;
|
|
83
|
+
readonly detail?: string | undefined;
|
|
84
|
+
readonly file_data?: string | undefined;
|
|
85
|
+
readonly file_url?: string | undefined;
|
|
86
|
+
} | {
|
|
87
|
+
readonly type: "input_text";
|
|
88
|
+
readonly text: string;
|
|
89
|
+
})[];
|
|
90
|
+
readonly role: "user";
|
|
91
|
+
readonly id?: string | undefined;
|
|
92
|
+
readonly type?: "message" | undefined;
|
|
93
|
+
readonly status?: string | undefined;
|
|
94
|
+
} | {
|
|
95
|
+
readonly type: "message";
|
|
96
|
+
readonly content: readonly {
|
|
97
|
+
readonly type: "output_text";
|
|
98
|
+
readonly text: string;
|
|
99
|
+
}[];
|
|
100
|
+
readonly role: "assistant";
|
|
101
|
+
readonly id?: string | undefined;
|
|
102
|
+
readonly status?: string | undefined;
|
|
103
|
+
readonly phase?: "commentary" | "final_answer" | null | undefined;
|
|
104
|
+
} | {
|
|
105
|
+
readonly type: "function_call";
|
|
106
|
+
readonly name: string;
|
|
107
|
+
readonly arguments: string;
|
|
108
|
+
readonly call_id: string;
|
|
109
|
+
readonly id?: string | undefined;
|
|
110
|
+
readonly namespace?: string | undefined;
|
|
111
|
+
} | {
|
|
112
|
+
readonly type: "function_call_output";
|
|
113
|
+
readonly call_id: string;
|
|
114
|
+
readonly output: string | readonly ({
|
|
115
|
+
readonly type: "input_image";
|
|
116
|
+
readonly image_url: string;
|
|
117
|
+
readonly detail?: string | undefined;
|
|
118
|
+
} | {
|
|
119
|
+
readonly type: "input_file";
|
|
120
|
+
readonly filename: string;
|
|
121
|
+
readonly detail?: string | undefined;
|
|
122
|
+
readonly file_data?: string | undefined;
|
|
123
|
+
readonly file_url?: string | undefined;
|
|
124
|
+
} | {
|
|
125
|
+
readonly type: "input_text";
|
|
126
|
+
readonly text: string;
|
|
127
|
+
} | {
|
|
128
|
+
readonly type: "input_video";
|
|
129
|
+
readonly video_url: string;
|
|
130
|
+
})[];
|
|
131
|
+
})[];
|
|
132
|
+
readonly model: string;
|
|
133
|
+
readonly stream: true;
|
|
134
|
+
readonly metadata?: {
|
|
135
|
+
readonly [x: string]: string;
|
|
136
|
+
} | undefined;
|
|
137
|
+
readonly instructions?: string | undefined;
|
|
138
|
+
readonly reasoning?: {
|
|
139
|
+
readonly summary?: "auto" | "concise" | "detailed" | undefined;
|
|
140
|
+
readonly effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
141
|
+
} | undefined;
|
|
142
|
+
readonly tools?: readonly {
|
|
143
|
+
readonly type: "function";
|
|
144
|
+
readonly description: string;
|
|
145
|
+
readonly name: string;
|
|
146
|
+
readonly parameters: {
|
|
147
|
+
readonly [x: string]: unknown;
|
|
148
|
+
};
|
|
149
|
+
readonly strict?: boolean | undefined;
|
|
150
|
+
}[] | undefined;
|
|
151
|
+
readonly text?: {
|
|
152
|
+
readonly verbosity?: import("../protocols/utils/open-responses-options.js").TextVerbosity | undefined;
|
|
153
|
+
} | undefined;
|
|
154
|
+
readonly temperature?: number | undefined;
|
|
155
|
+
readonly service_tier?: import("../protocols/utils/open-responses-options.js").ServiceTier | undefined;
|
|
156
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
157
|
+
readonly type: "function";
|
|
158
|
+
readonly name: string;
|
|
159
|
+
} | {
|
|
160
|
+
readonly type: "allowed_tools";
|
|
161
|
+
readonly mode: "required" | "auto" | "none";
|
|
162
|
+
readonly tools: readonly {
|
|
163
|
+
readonly type: "function";
|
|
164
|
+
readonly name: string;
|
|
165
|
+
}[];
|
|
166
|
+
} | undefined;
|
|
167
|
+
readonly top_p?: number | undefined;
|
|
168
|
+
readonly frequency_penalty?: number | undefined;
|
|
169
|
+
readonly presence_penalty?: number | undefined;
|
|
170
|
+
readonly prompt_cache_key?: string | undefined;
|
|
171
|
+
readonly parallel_tool_calls?: boolean | undefined;
|
|
172
|
+
readonly store?: boolean | undefined;
|
|
173
|
+
readonly include?: readonly import("../protocols/utils/open-responses-options.js").ResponseIncludable[] | undefined;
|
|
174
|
+
readonly truncation?: "auto" | "disabled" | undefined;
|
|
175
|
+
readonly stream_options?: {
|
|
176
|
+
readonly include_obfuscation?: boolean | undefined;
|
|
177
|
+
} | undefined;
|
|
178
|
+
readonly safety_identifier?: string | undefined;
|
|
179
|
+
readonly top_logprobs?: number | undefined;
|
|
180
|
+
readonly max_output_tokens?: number | undefined;
|
|
181
|
+
readonly max_tool_calls?: number | undefined;
|
|
182
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
183
|
+
export declare const configure: (input: Config) => {
|
|
184
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
185
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
186
|
+
configure: (input: Config) => /*elided*/ any;
|
|
187
|
+
};
|
|
188
|
+
export declare const provider: {
|
|
189
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
190
|
+
configure: (input: Config) => {
|
|
191
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
192
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./open-responses-options.js").OpenResponsesOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
193
|
+
configure: /*elided*/ any;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
export declare const model: ProviderPackage.Definition<Settings, OpenResponsesProviderOptionsInput>["model"];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { OpenAICompatibleResponses } from "../protocols/openai-compatible-responses.js";
|
|
2
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
3
|
+
import { ProviderID } from "../schema/index.js";
|
|
4
|
+
export const id = ProviderID.make("openai-compatible");
|
|
5
|
+
export const routes = [OpenAICompatibleResponses.route];
|
|
6
|
+
export const configure = (input) => {
|
|
7
|
+
const provider = input.provider ?? "openai-compatible";
|
|
8
|
+
const { provider: _, baseURL, apiKey: _apiKey, auth: _auth, ...rest } = input;
|
|
9
|
+
const route = OpenAICompatibleResponses.route.with({
|
|
10
|
+
...rest,
|
|
11
|
+
provider,
|
|
12
|
+
endpoint: { baseURL },
|
|
13
|
+
auth: AuthOptions.bearer(input, []),
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
id: ProviderID.make(provider),
|
|
17
|
+
model: (modelID) => route.model({ id: modelID }),
|
|
18
|
+
configure,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const provider = {
|
|
22
|
+
id,
|
|
23
|
+
configure,
|
|
24
|
+
};
|
|
25
|
+
export const model = (modelID, settings) => configure({
|
|
26
|
+
apiKey: settings.apiKey,
|
|
27
|
+
baseURL: settings.baseURL,
|
|
28
|
+
headers: settings.headers === undefined ? undefined : { ...settings.headers },
|
|
29
|
+
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
30
|
+
provider: settings.provider,
|
|
31
|
+
providerOptions: settings.providerOptions,
|
|
32
|
+
}).model(modelID);
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { type ModelID } from "../schema/index.js";
|
|
2
|
+
import type { RouteDefaultsInput } from "../route/client.js";
|
|
3
|
+
import { type ProviderAuthOption } from "../route/auth-options.js";
|
|
4
|
+
import type { ProviderPackage } from "../provider-package.js";
|
|
5
|
+
import type { OpenAIProviderOptionsInput } from "./openai-options.js";
|
|
6
|
+
export declare const id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
7
|
+
type GenericModelOptions = Omit<RouteDefaultsInput, "providerOptions"> & ProviderAuthOption<"optional"> & {
|
|
8
|
+
readonly provider?: string;
|
|
9
|
+
readonly baseURL: string;
|
|
10
|
+
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
11
|
+
};
|
|
12
|
+
export interface Settings extends ProviderPackage.Settings {
|
|
13
|
+
readonly apiKey?: string;
|
|
14
|
+
readonly baseURL: string;
|
|
15
|
+
readonly provider?: string;
|
|
16
|
+
readonly providerOptions?: OpenAIProviderOptionsInput;
|
|
17
|
+
}
|
|
18
|
+
export declare const routes: import("../route/client.js").Route<{
|
|
19
|
+
readonly model: string;
|
|
20
|
+
readonly messages: readonly ({
|
|
21
|
+
readonly role: "system";
|
|
22
|
+
readonly content: string | readonly ({
|
|
23
|
+
readonly type: "text";
|
|
24
|
+
readonly text: string;
|
|
25
|
+
readonly cache_control?: {
|
|
26
|
+
readonly type: "ephemeral";
|
|
27
|
+
readonly ttl?: string | undefined;
|
|
28
|
+
} | undefined;
|
|
29
|
+
} | {
|
|
30
|
+
readonly type: "image_url";
|
|
31
|
+
readonly image_url: {
|
|
32
|
+
readonly url: string;
|
|
33
|
+
};
|
|
34
|
+
})[];
|
|
35
|
+
} | {
|
|
36
|
+
readonly role: "user";
|
|
37
|
+
readonly content: string | readonly ({
|
|
38
|
+
readonly type: "text";
|
|
39
|
+
readonly text: string;
|
|
40
|
+
readonly cache_control?: {
|
|
41
|
+
readonly type: "ephemeral";
|
|
42
|
+
readonly ttl?: string | undefined;
|
|
43
|
+
} | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "image_url";
|
|
46
|
+
readonly image_url: {
|
|
47
|
+
readonly url: string;
|
|
48
|
+
};
|
|
49
|
+
})[];
|
|
50
|
+
} | {
|
|
51
|
+
readonly [x: string]: unknown;
|
|
52
|
+
readonly content: string | null;
|
|
53
|
+
readonly role: "assistant";
|
|
54
|
+
readonly reasoning?: string | undefined;
|
|
55
|
+
readonly reasoning_content?: string | undefined;
|
|
56
|
+
readonly reasoning_text?: string | undefined;
|
|
57
|
+
readonly cache_control?: {
|
|
58
|
+
readonly type: "ephemeral";
|
|
59
|
+
readonly ttl?: string | undefined;
|
|
60
|
+
} | undefined;
|
|
61
|
+
readonly tool_calls?: readonly {
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly type: "function";
|
|
64
|
+
readonly function: {
|
|
65
|
+
readonly name: string;
|
|
66
|
+
readonly arguments: string;
|
|
67
|
+
};
|
|
68
|
+
}[] | undefined;
|
|
69
|
+
readonly reasoning_details?: unknown;
|
|
70
|
+
} | {
|
|
71
|
+
readonly content: string;
|
|
72
|
+
readonly role: "tool";
|
|
73
|
+
readonly tool_call_id: string;
|
|
74
|
+
readonly cache_control?: {
|
|
75
|
+
readonly type: "ephemeral";
|
|
76
|
+
readonly ttl?: string | undefined;
|
|
77
|
+
} | undefined;
|
|
78
|
+
})[];
|
|
79
|
+
readonly stream: true;
|
|
80
|
+
readonly max_completion_tokens?: number | undefined;
|
|
81
|
+
readonly max_tokens?: number | undefined;
|
|
82
|
+
readonly tools?: readonly {
|
|
83
|
+
readonly function: {
|
|
84
|
+
readonly description: string;
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly parameters: {
|
|
87
|
+
readonly [x: string]: unknown;
|
|
88
|
+
};
|
|
89
|
+
readonly strict?: boolean | undefined;
|
|
90
|
+
};
|
|
91
|
+
readonly type: "function";
|
|
92
|
+
readonly cache_control?: {
|
|
93
|
+
readonly type: "ephemeral";
|
|
94
|
+
readonly ttl?: string | undefined;
|
|
95
|
+
} | undefined;
|
|
96
|
+
}[] | undefined;
|
|
97
|
+
readonly stop?: readonly string[] | undefined;
|
|
98
|
+
readonly temperature?: number | undefined;
|
|
99
|
+
readonly seed?: number | undefined;
|
|
100
|
+
readonly tool_choice?: "required" | "auto" | "none" | {
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
readonly function: {
|
|
103
|
+
readonly name: string;
|
|
104
|
+
};
|
|
105
|
+
} | undefined;
|
|
106
|
+
readonly top_p?: number | undefined;
|
|
107
|
+
readonly frequency_penalty?: number | undefined;
|
|
108
|
+
readonly presence_penalty?: number | undefined;
|
|
109
|
+
readonly prompt_cache_key?: string | undefined;
|
|
110
|
+
readonly reasoning_effort?: import("../protocols/utils/open-responses-options.js").ReasoningEffort | undefined;
|
|
111
|
+
readonly store?: boolean | undefined;
|
|
112
|
+
readonly stream_options?: {
|
|
113
|
+
readonly include_usage: boolean;
|
|
114
|
+
} | undefined;
|
|
115
|
+
readonly tool_stream?: boolean | undefined;
|
|
116
|
+
}, import("../route/transport/http.js").HttpPrepared<string>, import("../route/client.js").CompactionOperations | undefined>[];
|
|
117
|
+
export declare const configure: (input: GenericModelOptions) => {
|
|
118
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
119
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
120
|
+
configure: (input: GenericModelOptions) => /*elided*/ any;
|
|
121
|
+
};
|
|
122
|
+
export declare const provider: {
|
|
123
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
124
|
+
configure: (input: GenericModelOptions) => {
|
|
125
|
+
id: string & import("effect/Brand").Brand<"AI.ProviderID">;
|
|
126
|
+
model: (modelID: string | ModelID) => import("../schema/options.js").LanguageModel<import("./openai-options.js").OpenAIOptionsInput, import("../route/client.js").CompactionOperations | undefined>;
|
|
127
|
+
configure: /*elided*/ any;
|
|
128
|
+
};
|
|
129
|
+
};
|
|
130
|
+
export declare const model: ProviderPackage.Definition<Settings, OpenAIProviderOptionsInput>["model"];
|
|
131
|
+
export * as OpenAICompatible from "./openai-compatible.js";
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { ProviderID } from "../schema/index.js";
|
|
2
|
+
import { OpenAICompatibleChat } from "../protocols/openai-compatible-chat.js";
|
|
3
|
+
import { AuthOptions } from "../route/auth-options.js";
|
|
4
|
+
export const id = ProviderID.make("openai-compatible");
|
|
5
|
+
export const routes = [OpenAICompatibleChat.route];
|
|
6
|
+
export const configure = (input) => {
|
|
7
|
+
const provider = input.provider ?? "openai-compatible";
|
|
8
|
+
const { provider: _, baseURL, apiKey: _apiKey, auth: _auth, ...rest } = input;
|
|
9
|
+
const route = OpenAICompatibleChat.route.with({
|
|
10
|
+
...rest,
|
|
11
|
+
provider,
|
|
12
|
+
endpoint: { baseURL },
|
|
13
|
+
auth: AuthOptions.bearer(input, []),
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
id: ProviderID.make(provider),
|
|
17
|
+
model: (modelID) => route.model({ id: modelID, provider: ProviderID.make(provider) }),
|
|
18
|
+
configure,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export const provider = {
|
|
22
|
+
id,
|
|
23
|
+
configure,
|
|
24
|
+
};
|
|
25
|
+
export const model = (modelID, settings) => configure({
|
|
26
|
+
apiKey: settings.apiKey,
|
|
27
|
+
baseURL: settings.baseURL,
|
|
28
|
+
headers: settings.headers === undefined ? undefined : { ...settings.headers },
|
|
29
|
+
http: settings.body === undefined ? undefined : { body: { ...settings.body } },
|
|
30
|
+
provider: settings.provider,
|
|
31
|
+
providerOptions: settings.providerOptions,
|
|
32
|
+
}).model(modelID);
|
|
33
|
+
export * as OpenAICompatible from "./openai-compatible.js";
|