@smarter.sh/api 0.0.0-stage → 1.0.2-alpha.1
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/LICENSE.txt +671 -0
- package/README.md +193 -2
- package/dist/client.d.ts +146 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +178 -0
- package/dist/client.js.map +1 -0
- package/dist/core/config.d.ts +148 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +212 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/errors.d.ts +189 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +187 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/http.d.ts +207 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/http.js +456 -0
- package/dist/core/http.js.map +1 -0
- package/dist/core/log.d.ts +62 -0
- package/dist/core/log.d.ts.map +1 -0
- package/dist/core/log.js +68 -0
- package/dist/core/log.js.map +1 -0
- package/dist/core/sse.d.ts +38 -0
- package/dist/core/sse.d.ts.map +1 -0
- package/dist/core/sse.js +79 -0
- package/dist/core/sse.js.map +1 -0
- package/dist/core/typing.d.ts +21 -0
- package/dist/core/typing.d.ts.map +1 -0
- package/dist/core/typing.js +13 -0
- package/dist/core/typing.js.map +1 -0
- package/dist/index.d.ts +51 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/index.js.map +1 -0
- package/dist/models/account.d.ts +112 -0
- package/dist/models/account.d.ts.map +1 -0
- package/dist/models/account.js +55 -0
- package/dist/models/account.js.map +1 -0
- package/dist/models/base.d.ts +99 -0
- package/dist/models/base.d.ts.map +1 -0
- package/dist/models/base.js +111 -0
- package/dist/models/base.js.map +1 -0
- package/dist/models/chat.d.ts +2243 -0
- package/dist/models/chat.d.ts.map +1 -0
- package/dist/models/chat.js +451 -0
- package/dist/models/chat.js.map +1 -0
- package/dist/models/guardrail.d.ts +109 -0
- package/dist/models/guardrail.d.ts.map +1 -0
- package/dist/models/guardrail.js +68 -0
- package/dist/models/guardrail.js.map +1 -0
- package/dist/models/journal.d.ts +159 -0
- package/dist/models/journal.d.ts.map +1 -0
- package/dist/models/journal.js +115 -0
- package/dist/models/journal.js.map +1 -0
- package/dist/models/llmclient.d.ts +183 -0
- package/dist/models/llmclient.d.ts.map +1 -0
- package/dist/models/llmclient.js +105 -0
- package/dist/models/llmclient.js.map +1 -0
- package/dist/models/llmhost.d.ts +121 -0
- package/dist/models/llmhost.d.ts.map +1 -0
- package/dist/models/llmhost.js +79 -0
- package/dist/models/llmhost.js.map +1 -0
- package/dist/models/manifest.d.ts +211 -0
- package/dist/models/manifest.d.ts.map +1 -0
- package/dist/models/manifest.js +290 -0
- package/dist/models/manifest.js.map +1 -0
- package/dist/models/mcpclient.d.ts +99 -0
- package/dist/models/mcpclient.d.ts.map +1 -0
- package/dist/models/mcpclient.js +65 -0
- package/dist/models/mcpclient.js.map +1 -0
- package/dist/models/misc.d.ts +232 -0
- package/dist/models/misc.d.ts.map +1 -0
- package/dist/models/misc.js +110 -0
- package/dist/models/misc.js.map +1 -0
- package/dist/models/platform.d.ts +88 -0
- package/dist/models/platform.d.ts.map +1 -0
- package/dist/models/platform.js +35 -0
- package/dist/models/platform.js.map +1 -0
- package/dist/models/plugin.d.ts +36 -0
- package/dist/models/plugin.d.ts.map +1 -0
- package/dist/models/plugin.js +16 -0
- package/dist/models/plugin.js.map +1 -0
- package/dist/models/react.d.ts +104 -0
- package/dist/models/react.d.ts.map +1 -0
- package/dist/models/react.js +136 -0
- package/dist/models/react.js.map +1 -0
- package/dist/models/sam/account.d.ts +155 -0
- package/dist/models/sam/account.d.ts.map +1 -0
- package/dist/models/sam/account.js +7 -0
- package/dist/models/sam/account.js.map +1 -0
- package/dist/models/sam/apiconnection.d.ts +147 -0
- package/dist/models/sam/apiconnection.d.ts.map +1 -0
- package/dist/models/sam/apiconnection.js +7 -0
- package/dist/models/sam/apiconnection.js.map +1 -0
- package/dist/models/sam/apiplugin.d.ts +278 -0
- package/dist/models/sam/apiplugin.d.ts.map +1 -0
- package/dist/models/sam/apiplugin.js +7 -0
- package/dist/models/sam/apiplugin.js.map +1 -0
- package/dist/models/sam/budget.d.ts +219 -0
- package/dist/models/sam/budget.d.ts.map +1 -0
- package/dist/models/sam/budget.js +7 -0
- package/dist/models/sam/budget.js.map +1 -0
- package/dist/models/sam/customdomain.d.ts +139 -0
- package/dist/models/sam/customdomain.d.ts.map +1 -0
- package/dist/models/sam/customdomain.js +7 -0
- package/dist/models/sam/customdomain.js.map +1 -0
- package/dist/models/sam/guardrail.d.ts +222 -0
- package/dist/models/sam/guardrail.d.ts.map +1 -0
- package/dist/models/sam/guardrail.js +7 -0
- package/dist/models/sam/guardrail.js.map +1 -0
- package/dist/models/sam/imagesearchplugin.d.ts +235 -0
- package/dist/models/sam/imagesearchplugin.d.ts.map +1 -0
- package/dist/models/sam/imagesearchplugin.js +7 -0
- package/dist/models/sam/imagesearchplugin.js.map +1 -0
- package/dist/models/sam/index.d.ts +104 -0
- package/dist/models/sam/index.d.ts.map +1 -0
- package/dist/models/sam/index.js +50 -0
- package/dist/models/sam/index.js.map +1 -0
- package/dist/models/sam/llmclient.d.ts +490 -0
- package/dist/models/sam/llmclient.d.ts.map +1 -0
- package/dist/models/sam/llmclient.js +7 -0
- package/dist/models/sam/llmclient.js.map +1 -0
- package/dist/models/sam/llmhost.d.ts +429 -0
- package/dist/models/sam/llmhost.d.ts.map +1 -0
- package/dist/models/sam/llmhost.js +7 -0
- package/dist/models/sam/llmhost.js.map +1 -0
- package/dist/models/sam/llmhostcompute.d.ts +221 -0
- package/dist/models/sam/llmhostcompute.d.ts.map +1 -0
- package/dist/models/sam/llmhostcompute.js +7 -0
- package/dist/models/sam/llmhostcompute.js.map +1 -0
- package/dist/models/sam/mcpclient.d.ts +195 -0
- package/dist/models/sam/mcpclient.d.ts.map +1 -0
- package/dist/models/sam/mcpclient.js +7 -0
- package/dist/models/sam/mcpclient.js.map +1 -0
- package/dist/models/sam/orchestrator.d.ts +163 -0
- package/dist/models/sam/orchestrator.d.ts.map +1 -0
- package/dist/models/sam/orchestrator.js +7 -0
- package/dist/models/sam/orchestrator.js.map +1 -0
- package/dist/models/sam/plugin.d.ts +163 -0
- package/dist/models/sam/plugin.d.ts.map +1 -0
- package/dist/models/sam/plugin.js +7 -0
- package/dist/models/sam/plugin.js.map +1 -0
- package/dist/models/sam/prompt.d.ts +116 -0
- package/dist/models/sam/prompt.d.ts.map +1 -0
- package/dist/models/sam/prompt.js +7 -0
- package/dist/models/sam/prompt.js.map +1 -0
- package/dist/models/sam/provider.d.ts +195 -0
- package/dist/models/sam/provider.d.ts.map +1 -0
- package/dist/models/sam/provider.js +7 -0
- package/dist/models/sam/provider.js.map +1 -0
- package/dist/models/sam/proxy.d.ts +163 -0
- package/dist/models/sam/proxy.d.ts.map +1 -0
- package/dist/models/sam/proxy.js +7 -0
- package/dist/models/sam/proxy.js.map +1 -0
- package/dist/models/sam/schemas.d.ts +8 -0
- package/dist/models/sam/schemas.d.ts.map +1 -0
- package/dist/models/sam/schemas.js +6059 -0
- package/dist/models/sam/schemas.js.map +1 -0
- package/dist/models/sam/secret.d.ts +123 -0
- package/dist/models/sam/secret.d.ts.map +1 -0
- package/dist/models/sam/secret.js +7 -0
- package/dist/models/sam/secret.js.map +1 -0
- package/dist/models/sam/skillplugin.d.ts +181 -0
- package/dist/models/sam/skillplugin.d.ts.map +1 -0
- package/dist/models/sam/skillplugin.js +7 -0
- package/dist/models/sam/skillplugin.js.map +1 -0
- package/dist/models/sam/smarterauthtoken.d.ts +115 -0
- package/dist/models/sam/smarterauthtoken.d.ts.map +1 -0
- package/dist/models/sam/smarterauthtoken.js +7 -0
- package/dist/models/sam/smarterauthtoken.js.map +1 -0
- package/dist/models/sam/sqlconnection.d.ts +187 -0
- package/dist/models/sam/sqlconnection.d.ts.map +1 -0
- package/dist/models/sam/sqlconnection.js +7 -0
- package/dist/models/sam/sqlconnection.js.map +1 -0
- package/dist/models/sam/sqlplugin.d.ts +232 -0
- package/dist/models/sam/sqlplugin.d.ts.map +1 -0
- package/dist/models/sam/sqlplugin.js +7 -0
- package/dist/models/sam/sqlplugin.js.map +1 -0
- package/dist/models/sam/user.d.ts +135 -0
- package/dist/models/sam/user.d.ts.map +1 -0
- package/dist/models/sam/user.js +7 -0
- package/dist/models/sam/user.js.map +1 -0
- package/dist/models/sam/vectorsearch.d.ts +150 -0
- package/dist/models/sam/vectorsearch.d.ts.map +1 -0
- package/dist/models/sam/vectorsearch.js +7 -0
- package/dist/models/sam/vectorsearch.js.map +1 -0
- package/dist/models/sam/vectorstore.d.ts +291 -0
- package/dist/models/sam/vectorstore.d.ts.map +1 -0
- package/dist/models/sam/vectorstore.js +7 -0
- package/dist/models/sam/vectorstore.js.map +1 -0
- package/dist/models/sam/websearchplugin.d.ts +229 -0
- package/dist/models/sam/websearchplugin.d.ts.map +1 -0
- package/dist/models/sam/websearchplugin.js +7 -0
- package/dist/models/sam/websearchplugin.js.map +1 -0
- package/dist/models/vectorstore.d.ts +165 -0
- package/dist/models/vectorstore.d.ts.map +1 -0
- package/dist/models/vectorstore.js +90 -0
- package/dist/models/vectorstore.js.map +1 -0
- package/dist/resources/accounts.d.ts +107 -0
- package/dist/resources/accounts.d.ts.map +1 -0
- package/dist/resources/accounts.js +84 -0
- package/dist/resources/accounts.js.map +1 -0
- package/dist/resources/base.d.ts +127 -0
- package/dist/resources/base.d.ts.map +1 -0
- package/dist/resources/base.js +139 -0
- package/dist/resources/base.js.map +1 -0
- package/dist/resources/catalog.d.ts +209 -0
- package/dist/resources/catalog.d.ts.map +1 -0
- package/dist/resources/catalog.js +124 -0
- package/dist/resources/catalog.js.map +1 -0
- package/dist/resources/guardrails.d.ts +82 -0
- package/dist/resources/guardrails.d.ts.map +1 -0
- package/dist/resources/guardrails.js +46 -0
- package/dist/resources/guardrails.js.map +1 -0
- package/dist/resources/history.d.ts +97 -0
- package/dist/resources/history.d.ts.map +1 -0
- package/dist/resources/history.js +109 -0
- package/dist/resources/history.js.map +1 -0
- package/dist/resources/llmclients.d.ts +348 -0
- package/dist/resources/llmclients.d.ts.map +1 -0
- package/dist/resources/llmclients.js +367 -0
- package/dist/resources/llmclients.js.map +1 -0
- package/dist/resources/llmhosts.d.ts +146 -0
- package/dist/resources/llmhosts.d.ts.map +1 -0
- package/dist/resources/llmhosts.js +128 -0
- package/dist/resources/llmhosts.js.map +1 -0
- package/dist/resources/manifests.d.ts +153 -0
- package/dist/resources/manifests.d.ts.map +1 -0
- package/dist/resources/manifests.js +203 -0
- package/dist/resources/manifests.js.map +1 -0
- package/dist/resources/mcpclients.d.ts +90 -0
- package/dist/resources/mcpclients.d.ts.map +1 -0
- package/dist/resources/mcpclients.js +57 -0
- package/dist/resources/mcpclients.js.map +1 -0
- package/dist/resources/providers.d.ts +33 -0
- package/dist/resources/providers.d.ts.map +1 -0
- package/dist/resources/providers.js +39 -0
- package/dist/resources/providers.js.map +1 -0
- package/dist/resources/proxies.d.ts +61 -0
- package/dist/resources/proxies.d.ts.map +1 -0
- package/dist/resources/proxies.js +57 -0
- package/dist/resources/proxies.js.map +1 -0
- package/dist/resources/vectorstores.d.ts +194 -0
- package/dist/resources/vectorstores.d.ts.map +1 -0
- package/dist/resources/vectorstores.js +200 -0
- package/dist/resources/vectorstores.js.map +1 -0
- package/dist/version.d.ts +3 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/package.json +81 -4
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The configuration of the Smarter SDK.
|
|
3
|
+
*
|
|
4
|
+
* A client needs an api key and the base url of a Smarter platform. Each is taken from the first of
|
|
5
|
+
* these that sets it:
|
|
6
|
+
*
|
|
7
|
+
* 1. the options of `new Smarter({...})`,
|
|
8
|
+
* 2. environment variables: `SMARTER_API_KEY`, `SMARTER_BASE_URL`, `SMARTER_ENVIRONMENT`,
|
|
9
|
+
* `SMARTER_ROOT_DOMAIN`, `SMARTER_TIMEOUT`, `SMARTER_MAX_RETRIES` and `SMARTER_LOG`,
|
|
10
|
+
* 3. the `smarter` cli's configuration file, `~/.smarter/config.yaml` (`SMARTER_CONFIG_FILE`), so
|
|
11
|
+
* that a developer who has run `smarter configure` needs no other setup,
|
|
12
|
+
* 4. the defaults: the `prod` environment of `platform.smarter.sh`.
|
|
13
|
+
*
|
|
14
|
+
* Without an explicit base url, the url is derived from the environment as the cli derives it:
|
|
15
|
+
* `local` is `http://localhost:9357`, `alpha`, `beta` and `next` are
|
|
16
|
+
* `https://<environment>.<root domain>`, and `prod` is `https://<root domain>`.
|
|
17
|
+
*
|
|
18
|
+
* This is the Python SDK's lookup, which follows the Smarter platform's settings design (ADR-007):
|
|
19
|
+
* this module is the only one that reads the environment.
|
|
20
|
+
*/
|
|
21
|
+
import type { Logger, SmarterLogLevel } from "./log.ts";
|
|
22
|
+
/** The environments of the smarter cli's configuration file. */
|
|
23
|
+
export type SmarterEnvironment = "local" | "alpha" | "beta" | "next" | "prod";
|
|
24
|
+
/** Every {@link SmarterEnvironment}. */
|
|
25
|
+
export declare const ENVIRONMENTS: readonly SmarterEnvironment[];
|
|
26
|
+
/** The environment when none is configured. */
|
|
27
|
+
export declare const DEFAULT_ENVIRONMENT: SmarterEnvironment;
|
|
28
|
+
/** The platform's root domain when none is configured. */
|
|
29
|
+
export declare const DEFAULT_ROOT_DOMAIN = "platform.smarter.sh";
|
|
30
|
+
/** The url of the Smarter platform's local development server. */
|
|
31
|
+
export declare const LOCAL_URL = "http://localhost:9357";
|
|
32
|
+
/** The path of the Smarter api, which every request url is relative to. */
|
|
33
|
+
export declare const API_PATH = "/api/v1/";
|
|
34
|
+
/** The request timeout, in seconds. Prompts that call several tools can take tens of seconds. */
|
|
35
|
+
export declare const DEFAULT_TIMEOUT = 60;
|
|
36
|
+
/** How many times a failed request is retried. */
|
|
37
|
+
export declare const DEFAULT_MAX_RETRIES = 2;
|
|
38
|
+
/**
|
|
39
|
+
* The smarter cli's configuration file.
|
|
40
|
+
*
|
|
41
|
+
* @returns `~/.smarter/config.yaml`.
|
|
42
|
+
*/
|
|
43
|
+
export declare function defaultConfigFile(): string;
|
|
44
|
+
/** The SDK's settings, from `SMARTER_*` environment variables. */
|
|
45
|
+
export interface SmarterSettings {
|
|
46
|
+
/** A Smarter api key: 64 characters. */
|
|
47
|
+
apiKey?: string | undefined;
|
|
48
|
+
/** e.g. `https://platform.example.com` or `http://localhost:9357`. */
|
|
49
|
+
baseUrl?: string | undefined;
|
|
50
|
+
/** The environment of the cli's configuration file. */
|
|
51
|
+
environment?: SmarterEnvironment | undefined;
|
|
52
|
+
/** The platform's root domain, e.g. `platform.smarter.sh`. */
|
|
53
|
+
rootDomain?: string | undefined;
|
|
54
|
+
/** The request timeout, in seconds. */
|
|
55
|
+
timeout: number;
|
|
56
|
+
/** How many times a failed request is retried. */
|
|
57
|
+
maxRetries: number;
|
|
58
|
+
/** The path of the cli's configuration file. */
|
|
59
|
+
configFile: string;
|
|
60
|
+
/** Log the SDK's requests. */
|
|
61
|
+
log?: SmarterLogLevel | undefined;
|
|
62
|
+
}
|
|
63
|
+
/** The options of a client that its configuration is resolved from. */
|
|
64
|
+
export interface ConfigOptions {
|
|
65
|
+
/** A Smarter api key. */
|
|
66
|
+
apiKey?: string | undefined;
|
|
67
|
+
/** The platform's url, e.g. `https://platform.example.com` or `http://localhost:9357`. */
|
|
68
|
+
baseUrl?: string | undefined;
|
|
69
|
+
/** The environment of the smarter cli's configuration file to use. */
|
|
70
|
+
environment?: SmarterEnvironment | undefined;
|
|
71
|
+
/** The request timeout, in seconds. */
|
|
72
|
+
timeout?: number | undefined;
|
|
73
|
+
/** How many times to retry a request that failed for a transient reason. 0 disables retries. */
|
|
74
|
+
maxRetries?: number | undefined;
|
|
75
|
+
}
|
|
76
|
+
/** The parts of the smarter cli's `~/.smarter/config.yaml` that the SDK reads. */
|
|
77
|
+
export interface CliConfig {
|
|
78
|
+
/** `config.environment`. */
|
|
79
|
+
environment?: SmarterEnvironment | undefined;
|
|
80
|
+
/** `config.root_domain`. */
|
|
81
|
+
rootDomain?: string | undefined;
|
|
82
|
+
/** The top-level `api_key`, used by any environment. */
|
|
83
|
+
apiKey?: string | undefined;
|
|
84
|
+
/** The api key of each environment: `<environment>.api_key`. */
|
|
85
|
+
apiKeys: Record<string, string>;
|
|
86
|
+
}
|
|
87
|
+
/** A client's resolved configuration. */
|
|
88
|
+
export interface ClientConfig {
|
|
89
|
+
/** The api key. */
|
|
90
|
+
readonly apiKey: string;
|
|
91
|
+
/** The api's base url, ending in `/api/v1/`. */
|
|
92
|
+
readonly baseUrl: string;
|
|
93
|
+
/** The environment. */
|
|
94
|
+
readonly environment: SmarterEnvironment;
|
|
95
|
+
/** The request timeout, in seconds. */
|
|
96
|
+
readonly timeout: number;
|
|
97
|
+
/** How many times a failed request is retried. */
|
|
98
|
+
readonly maxRetries: number;
|
|
99
|
+
}
|
|
100
|
+
type Environment = Record<string, string | undefined>;
|
|
101
|
+
/**
|
|
102
|
+
* Read the SDK's settings from the environment.
|
|
103
|
+
*
|
|
104
|
+
* @param env - The environment, `process.env` by default.
|
|
105
|
+
* @returns The settings.
|
|
106
|
+
* @throws {@link SmarterConfigurationError} If a variable's value is invalid.
|
|
107
|
+
*/
|
|
108
|
+
export declare function readSettings(env?: Environment): SmarterSettings;
|
|
109
|
+
/**
|
|
110
|
+
* Read the cli's configuration file.
|
|
111
|
+
*
|
|
112
|
+
* A missing, unreadable or invalid file is an empty configuration: the file is optional.
|
|
113
|
+
*
|
|
114
|
+
* @param path - The file's path.
|
|
115
|
+
* @param logger - Where to log why a file was ignored.
|
|
116
|
+
* @returns The configuration.
|
|
117
|
+
*/
|
|
118
|
+
export declare function loadCliConfig(path: string, logger?: Logger): CliConfig;
|
|
119
|
+
/**
|
|
120
|
+
* The platform url of an environment, as the smarter cli derives it.
|
|
121
|
+
*
|
|
122
|
+
* @param environment - The environment.
|
|
123
|
+
* @param rootDomain - The platform's root domain, e.g. `platform.smarter.sh`.
|
|
124
|
+
* @returns e.g. `https://alpha.platform.smarter.sh`.
|
|
125
|
+
*/
|
|
126
|
+
export declare function environmentUrl(environment: SmarterEnvironment, rootDomain: string): string;
|
|
127
|
+
/**
|
|
128
|
+
* The api's base url for a platform url.
|
|
129
|
+
*
|
|
130
|
+
* `https://example.com` and `https://example.com/api/v1` both become `https://example.com/api/v1/`.
|
|
131
|
+
*
|
|
132
|
+
* @param url - A platform url, with or without the api's path.
|
|
133
|
+
* @returns The url, with the api's path and a trailing slash.
|
|
134
|
+
* @throws {@link SmarterConfigurationError} If the url is not an http or https url.
|
|
135
|
+
*/
|
|
136
|
+
export declare function apiBaseUrl(url: string): string;
|
|
137
|
+
/**
|
|
138
|
+
* Resolve a client's configuration from its options, the environment, and the cli's configuration file.
|
|
139
|
+
*
|
|
140
|
+
* @param options - The client's options.
|
|
141
|
+
* @param settings - The settings to use instead of reading the environment variables, for tests.
|
|
142
|
+
* @param logger - Where to log why the cli's file was ignored.
|
|
143
|
+
* @returns The configuration.
|
|
144
|
+
* @throws {@link SmarterConfigurationError} If no api key is found, or a value is invalid.
|
|
145
|
+
*/
|
|
146
|
+
export declare function resolveClientConfig(options?: ConfigOptions, settings?: SmarterSettings, logger?: Logger): ClientConfig;
|
|
147
|
+
export {};
|
|
148
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AASH,OAAO,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAExD,gEAAgE;AAChE,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAE9E,wCAAwC;AACxC,eAAO,MAAM,YAAY,EAAE,SAAS,kBAAkB,EAA+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E,eAAgC,EAC1C,MAAM,CAAC,EAAE,MAAM,GACd,YAAY,CA8Bd"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The configuration of the Smarter SDK.
|
|
3
|
+
*
|
|
4
|
+
* A client needs an api key and the base url of a Smarter platform. Each is taken from the first of
|
|
5
|
+
* these that sets it:
|
|
6
|
+
*
|
|
7
|
+
* 1. the options of `new Smarter({...})`,
|
|
8
|
+
* 2. environment variables: `SMARTER_API_KEY`, `SMARTER_BASE_URL`, `SMARTER_ENVIRONMENT`,
|
|
9
|
+
* `SMARTER_ROOT_DOMAIN`, `SMARTER_TIMEOUT`, `SMARTER_MAX_RETRIES` and `SMARTER_LOG`,
|
|
10
|
+
* 3. the `smarter` cli's configuration file, `~/.smarter/config.yaml` (`SMARTER_CONFIG_FILE`), so
|
|
11
|
+
* that a developer who has run `smarter configure` needs no other setup,
|
|
12
|
+
* 4. the defaults: the `prod` environment of `platform.smarter.sh`.
|
|
13
|
+
*
|
|
14
|
+
* Without an explicit base url, the url is derived from the environment as the cli derives it:
|
|
15
|
+
* `local` is `http://localhost:9357`, `alpha`, `beta` and `next` are
|
|
16
|
+
* `https://<environment>.<root domain>`, and `prod` is `https://<root domain>`.
|
|
17
|
+
*
|
|
18
|
+
* This is the Python SDK's lookup, which follows the Smarter platform's settings design (ADR-007):
|
|
19
|
+
* this module is the only one that reads the environment.
|
|
20
|
+
*/
|
|
21
|
+
import { readFileSync } from "node:fs";
|
|
22
|
+
import { homedir } from "node:os";
|
|
23
|
+
import { join } from "node:path";
|
|
24
|
+
import { parse as parseYaml } from "yaml";
|
|
25
|
+
import { SmarterConfigurationError } from "./errors.js";
|
|
26
|
+
/** Every {@link SmarterEnvironment}. */
|
|
27
|
+
export const ENVIRONMENTS = ["local", "alpha", "beta", "next", "prod"];
|
|
28
|
+
/** The environment when none is configured. */
|
|
29
|
+
export const DEFAULT_ENVIRONMENT = "prod";
|
|
30
|
+
/** The platform's root domain when none is configured. */
|
|
31
|
+
export const DEFAULT_ROOT_DOMAIN = "platform.smarter.sh";
|
|
32
|
+
/** The url of the Smarter platform's local development server. */
|
|
33
|
+
export const LOCAL_URL = "http://localhost:9357";
|
|
34
|
+
/** The path of the Smarter api, which every request url is relative to. */
|
|
35
|
+
export const API_PATH = "/api/v1/";
|
|
36
|
+
/** The request timeout, in seconds. Prompts that call several tools can take tens of seconds. */
|
|
37
|
+
export const DEFAULT_TIMEOUT = 60;
|
|
38
|
+
/** How many times a failed request is retried. */
|
|
39
|
+
export const DEFAULT_MAX_RETRIES = 2;
|
|
40
|
+
/**
|
|
41
|
+
* The smarter cli's configuration file.
|
|
42
|
+
*
|
|
43
|
+
* @returns `~/.smarter/config.yaml`.
|
|
44
|
+
*/
|
|
45
|
+
export function defaultConfigFile() {
|
|
46
|
+
return join(homedir(), ".smarter", "config.yaml");
|
|
47
|
+
}
|
|
48
|
+
function nonEmpty(value) {
|
|
49
|
+
return value === undefined || value.trim() === "" ? undefined : value.trim();
|
|
50
|
+
}
|
|
51
|
+
function parseEnvironment(value, source) {
|
|
52
|
+
if (value === undefined)
|
|
53
|
+
return undefined;
|
|
54
|
+
if (ENVIRONMENTS.includes(value))
|
|
55
|
+
return value;
|
|
56
|
+
throw new SmarterConfigurationError(`${source} must be one of ${ENVIRONMENTS.join(", ")}, not ${JSON.stringify(value)}.`);
|
|
57
|
+
}
|
|
58
|
+
function parseNumber(value, name, integer, fallback) {
|
|
59
|
+
if (value === undefined)
|
|
60
|
+
return fallback;
|
|
61
|
+
const number = Number(value);
|
|
62
|
+
const valid = Number.isFinite(number) && (integer ? Number.isInteger(number) && number >= 0 : number > 0);
|
|
63
|
+
if (!valid) {
|
|
64
|
+
const expected = integer ? "a whole number, 0 or more" : "a number of seconds, more than 0";
|
|
65
|
+
throw new SmarterConfigurationError(`${name} must be ${expected}, not ${JSON.stringify(value)}.`);
|
|
66
|
+
}
|
|
67
|
+
return number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Read the SDK's settings from the environment.
|
|
71
|
+
*
|
|
72
|
+
* @param env - The environment, `process.env` by default.
|
|
73
|
+
* @returns The settings.
|
|
74
|
+
* @throws {@link SmarterConfigurationError} If a variable's value is invalid.
|
|
75
|
+
*/
|
|
76
|
+
export function readSettings(env = process.env) {
|
|
77
|
+
const log = nonEmpty(env["SMARTER_LOG"]);
|
|
78
|
+
if (log !== undefined && !["debug", "info", "warn", "error", "off"].includes(log)) {
|
|
79
|
+
throw new SmarterConfigurationError(`SMARTER_LOG must be debug, info, warn, error or off, not ${JSON.stringify(log)}.`);
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
apiKey: nonEmpty(env["SMARTER_API_KEY"]),
|
|
83
|
+
baseUrl: nonEmpty(env["SMARTER_BASE_URL"]),
|
|
84
|
+
environment: parseEnvironment(nonEmpty(env["SMARTER_ENVIRONMENT"]), "SMARTER_ENVIRONMENT"),
|
|
85
|
+
rootDomain: nonEmpty(env["SMARTER_ROOT_DOMAIN"]),
|
|
86
|
+
timeout: parseNumber(nonEmpty(env["SMARTER_TIMEOUT"]), "SMARTER_TIMEOUT", false, DEFAULT_TIMEOUT),
|
|
87
|
+
maxRetries: parseNumber(nonEmpty(env["SMARTER_MAX_RETRIES"]), "SMARTER_MAX_RETRIES", true, DEFAULT_MAX_RETRIES),
|
|
88
|
+
configFile: nonEmpty(env["SMARTER_CONFIG_FILE"]) ?? defaultConfigFile(),
|
|
89
|
+
log: log,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function isRecord(value) {
|
|
93
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
94
|
+
}
|
|
95
|
+
function stringOf(value) {
|
|
96
|
+
return typeof value === "string" && value !== "" ? value : undefined;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Read the cli's configuration file.
|
|
100
|
+
*
|
|
101
|
+
* A missing, unreadable or invalid file is an empty configuration: the file is optional.
|
|
102
|
+
*
|
|
103
|
+
* @param path - The file's path.
|
|
104
|
+
* @param logger - Where to log why a file was ignored.
|
|
105
|
+
* @returns The configuration.
|
|
106
|
+
*/
|
|
107
|
+
export function loadCliConfig(path, logger) {
|
|
108
|
+
let document;
|
|
109
|
+
try {
|
|
110
|
+
document = parseYaml(readFileSync(path, "utf-8"));
|
|
111
|
+
}
|
|
112
|
+
catch (err) {
|
|
113
|
+
logger?.log("debug", "config", `smarter cli configuration ${path} not read: ${String(err)}`);
|
|
114
|
+
return { apiKeys: {} };
|
|
115
|
+
}
|
|
116
|
+
if (!isRecord(document))
|
|
117
|
+
return { apiKeys: {} };
|
|
118
|
+
const config = isRecord(document["config"]) ? document["config"] : {};
|
|
119
|
+
const apiKeys = {};
|
|
120
|
+
for (const [name, section] of Object.entries(document)) {
|
|
121
|
+
const key = isRecord(section) ? stringOf(section["api_key"]) : undefined;
|
|
122
|
+
if (key !== undefined)
|
|
123
|
+
apiKeys[name] = key;
|
|
124
|
+
}
|
|
125
|
+
let environment;
|
|
126
|
+
try {
|
|
127
|
+
environment = parseEnvironment(stringOf(config["environment"]), `config.environment in ${path}`);
|
|
128
|
+
}
|
|
129
|
+
catch (err) {
|
|
130
|
+
logger?.log("warn", "config", `smarter cli configuration ${path} is invalid and was ignored: ${String(err)}`);
|
|
131
|
+
return { apiKeys: {} };
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
environment,
|
|
135
|
+
rootDomain: stringOf(config["root_domain"]),
|
|
136
|
+
apiKey: stringOf(document["api_key"]),
|
|
137
|
+
apiKeys,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The platform url of an environment, as the smarter cli derives it.
|
|
142
|
+
*
|
|
143
|
+
* @param environment - The environment.
|
|
144
|
+
* @param rootDomain - The platform's root domain, e.g. `platform.smarter.sh`.
|
|
145
|
+
* @returns e.g. `https://alpha.platform.smarter.sh`.
|
|
146
|
+
*/
|
|
147
|
+
export function environmentUrl(environment, rootDomain) {
|
|
148
|
+
if (environment === "local")
|
|
149
|
+
return LOCAL_URL;
|
|
150
|
+
if (environment === "prod")
|
|
151
|
+
return `https://${rootDomain}`;
|
|
152
|
+
return `https://${environment}.${rootDomain}`;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* The api's base url for a platform url.
|
|
156
|
+
*
|
|
157
|
+
* `https://example.com` and `https://example.com/api/v1` both become `https://example.com/api/v1/`.
|
|
158
|
+
*
|
|
159
|
+
* @param url - A platform url, with or without the api's path.
|
|
160
|
+
* @returns The url, with the api's path and a trailing slash.
|
|
161
|
+
* @throws {@link SmarterConfigurationError} If the url is not an http or https url.
|
|
162
|
+
*/
|
|
163
|
+
export function apiBaseUrl(url) {
|
|
164
|
+
let parsed;
|
|
165
|
+
try {
|
|
166
|
+
parsed = new URL(url.trim());
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
throw new SmarterConfigurationError(`The Smarter base url must be an http or https url, not ${JSON.stringify(url)}.`);
|
|
170
|
+
}
|
|
171
|
+
if (!["http:", "https:"].includes(parsed.protocol) || parsed.host === "") {
|
|
172
|
+
throw new SmarterConfigurationError(`The Smarter base url must be an http or https url, not ${JSON.stringify(url)}.`);
|
|
173
|
+
}
|
|
174
|
+
let path = parsed.pathname.replace(/\/+$/, "");
|
|
175
|
+
const apiPath = API_PATH.replace(/\/+$/, "");
|
|
176
|
+
if (!path.endsWith(apiPath))
|
|
177
|
+
path += apiPath;
|
|
178
|
+
return `${parsed.protocol}//${parsed.host}${path}/`;
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Resolve a client's configuration from its options, the environment, and the cli's configuration file.
|
|
182
|
+
*
|
|
183
|
+
* @param options - The client's options.
|
|
184
|
+
* @param settings - The settings to use instead of reading the environment variables, for tests.
|
|
185
|
+
* @param logger - Where to log why the cli's file was ignored.
|
|
186
|
+
* @returns The configuration.
|
|
187
|
+
* @throws {@link SmarterConfigurationError} If no api key is found, or a value is invalid.
|
|
188
|
+
*/
|
|
189
|
+
export function resolveClientConfig(options = {}, settings = readSettings(), logger) {
|
|
190
|
+
const cli = loadCliConfig(settings.configFile, logger);
|
|
191
|
+
const environment = parseEnvironment(options.environment, "environment") ??
|
|
192
|
+
settings.environment ??
|
|
193
|
+
cli.environment ??
|
|
194
|
+
DEFAULT_ENVIRONMENT;
|
|
195
|
+
const apiKey = nonEmpty(options.apiKey) ?? settings.apiKey ?? cli.apiKeys[environment] ?? cli.apiKey;
|
|
196
|
+
if (apiKey === undefined) {
|
|
197
|
+
throw new SmarterConfigurationError("No Smarter api key. Pass { apiKey }, set SMARTER_API_KEY, or run 'smarter configure'.");
|
|
198
|
+
}
|
|
199
|
+
const url = nonEmpty(options.baseUrl) ??
|
|
200
|
+
settings.baseUrl ??
|
|
201
|
+
environmentUrl(environment, settings.rootDomain ?? cli.rootDomain ?? DEFAULT_ROOT_DOMAIN);
|
|
202
|
+
const timeout = options.timeout ?? settings.timeout;
|
|
203
|
+
if (!(Number.isFinite(timeout) && timeout > 0)) {
|
|
204
|
+
throw new SmarterConfigurationError(`timeout must be a number of seconds, more than 0, not ${String(timeout)}.`);
|
|
205
|
+
}
|
|
206
|
+
const maxRetries = options.maxRetries ?? settings.maxRetries;
|
|
207
|
+
if (!(Number.isInteger(maxRetries) && maxRetries >= 0)) {
|
|
208
|
+
throw new SmarterConfigurationError(`maxRetries must be a whole number, 0 or more, not ${String(maxRetries)}.`);
|
|
209
|
+
}
|
|
210
|
+
return { apiKey, baseUrl: apiBaseUrl(url), environment, timeout, maxRetries };
|
|
211
|
+
}
|
|
212
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/core/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,E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,CAAC,qDAAqD,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAClH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,EAAE,CAAC;AAChF,CAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The errors of the Smarter Node.js SDK.
|
|
3
|
+
*
|
|
4
|
+
* Every error that the SDK throws is a {@link SmarterError}, so a caller can catch them all with one
|
|
5
|
+
* `instanceof` test. The classes, their names and their hierarchy are the Python SDK's:
|
|
6
|
+
*
|
|
7
|
+
* ```text
|
|
8
|
+
* SmarterError
|
|
9
|
+
* ├── SmarterConfigurationError the client has no api key or base url
|
|
10
|
+
* ├── SmarterValueError an argument is invalid, before any request is sent
|
|
11
|
+
* ├── ResourceNotFoundError a resource was not found, by the api (NotFoundError) or by find()
|
|
12
|
+
* ├── SmarterPromptError a streamed prompt failed
|
|
13
|
+
* └── APIError
|
|
14
|
+
* ├── APIConnectionError the request never got a response
|
|
15
|
+
* │ └── APITimeoutError
|
|
16
|
+
* ├── APIResponseValidationError the response does not match the SDK's schema of it
|
|
17
|
+
* └── APIStatusError the api returned a 4xx or 5xx status
|
|
18
|
+
* ├── BadRequestError 400
|
|
19
|
+
* ├── AuthenticationError 401
|
|
20
|
+
* ├── PermissionDeniedError 403
|
|
21
|
+
* ├── NotFoundError 404, also an instanceof ResourceNotFoundError
|
|
22
|
+
* ├── ConflictError 409
|
|
23
|
+
* ├── UnprocessableEntityError 422
|
|
24
|
+
* ├── RateLimitError 429
|
|
25
|
+
* └── InternalServerError 5xx
|
|
26
|
+
* ```
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* try {
|
|
31
|
+
* await client.manifests.describe("LLMClient", "no_such_client");
|
|
32
|
+
* } catch (err) {
|
|
33
|
+
* if (err instanceof NotFoundError) console.log(err.statusCode, err.message, err.errorClass);
|
|
34
|
+
* else throw err;
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
import type { SAMJournalApiErrorBody } from "../models/journal.ts";
|
|
39
|
+
import type { PromptChatApiErrorResponse, PromptChatApiPromptResponse } from "../models/chat.ts";
|
|
40
|
+
/** The method and url of a request that failed. */
|
|
41
|
+
export interface FailedRequest {
|
|
42
|
+
/** The http method, e.g. `POST`. */
|
|
43
|
+
method: string;
|
|
44
|
+
/** The request's url. */
|
|
45
|
+
url: string;
|
|
46
|
+
}
|
|
47
|
+
/** The base class of every error that the Smarter SDK throws. */
|
|
48
|
+
export declare class SmarterError extends Error {
|
|
49
|
+
readonly name: string;
|
|
50
|
+
}
|
|
51
|
+
/** The client is missing configuration that it needs, e.g. an api key or a base url. */
|
|
52
|
+
export declare class SmarterConfigurationError extends SmarterError {
|
|
53
|
+
readonly name: string;
|
|
54
|
+
}
|
|
55
|
+
/** An argument is invalid. Thrown before a request is sent. */
|
|
56
|
+
export declare class SmarterValueError extends SmarterError {
|
|
57
|
+
readonly name: string;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A resource was not found: the api answered 404 ({@link NotFoundError}), or `find()` found no resource of that name.
|
|
61
|
+
*
|
|
62
|
+
* `err instanceof ResourceNotFoundError` is also true for a {@link NotFoundError}, as in the Python SDK,
|
|
63
|
+
* where `NotFoundError` subclasses both.
|
|
64
|
+
*/
|
|
65
|
+
export declare class ResourceNotFoundError extends SmarterError {
|
|
66
|
+
readonly name: string;
|
|
67
|
+
static [Symbol.hasInstance](value: unknown): boolean;
|
|
68
|
+
}
|
|
69
|
+
/** Options of an {@link APIError}. */
|
|
70
|
+
export interface APIErrorOptions extends ErrorOptions {
|
|
71
|
+
/** The request that failed. */
|
|
72
|
+
request: FailedRequest;
|
|
73
|
+
/** The response's parsed JSON body, or its text, or `undefined` when there is no response. */
|
|
74
|
+
body?: unknown;
|
|
75
|
+
}
|
|
76
|
+
/** A request to the Smarter api failed. */
|
|
77
|
+
export declare class APIError extends SmarterError {
|
|
78
|
+
readonly name: string;
|
|
79
|
+
/** The request that failed. */
|
|
80
|
+
readonly request: FailedRequest;
|
|
81
|
+
/** The response's parsed JSON body, or its text, or `undefined` when there is no response. */
|
|
82
|
+
readonly body: unknown;
|
|
83
|
+
/**
|
|
84
|
+
* @param message - A human-readable description of the error.
|
|
85
|
+
* @param options - The request, the body, and the cause.
|
|
86
|
+
*/
|
|
87
|
+
constructor(message: string, options: APIErrorOptions);
|
|
88
|
+
}
|
|
89
|
+
/** The request did not get a response, e.g. the server is unreachable. */
|
|
90
|
+
export declare class APIConnectionError extends APIError {
|
|
91
|
+
readonly name: string;
|
|
92
|
+
}
|
|
93
|
+
/** The request timed out. */
|
|
94
|
+
export declare class APITimeoutError extends APIConnectionError {
|
|
95
|
+
readonly name: string;
|
|
96
|
+
/**
|
|
97
|
+
* @param request - The request that timed out.
|
|
98
|
+
* @param cause - The abort that ended it.
|
|
99
|
+
*/
|
|
100
|
+
constructor(request: FailedRequest, cause?: unknown);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* The api's response does not match the SDK's schema of it.
|
|
104
|
+
*
|
|
105
|
+
* This usually means that the SDK and the Smarter platform are of incompatible versions.
|
|
106
|
+
*/
|
|
107
|
+
export declare class APIResponseValidationError extends APIError {
|
|
108
|
+
readonly name: string;
|
|
109
|
+
/** The response's http status. */
|
|
110
|
+
readonly statusCode: number;
|
|
111
|
+
/**
|
|
112
|
+
* @param message - A description of the mismatch.
|
|
113
|
+
* @param options - The request, the response's status and body, and the validation error.
|
|
114
|
+
*/
|
|
115
|
+
constructor(message: string, options: APIErrorOptions & {
|
|
116
|
+
statusCode: number;
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/** Options of an {@link APIStatusError}. */
|
|
120
|
+
export interface APIStatusErrorOptions extends APIErrorOptions {
|
|
121
|
+
/** The response's http status. */
|
|
122
|
+
statusCode: number;
|
|
123
|
+
/** The response's headers. */
|
|
124
|
+
headers: Headers;
|
|
125
|
+
/** The Smarter Journal error body, when the response is a journaled error. */
|
|
126
|
+
error?: SAMJournalApiErrorBody | undefined;
|
|
127
|
+
}
|
|
128
|
+
/** The api returned a 4xx or 5xx status. */
|
|
129
|
+
export declare class APIStatusError extends APIError {
|
|
130
|
+
readonly name: string;
|
|
131
|
+
/** The response's http status. */
|
|
132
|
+
readonly statusCode: number;
|
|
133
|
+
/** The response's headers. */
|
|
134
|
+
readonly headers: Headers;
|
|
135
|
+
/** The Smarter Journal error body, when the response is a journaled error. */
|
|
136
|
+
readonly error: SAMJournalApiErrorBody | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* @param message - The error's description, from the response when it has one.
|
|
139
|
+
* @param options - The request, the response's status, headers and body, and its journal error.
|
|
140
|
+
*/
|
|
141
|
+
constructor(message: string, options: APIStatusErrorOptions);
|
|
142
|
+
/** The name of the server-side exception class, e.g. `SAMBrokerErrorNotFound`, when the platform sent it. */
|
|
143
|
+
get errorClass(): string | undefined;
|
|
144
|
+
toString(): string;
|
|
145
|
+
}
|
|
146
|
+
/** 400: the request is invalid, e.g. a malformed manifest. */
|
|
147
|
+
export declare class BadRequestError extends APIStatusError {
|
|
148
|
+
readonly name: string;
|
|
149
|
+
}
|
|
150
|
+
/** 401: the api key is missing, invalid, or inactive. */
|
|
151
|
+
export declare class AuthenticationError extends APIStatusError {
|
|
152
|
+
readonly name: string;
|
|
153
|
+
}
|
|
154
|
+
/** 403: the api key's user may not perform the operation. */
|
|
155
|
+
export declare class PermissionDeniedError extends APIStatusError {
|
|
156
|
+
readonly name: string;
|
|
157
|
+
}
|
|
158
|
+
/** 404: the resource does not exist, or the api key's user may not read it. Also an `instanceof` {@link ResourceNotFoundError}. */
|
|
159
|
+
export declare class NotFoundError extends APIStatusError {
|
|
160
|
+
readonly name: string;
|
|
161
|
+
}
|
|
162
|
+
/** 409: the request conflicts with the resource's current state. */
|
|
163
|
+
export declare class ConflictError extends APIStatusError {
|
|
164
|
+
readonly name: string;
|
|
165
|
+
}
|
|
166
|
+
/** 422: the request is well-formed but cannot be processed. */
|
|
167
|
+
export declare class UnprocessableEntityError extends APIStatusError {
|
|
168
|
+
readonly name: string;
|
|
169
|
+
}
|
|
170
|
+
/** 429: too many requests. */
|
|
171
|
+
export declare class RateLimitError extends APIStatusError {
|
|
172
|
+
readonly name: string;
|
|
173
|
+
}
|
|
174
|
+
/** 5xx: the platform failed to process the request. */
|
|
175
|
+
export declare class InternalServerError extends APIStatusError {
|
|
176
|
+
readonly name: string;
|
|
177
|
+
}
|
|
178
|
+
/** A streamed prompt failed: its `result` event carried an error response. */
|
|
179
|
+
export declare class SmarterPromptError extends SmarterError {
|
|
180
|
+
readonly name: string;
|
|
181
|
+
/** The error response. */
|
|
182
|
+
readonly response: PromptChatApiPromptResponse | PromptChatApiErrorResponse;
|
|
183
|
+
/**
|
|
184
|
+
* @param message - The error's description.
|
|
185
|
+
* @param response - The error response.
|
|
186
|
+
*/
|
|
187
|
+
constructor(message: string, response: PromptChatApiPromptResponse | PromptChatApiErrorResponse);
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,KAAK,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,MAAM,mBAAmB,CAAC;AAEjG,mDAAmD;AACnD,MAAM,WAAW,aAAa;IAC5B,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,yBAAyB;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,iEAAiE;AACjE,qBAAa,YAAa,SAAQ,KAAK;IACrC,SAAkB,IAAI,EAAE,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