@axemere/gateway 0.1.6 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +1 -1
- package/dist/client.js +0 -3
- package/dist/config.d.ts +4 -0
- package/dist/config.js +5 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export declare class AiGatewayClient {
|
|
|
32
32
|
* @param params - Request parameters: messages plus optional provider, model,
|
|
33
33
|
* attribution fields, delegation token, and provider-specific passthrough.
|
|
34
34
|
* @returns The completed response, or a stream of chunks when `stream: true`.
|
|
35
|
-
* @throws {GatewayError} On missing config (
|
|
35
|
+
* @throws {GatewayError} On missing config (provider/model),
|
|
36
36
|
* network failure, or non-OK gateway/provider status.
|
|
37
37
|
* @throws {PolicyDeniedError} When the gateway denies the request by policy.
|
|
38
38
|
* @throws {QuotaExceededError} When a spend/quota limit is exceeded (HTTP 429).
|
package/dist/client.js
CHANGED
|
@@ -27,9 +27,6 @@ class AiGatewayClient {
|
|
|
27
27
|
this.config = config;
|
|
28
28
|
}
|
|
29
29
|
async execute(params) {
|
|
30
|
-
if (!this.config.gateway_url) {
|
|
31
|
-
throw new errors_1.GatewayError("gateway_url is required; set AXEMERE_GATEWAY_URL or pass it to AiGatewayConfig");
|
|
32
|
-
}
|
|
33
30
|
const provider = params.provider ?? this.config.default_provider;
|
|
34
31
|
const model = params.model ?? this.config.default_model;
|
|
35
32
|
if (!provider) {
|
package/dist/config.d.ts
CHANGED
|
@@ -19,6 +19,10 @@ export interface AiGatewayOptions {
|
|
|
19
19
|
* safe default. Values are read once at construction time. Also builds the
|
|
20
20
|
* proxy base URL used by the OpenAI/Anthropic drop-in wrappers.
|
|
21
21
|
*
|
|
22
|
+
* `gateway_url` defaults to `"http://localhost:7080"` when neither the option
|
|
23
|
+
* nor `AXEMERE_GATEWAY_URL` is set, matching the Python SDK behaviour so local
|
|
24
|
+
* development works without any `.env` configuration.
|
|
25
|
+
*
|
|
22
26
|
* @example
|
|
23
27
|
* ```ts
|
|
24
28
|
* // From env (AXEMERE_GATEWAY_URL, AXEMERE_GATEWAY_TOKEN, ...)
|
package/dist/config.js
CHANGED
|
@@ -25,6 +25,10 @@ function parseLabelsEnv(raw) {
|
|
|
25
25
|
* safe default. Values are read once at construction time. Also builds the
|
|
26
26
|
* proxy base URL used by the OpenAI/Anthropic drop-in wrappers.
|
|
27
27
|
*
|
|
28
|
+
* `gateway_url` defaults to `"http://localhost:7080"` when neither the option
|
|
29
|
+
* nor `AXEMERE_GATEWAY_URL` is set, matching the Python SDK behaviour so local
|
|
30
|
+
* development works without any `.env` configuration.
|
|
31
|
+
*
|
|
28
32
|
* @example
|
|
29
33
|
* ```ts
|
|
30
34
|
* // From env (AXEMERE_GATEWAY_URL, AXEMERE_GATEWAY_TOKEN, ...)
|
|
@@ -37,7 +41,7 @@ class AiGatewayConfig {
|
|
|
37
41
|
constructor(opts = {}) {
|
|
38
42
|
// Constructor args take precedence over env vars (read at construction time).
|
|
39
43
|
this.gateway_url =
|
|
40
|
-
opts.gateway_url ?? process.env["AXEMERE_GATEWAY_URL"] ?? "";
|
|
44
|
+
opts.gateway_url ?? process.env["AXEMERE_GATEWAY_URL"] ?? "http://localhost:7080";
|
|
41
45
|
this.gateway_token =
|
|
42
46
|
opts.gateway_token ?? process.env["AXEMERE_GATEWAY_TOKEN"] ?? "";
|
|
43
47
|
this.default_provider =
|