@effect/ai-typesafe 4.0.0-rc.117 → 4.0.0
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/AGENTS.md +4 -4
- package/CLAUDE.md +4 -4
- package/README.md +24 -0
- package/ai-docs/package.json +1 -1
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +1 -1
- package/ai-docs/src/03_stream/30_encoding.ts +1 -1
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +2 -2
- package/ai-docs/src/08_observability/index.md +1 -1
- package/ai-docs/src/40_sql/10_basics.ts +2 -2
- package/ai-docs/src/40_sql/index.md +1 -1
- package/ai-docs/src/50_http-client/10_basics.ts +1 -1
- package/ai-docs/src/51_http-server/10_basics.ts +2 -2
- package/ai-docs/src/51_http-server/20_testing.ts +2 -2
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +1 -1
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +1 -1
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +1 -1
- package/ai-docs/src/60_child-process/index.md +1 -1
- package/ai-docs/src/70_cli/10_basics.ts +1 -1
- package/ai-docs/src/70_cli/index.md +1 -1
- package/ai-docs/src/71_ai/10_language-model.ts +2 -2
- package/ai-docs/src/71_ai/20_tools.ts +2 -2
- package/ai-docs/src/71_ai/30_chat.ts +2 -2
- package/ai-docs/src/80_cluster/10_entities.ts +3 -3
- package/dist/TypeSafeClient.d.ts +9 -2
- package/dist/TypeSafeClient.d.ts.map +1 -1
- package/dist/TypeSafeClient.js +9 -4
- package/dist/TypeSafeClient.js.map +1 -1
- package/dist/TypeSafeConfig.d.ts +1 -1
- package/dist/TypeSafeConfig.d.ts.map +1 -1
- package/dist/TypeSafeDecisionModel.d.ts +10 -4
- package/dist/TypeSafeDecisionModel.d.ts.map +1 -1
- package/dist/TypeSafeDecisionModel.js +10 -4
- package/dist/TypeSafeDecisionModel.js.map +1 -1
- package/dist/TypeSafeSchema.d.ts +12 -0
- package/dist/TypeSafeSchema.d.ts.map +1 -1
- package/dist/TypeSafeSchema.js +12 -0
- package/dist/TypeSafeSchema.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/errors.d.ts +2 -2
- package/dist/internal/errors.d.ts.map +1 -1
- package/dist/internal/errors.js +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/package.json +3 -3
- package/src/TypeSafeClient.ts +12 -5
- package/src/TypeSafeConfig.ts +1 -1
- package/src/TypeSafeDecisionModel.ts +11 -4
- package/src/TypeSafeSchema.ts +12 -0
- package/src/index.ts +3 -0
- package/src/internal/errors.ts +3 -3
package/AGENTS.md
CHANGED
|
@@ -302,7 +302,7 @@ Use it when your Effect programs need testable current time, safe parsing, stabl
|
|
|
302
302
|
|
|
303
303
|
Effect has built-in support for structured logging, distributed tracing, and
|
|
304
304
|
metrics. For exporting telemetry, use the lightweight Otlp modules from
|
|
305
|
-
`effect/
|
|
305
|
+
`effect/observability` in new projects, or use
|
|
306
306
|
`@effect/opentelemetry` NodeSdk when integrating with an existing OpenTelemetry
|
|
307
307
|
setup.
|
|
308
308
|
|
|
@@ -344,7 +344,7 @@ if (Predicate.isObject(thing)) {
|
|
|
344
344
|
|
|
345
345
|
## Working with SQL databases
|
|
346
346
|
|
|
347
|
-
Use the `effect/
|
|
347
|
+
Use the `effect/sql` modules together with a driver package such as
|
|
348
348
|
`@effect/sql-sqlite-node` to access SQL databases. Define domain models with
|
|
349
349
|
`Model.Class` to derive schemas for the database and JSON boundaries, run
|
|
350
350
|
migrations, and write type-safe queries.
|
|
@@ -372,13 +372,13 @@ Build http clients with the `HttpClient` module.
|
|
|
372
372
|
|
|
373
373
|
## Working with child processes
|
|
374
374
|
|
|
375
|
-
Use the `effect/
|
|
375
|
+
Use the `effect/process` modules to define child processes and run them with `ChildProcessSpawner`.
|
|
376
376
|
|
|
377
377
|
- **[Working with child processes](./ai-docs/src/60_child-process/10_working-with-child-processes.ts)**: This example shows how to collect process output, compose pipelines, and stream long-running command output.
|
|
378
378
|
|
|
379
379
|
## Building CLI applications
|
|
380
380
|
|
|
381
|
-
Use the "effect/
|
|
381
|
+
Use the "effect/cli" modules to build CLI applications. These modules
|
|
382
382
|
provide utilities for parsing command-line arguments, handling user input, and
|
|
383
383
|
managing the flow of a CLI application.
|
|
384
384
|
|
package/CLAUDE.md
CHANGED
|
@@ -302,7 +302,7 @@ Use it when your Effect programs need testable current time, safe parsing, stabl
|
|
|
302
302
|
|
|
303
303
|
Effect has built-in support for structured logging, distributed tracing, and
|
|
304
304
|
metrics. For exporting telemetry, use the lightweight Otlp modules from
|
|
305
|
-
`effect/
|
|
305
|
+
`effect/observability` in new projects, or use
|
|
306
306
|
`@effect/opentelemetry` NodeSdk when integrating with an existing OpenTelemetry
|
|
307
307
|
setup.
|
|
308
308
|
|
|
@@ -344,7 +344,7 @@ if (Predicate.isObject(thing)) {
|
|
|
344
344
|
|
|
345
345
|
## Working with SQL databases
|
|
346
346
|
|
|
347
|
-
Use the `effect/
|
|
347
|
+
Use the `effect/sql` modules together with a driver package such as
|
|
348
348
|
`@effect/sql-sqlite-node` to access SQL databases. Define domain models with
|
|
349
349
|
`Model.Class` to derive schemas for the database and JSON boundaries, run
|
|
350
350
|
migrations, and write type-safe queries.
|
|
@@ -372,13 +372,13 @@ Build http clients with the `HttpClient` module.
|
|
|
372
372
|
|
|
373
373
|
## Working with child processes
|
|
374
374
|
|
|
375
|
-
Use the `effect/
|
|
375
|
+
Use the `effect/process` modules to define child processes and run them with `ChildProcessSpawner`.
|
|
376
376
|
|
|
377
377
|
- **[Working with child processes](./ai-docs/src/60_child-process/10_working-with-child-processes.ts)**: This example shows how to collect process output, compose pipelines, and stream long-running command output.
|
|
378
378
|
|
|
379
379
|
## Building CLI applications
|
|
380
380
|
|
|
381
|
-
Use the "effect/
|
|
381
|
+
Use the "effect/cli" modules to build CLI applications. These modules
|
|
382
382
|
provide utilities for parsing command-line arguments, handling user input, and
|
|
383
383
|
managing the flow of a CLI application.
|
|
384
384
|
|
package/README.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
|
|
3
3
|
TypeSafe System One provider for Effect's `DecisionModel`. Supports classification, ordered ratings, and probabilities through Effect `HttpClient`.
|
|
4
4
|
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install effect @effect/ai-typesafe
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Links
|
|
12
|
+
|
|
13
|
+
- [Website](https://effect.website): documentation, guides, and news.
|
|
14
|
+
- [Reference](https://effect.website/docs/v4/api/ai-typesafe): API documentation for this package.
|
|
15
|
+
- [Discord](https://discord.gg/effect-ts): ask questions, share what you're building, and talk to the core team.
|
|
16
|
+
- [Community](https://effect.website/community-hub): meetups and events, or bring Effect to your own.
|
|
17
|
+
- [Issues](https://github.com/Effect-TS/effect/issues): bug reports and feature requests.
|
|
18
|
+
|
|
19
|
+
## Let's talk
|
|
20
|
+
|
|
21
|
+
Whether your team is considering Effect, rolling it out, or already running it in production, we'd love to hear from you: what you're building, what works, and what you need from Effect next.
|
|
22
|
+
|
|
23
|
+
- **Talk to the maintainers.** Introduce your team on [Discord](https://discord.gg/effect-ts) or email [contact@effectful.co](mailto:contact@effectful.co). We're happy to connect privately on Slack or Discord for feedback and help with adoption.
|
|
24
|
+
- **Production support.** We're exploring how to better support teams running Effect in production. If your organization has specific support needs, let's discuss them.
|
|
25
|
+
- **Adoption help.** Our [adoption partners](https://effect.website/adoption-partners) offer implementation, consulting, team extension, training, and commercial support.
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
5
29
|
Use `TypeSafeClient.layerConfig()` to read `TYPESAFE_API_KEY`, then provide `TypeSafeDecisionModel.model("jev-latest")` to a decision workflow. Versioned model identifiers such as `jev-1.13.0` are also supported.
|
|
6
30
|
|
|
7
31
|
The client does not retry automatically. Rate-limit errors include the provider's retry delay when available. Provider distributions are preserved, not normalized; they must satisfy the core `DecisionModel` validation, including its current `1e-6` sum tolerance. TypeSafe's rounding behavior has not been verified against the live API.
|
package/ai-docs/package.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
import { PgClient } from "@effect/sql-pg"
|
|
9
9
|
import { Array, Config, Context, Effect, Layer, type Option, Schema } from "effect"
|
|
10
|
-
import { SqlClient, SqlError } from "effect/
|
|
10
|
+
import { SqlClient, SqlError } from "effect/sql"
|
|
11
11
|
|
|
12
12
|
// Define a layer for the SqlClient service
|
|
13
13
|
export const SqlClientLayer: Layer.Layer<
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NodeHttpServer, NodeRuntime } from "@effect/platform-node"
|
|
7
7
|
import { Effect, Layer } from "effect"
|
|
8
|
-
import { HttpRouter, HttpServerResponse } from "effect/
|
|
8
|
+
import { HttpRouter, HttpServerResponse } from "effect/http"
|
|
9
9
|
import { createServer } from "node:http"
|
|
10
10
|
|
|
11
11
|
// Build a tiny HTTP app with a health-check endpoint.
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* decode and encode streams of structured data.
|
|
6
6
|
*/
|
|
7
7
|
import { DateTime, Schema, Stream } from "effect"
|
|
8
|
-
import { Ndjson, SchemaBinary } from "effect/
|
|
8
|
+
import { Ndjson, SchemaBinary } from "effect/encoding"
|
|
9
9
|
|
|
10
10
|
// SchemaBinary derives a framed binary decoder directly from a schema.
|
|
11
11
|
export const schemaBinaryDecoder = SchemaBinary.decode(Schema.Struct({
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NodeRuntime } from "@effect/platform-node"
|
|
7
7
|
import { Context, Effect, Layer } from "effect"
|
|
8
|
-
import { FetchHttpClient } from "effect/
|
|
9
|
-
import { OtlpLogger, OtlpSerialization, OtlpTracer } from "effect/
|
|
8
|
+
import { FetchHttpClient } from "effect/http"
|
|
9
|
+
import { OtlpLogger, OtlpSerialization, OtlpTracer } from "effect/observability"
|
|
10
10
|
|
|
11
11
|
// Configure OTLP span export.
|
|
12
12
|
export const OtlpTracingLayer = OtlpTracer.layer({
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Effect has built-in support for structured logging, distributed tracing, and
|
|
4
4
|
metrics. For exporting telemetry, use the lightweight Otlp modules from
|
|
5
|
-
`effect/
|
|
5
|
+
`effect/observability` in new projects, or use
|
|
6
6
|
`@effect/opentelemetry` NodeSdk when integrating with an existing OpenTelemetry
|
|
7
7
|
setup.
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { NodeRuntime } from "@effect/platform-node"
|
|
8
8
|
import { SqliteClient, SqliteMigrator } from "@effect/sql-sqlite-node"
|
|
9
9
|
import { Context, Effect, Layer, Schema } from "effect"
|
|
10
|
-
import { Model } from "effect/
|
|
11
|
-
import { SqlClient, SqlModel, SqlSchema } from "effect/
|
|
10
|
+
import { Model } from "effect/schema"
|
|
11
|
+
import { SqlClient, SqlModel, SqlSchema } from "effect/sql"
|
|
12
12
|
|
|
13
13
|
// Use a branded string for the group id, so it cannot be mixed up with other
|
|
14
14
|
// string ids in the application.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Working with SQL databases
|
|
2
2
|
|
|
3
|
-
Use the `effect/
|
|
3
|
+
Use the `effect/sql` modules together with a driver package such as
|
|
4
4
|
`@effect/sql-sqlite-node` to access SQL databases. Define domain models with
|
|
5
5
|
`Model.Class` to derive schemas for the database and JSON boundaries, run
|
|
6
6
|
migrations, and write type-safe queries.
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Define a service that uses the HttpClient module to fetch data from an external API
|
|
5
5
|
*/
|
|
6
6
|
import { Context, Effect, flow, Layer, Schedule, Schema } from "effect"
|
|
7
|
-
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/
|
|
7
|
+
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpClientResponse } from "effect/http"
|
|
8
8
|
|
|
9
9
|
class Todo extends Schema.Class<Todo>("Todo")({
|
|
10
10
|
userId: Schema.Int,
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { NodeHttpServer, NodeRuntime } from "@effect/platform-node"
|
|
8
8
|
import { Context, Effect, flow, Layer, Schedule } from "effect"
|
|
9
|
-
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpRouter, HttpServer } from "effect/
|
|
10
|
-
import { HttpApiBuilder, HttpApiClient, HttpApiMiddleware, HttpApiScalar } from "effect/
|
|
9
|
+
import { FetchHttpClient, HttpClient, HttpClientRequest, HttpRouter, HttpServer } from "effect/http"
|
|
10
|
+
import { HttpApiBuilder, HttpApiClient, HttpApiMiddleware, HttpApiScalar } from "effect/http-api"
|
|
11
11
|
import { createServer } from "node:http"
|
|
12
12
|
// Api definitions should **always** be seperate from the server implementation,
|
|
13
13
|
// so that they can be shared between the server and client without leaking
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { assert, layer } from "@effect/vitest"
|
|
8
8
|
import { Effect, Layer } from "effect"
|
|
9
|
-
import { HttpClientRequest, HttpServer } from "effect/
|
|
10
|
-
import { HttpApiMiddleware, HttpApiTest } from "effect/
|
|
9
|
+
import { HttpClientRequest, HttpServer } from "effect/http"
|
|
10
|
+
import { HttpApiMiddleware, HttpApiTest } from "effect/http-api"
|
|
11
11
|
import { Api } from "./fixtures/api/Api.ts"
|
|
12
12
|
import { Authorization } from "./fixtures/api/Authorization.ts"
|
|
13
13
|
import { UserId } from "./fixtures/domain/User.ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Context, Schema } from "effect"
|
|
2
|
-
import { HttpApiMiddleware, HttpApiSecurity } from "effect/
|
|
2
|
+
import { HttpApiMiddleware, HttpApiSecurity } from "effect/http-api"
|
|
3
3
|
import type { User } from "../domain/User.ts"
|
|
4
4
|
|
|
5
5
|
export class CurrentUser extends Context.Service<CurrentUser, User>()("acme/HttpApi/Authorization/CurrentUser") {}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Schema } from "effect"
|
|
2
|
-
import { HttpApiEndpoint, HttpApiError, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/
|
|
2
|
+
import { HttpApiEndpoint, HttpApiError, HttpApiGroup, HttpApiSchema, OpenApi } from "effect/http-api"
|
|
3
3
|
import { User, UserId } from "../domain/User.ts"
|
|
4
4
|
import { SearchQueryTooShort, UserNotFound } from "../domain/UserErrors.ts"
|
|
5
5
|
import { Authorization } from "./Authorization.ts"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Layer } from "effect"
|
|
2
|
-
import { HttpApiBuilder, HttpApiError } from "effect/
|
|
2
|
+
import { HttpApiBuilder, HttpApiError } from "effect/http-api"
|
|
3
3
|
import { Api } from "../../api/Api.ts"
|
|
4
4
|
import { CurrentUser } from "../../api/Authorization.ts"
|
|
5
5
|
import { AuthorizationLayer } from "../Authorization.ts"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SqliteClient, SqliteMigrator } from "@effect/sql-sqlite-node"
|
|
2
2
|
import { Context, Effect, Layer, Schema } from "effect"
|
|
3
|
-
import { SqlClient, SqlModel, SqlSchema } from "effect/
|
|
3
|
+
import { SqlClient, SqlModel, SqlSchema } from "effect/sql"
|
|
4
4
|
import { User } from "../domain/User.ts"
|
|
5
5
|
import type { UserId } from "../domain/User.ts"
|
|
6
6
|
import { SearchQueryTooShort, UserNotFound, UsersError } from "../domain/UserErrors.ts"
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NodeServices } from "@effect/platform-node"
|
|
7
7
|
import { Console, Context, Effect, Layer, Schema, Stream, String } from "effect"
|
|
8
|
-
import { ChildProcess, ChildProcessSpawner } from "effect/
|
|
8
|
+
import { ChildProcess, ChildProcessSpawner } from "effect/process"
|
|
9
9
|
|
|
10
10
|
export class DevToolsError extends Schema.TaggedError<DevToolsError>()("DevToolsError", {
|
|
11
11
|
cause: Schema.Defect()
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { NodeRuntime, NodeServices } from "@effect/platform-node"
|
|
8
8
|
import { Console, Effect, Option, Schema } from "effect"
|
|
9
|
-
import { Argument, Command, Flag } from "effect/
|
|
9
|
+
import { Argument, Command, Flag } from "effect/cli"
|
|
10
10
|
|
|
11
11
|
// You can define flags outside of commands and reuse them across multiple
|
|
12
12
|
// commands.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
## Building CLI applications
|
|
2
2
|
|
|
3
|
-
Use the "effect/
|
|
3
|
+
Use the "effect/cli" modules to build CLI applications. These modules
|
|
4
4
|
provide utilities for parsing command-line arguments, handling user input, and
|
|
5
5
|
managing the flow of a CLI application.
|
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
import { AnthropicClient, AnthropicLanguageModel } from "@effect/ai-anthropic"
|
|
8
8
|
import { OpenAiClient, OpenAiLanguageModel } from "@effect/ai-openai"
|
|
9
9
|
import { Config, Context, Effect, ExecutionPlan, Layer, Schema, Stream } from "effect"
|
|
10
|
-
import { AiError, LanguageModel, Model, type Response } from "effect/
|
|
11
|
-
import { FetchHttpClient } from "effect/
|
|
10
|
+
import { AiError, LanguageModel, Model, type Response } from "effect/ai"
|
|
11
|
+
import { FetchHttpClient } from "effect/http"
|
|
12
12
|
import { LaunchPlan } from "./fixtures/domain/LaunchPlan.ts"
|
|
13
13
|
|
|
14
14
|
// You can use Config to create ai clients
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { OpenAiClient, OpenAiLanguageModel, OpenAiTool } from "@effect/ai-openai"
|
|
8
8
|
import { Config, Context, Effect, Layer, Schema } from "effect"
|
|
9
|
-
import { AiError, LanguageModel, Tool, Toolkit } from "effect/
|
|
10
|
-
import { FetchHttpClient } from "effect/
|
|
9
|
+
import { AiError, LanguageModel, Tool, Toolkit } from "effect/ai"
|
|
10
|
+
import { FetchHttpClient } from "effect/http"
|
|
11
11
|
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
// 1. Defining tools
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { OpenAiClient, OpenAiLanguageModel } from "@effect/ai-openai"
|
|
8
8
|
import { Config, Context, DateTime, Effect, Layer, Ref, Schema } from "effect"
|
|
9
|
-
import { AiError, Chat, Prompt, Tool, Toolkit } from "effect/
|
|
10
|
-
import { FetchHttpClient } from "effect/
|
|
9
|
+
import { AiError, Chat, Prompt, Tool, Toolkit } from "effect/ai"
|
|
10
|
+
import { FetchHttpClient } from "effect/http"
|
|
11
11
|
|
|
12
12
|
// ---------------------------------------------------------------------------
|
|
13
13
|
// Provider setup
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { NodeClusterSocket, NodeRuntime } from "@effect/platform-node"
|
|
7
7
|
import { Effect, Layer, Ref, Schema } from "effect"
|
|
8
|
-
import { ClusterSchema, Entity, TestRunner } from "effect/
|
|
9
|
-
import { Rpc } from "effect/
|
|
10
|
-
import type { SqlClient } from "effect/
|
|
8
|
+
import { ClusterSchema, Entity, TestRunner } from "effect/cluster"
|
|
9
|
+
import { Rpc } from "effect/rpc"
|
|
10
|
+
import type { SqlClient } from "effect/sql"
|
|
11
11
|
|
|
12
12
|
export const Increment = Rpc.make("Increment", {
|
|
13
13
|
payload: { amount: Schema.Int },
|
package/dist/TypeSafeClient.d.ts
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP client for TypeSafe System One and model discovery.
|
|
3
3
|
*
|
|
4
|
+
* @stability unstable
|
|
4
5
|
* @since 4.0.0
|
|
5
6
|
*/
|
|
7
|
+
import * as AiError from "effect/ai/AiError";
|
|
6
8
|
import * as Config from "effect/Config";
|
|
7
9
|
import * as Context from "effect/Context";
|
|
8
10
|
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
9
12
|
import * as Layer from "effect/Layer";
|
|
10
13
|
import * as Redacted from "effect/Redacted";
|
|
11
|
-
import * as AiError from "effect/unstable/ai/AiError";
|
|
12
|
-
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
13
14
|
import * as TypeSafeSchema from "./TypeSafeSchema.ts";
|
|
14
15
|
/**
|
|
15
16
|
* Low-level TypeSafe operations.
|
|
16
17
|
*
|
|
18
|
+
* @stability unstable
|
|
17
19
|
* @category services
|
|
18
20
|
* @since 4.0.0
|
|
19
21
|
*/
|
|
@@ -26,6 +28,7 @@ declare const TypeSafeClient_base: Context.ServiceClass<TypeSafeClient, "@effect
|
|
|
26
28
|
/**
|
|
27
29
|
* TypeSafe client service.
|
|
28
30
|
*
|
|
31
|
+
* @stability unstable
|
|
29
32
|
* @category services
|
|
30
33
|
* @since 4.0.0
|
|
31
34
|
*/
|
|
@@ -34,6 +37,7 @@ export declare class TypeSafeClient extends TypeSafeClient_base {
|
|
|
34
37
|
/**
|
|
35
38
|
* Authentication, endpoint and HTTP customization options.
|
|
36
39
|
*
|
|
40
|
+
* @stability unstable
|
|
37
41
|
* @category options
|
|
38
42
|
* @since 4.0.0
|
|
39
43
|
*/
|
|
@@ -45,6 +49,7 @@ export interface Options {
|
|
|
45
49
|
/**
|
|
46
50
|
* Builds a client without automatic retries. Scoped transforms run after the constructor transform.
|
|
47
51
|
*
|
|
52
|
+
* @stability unstable
|
|
48
53
|
* @category constructors
|
|
49
54
|
* @since 4.0.0
|
|
50
55
|
*/
|
|
@@ -52,6 +57,7 @@ export declare const make: (options: Options) => Effect.Effect<Service, never, H
|
|
|
52
57
|
/**
|
|
53
58
|
* Provides a client from explicit options.
|
|
54
59
|
*
|
|
60
|
+
* @stability unstable
|
|
55
61
|
* @category layers
|
|
56
62
|
* @since 4.0.0
|
|
57
63
|
*/
|
|
@@ -59,6 +65,7 @@ export declare const layer: (options: Options) => Layer.Layer<TypeSafeClient, ne
|
|
|
59
65
|
/**
|
|
60
66
|
* Provides a client from configuration, defaulting to TYPESAFE_API_KEY.
|
|
61
67
|
*
|
|
68
|
+
* @stability unstable
|
|
62
69
|
* @category layers
|
|
63
70
|
* @since 4.0.0
|
|
64
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeClient.d.ts","sourceRoot":"","sources":["../src/TypeSafeClient.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TypeSafeClient.d.ts","sourceRoot":"","sources":["../src/TypeSafeClient.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAA;AAIpD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAI3C,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD;;;;;;GAMG;AACH,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,UAAU,CAAA;IACtC,QAAQ,CAAC,SAAS,EAAE,CAClB,OAAO,EAAE,OAAO,cAAc,CAAC,gBAAgB,CAAC,OAAO,KACpD,MAAM,CAAC,MAAM,CAA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,CAAC,cAAc,EAAE,MAAM,CAAC,WAAW,EAAE,UAAU,CAAC,UAAU,CAUtE,CAAA"}
|
package/dist/TypeSafeClient.js
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* HTTP client for TypeSafe System One and model discovery.
|
|
3
3
|
*
|
|
4
|
+
* @stability unstable
|
|
4
5
|
* @since 4.0.0
|
|
5
6
|
*/
|
|
7
|
+
import * as AiError from "effect/ai/AiError";
|
|
6
8
|
import * as Config from "effect/Config";
|
|
7
9
|
import * as Context from "effect/Context";
|
|
8
10
|
import * as Effect from "effect/Effect";
|
|
9
11
|
import { flow, identity } from "effect/Function";
|
|
12
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
13
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
14
|
+
import * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
10
15
|
import * as Layer from "effect/Layer";
|
|
11
16
|
import * as Redacted from "effect/Redacted";
|
|
12
|
-
import * as AiError from "effect/unstable/ai/AiError";
|
|
13
|
-
import * as HttpClient from "effect/unstable/http/HttpClient";
|
|
14
|
-
import * as HttpClientRequest from "effect/unstable/http/HttpClientRequest";
|
|
15
|
-
import * as HttpClientResponse from "effect/unstable/http/HttpClientResponse";
|
|
16
17
|
import * as Errors from "./internal/errors.js";
|
|
17
18
|
import { TypeSafeConfig } from "./TypeSafeConfig.js";
|
|
18
19
|
import * as TypeSafeSchema from "./TypeSafeSchema.js";
|
|
19
20
|
/**
|
|
20
21
|
* TypeSafe client service.
|
|
21
22
|
*
|
|
23
|
+
* @stability unstable
|
|
22
24
|
* @category services
|
|
23
25
|
* @since 4.0.0
|
|
24
26
|
*/
|
|
@@ -28,6 +30,7 @@ const decodeListModels = /*#__PURE__*/HttpClientResponse.schemaBodyJson(TypeSafe
|
|
|
28
30
|
/**
|
|
29
31
|
* Builds a client without automatic retries. Scoped transforms run after the constructor transform.
|
|
30
32
|
*
|
|
33
|
+
* @stability unstable
|
|
31
34
|
* @category constructors
|
|
32
35
|
* @since 4.0.0
|
|
33
36
|
*/
|
|
@@ -54,6 +57,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
|
54
57
|
/**
|
|
55
58
|
* Provides a client from explicit options.
|
|
56
59
|
*
|
|
60
|
+
* @stability unstable
|
|
57
61
|
* @category layers
|
|
58
62
|
* @since 4.0.0
|
|
59
63
|
*/
|
|
@@ -61,6 +65,7 @@ export const layer = options => Layer.effect(TypeSafeClient, make(options));
|
|
|
61
65
|
/**
|
|
62
66
|
* Provides a client from configuration, defaulting to TYPESAFE_API_KEY.
|
|
63
67
|
*
|
|
68
|
+
* @stability unstable
|
|
64
69
|
* @category layers
|
|
65
70
|
* @since 4.0.0
|
|
66
71
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeClient.js","names":[],"sources":["../src/TypeSafeClient.ts"],"sourcesContent":[null],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TypeSafeClient.js","names":[],"sources":["../src/TypeSafeClient.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;AAMA,OAAO,KAAK,OAAO,MAAM,mBAAmB;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,OAAO,MAAM,gBAAgB;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,SAAS,IAAI,EAAE,QAAQ,QAAQ,iBAAiB;AAChD,OAAO,KAAK,UAAU,MAAM,wBAAwB;AAEpD,OAAO,KAAK,iBAAiB,MAAM,+BAA+B;AAClE,OAAO,KAAK,kBAAkB,MAAM,gCAAgC;AACpE,OAAO,KAAK,KAAK,MAAM,cAAc;AACrC,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAE3C,OAAO,KAAK,MAAM,MAAM,sBAAsB;AAC9C,SAAS,cAAc,QAAQ,qBAAqB;AACpD,OAAO,KAAK,cAAc,MAAM,qBAAqB;AAiBrD;;;;;;;AAOA,OA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ACH","ignoreList":[]}
|
package/dist/TypeSafeConfig.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import * as Context from "effect/Context";
|
|
7
7
|
import * as Effect from "effect/Effect";
|
|
8
|
-
import type { HttpClient } from "effect/
|
|
8
|
+
import type { HttpClient } from "effect/http/HttpClient";
|
|
9
9
|
declare const TypeSafeConfig_base: Context.ServiceClass<TypeSafeConfig, "@effect/ai-typesafe/TypeSafeConfig", TypeSafeConfig.Service>;
|
|
10
10
|
/**
|
|
11
11
|
* Scoped configuration read when executing TypeSafe requests.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeConfig.d.ts","sourceRoot":"","sources":["../src/TypeSafeConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"TypeSafeConfig.d.ts","sourceRoot":"","sources":["../src/TypeSafeConfig.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;;AAExD;;;;;;;GAOG;AACH,qBAAa,cAAe,SAAQ,mBAGK;IACvC;;;;OAIG;IACH,MAAM,CAAC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,OAAO,GAAG,SAAS,CAAC,CAGvF;CACF;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,cAAc,CAAC;IACtC;;;;;OAKG;IACH,UAAiB,OAAO;QACtB,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,CAAC,GAAG,SAAS,CAAA;KAC5E;CACF;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE;IAChC;;;;;;OAMG;IACH,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAClH;;;;;;OAMG;IACH,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EACN,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAC5B,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,UAAU,GAC5C,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;CAQvB,CAAA"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TypeSafe's System One implementation of DecisionModel.
|
|
3
3
|
*
|
|
4
|
+
* @stability unstable
|
|
4
5
|
* @since 4.0.0
|
|
5
6
|
*/
|
|
7
|
+
import * as DecisionModel from "effect/ai/DecisionModel";
|
|
8
|
+
import * as AiModel from "effect/ai/Model";
|
|
6
9
|
import * as Effect from "effect/Effect";
|
|
7
10
|
import * as Layer from "effect/Layer";
|
|
8
|
-
import * as DecisionModel from "effect/unstable/ai/DecisionModel";
|
|
9
|
-
import * as AiModel from "effect/unstable/ai/Model";
|
|
10
11
|
import { TypeSafeClient } from "./TypeSafeClient.ts";
|
|
11
12
|
/**
|
|
12
13
|
* Known TypeSafe model identifiers. Constructors also accept custom identifiers.
|
|
13
14
|
*
|
|
15
|
+
* @stability unstable
|
|
14
16
|
* @category models
|
|
15
17
|
* @since 4.0.0
|
|
16
18
|
*/
|
|
@@ -18,14 +20,17 @@ export type Model = "jev-latest" | "jev-preview" | "jev-1.13.0";
|
|
|
18
20
|
/**
|
|
19
21
|
* Creates a decision model with TypeSafe provider metadata.
|
|
20
22
|
*
|
|
23
|
+
* @stability unstable
|
|
21
24
|
* @category constructors
|
|
22
25
|
* @since 4.0.0
|
|
23
26
|
*/
|
|
24
27
|
export declare const model: (model: Model | (string & {})) => AiModel.Model<"typesafe", DecisionModel.DecisionModel, TypeSafeClient>;
|
|
25
28
|
/**
|
|
26
|
-
* Builds a decision service.
|
|
27
|
-
* DecisionModel validates distributions and
|
|
29
|
+
* Builds a decision service. Probabilities arrive rounded to two decimals, so
|
|
30
|
+
* DecisionModel rescales small sum drift when it validates distributions and
|
|
31
|
+
* derives rating labels.
|
|
28
32
|
*
|
|
33
|
+
* @stability unstable
|
|
29
34
|
* @category constructors
|
|
30
35
|
* @since 4.0.0
|
|
31
36
|
*/
|
|
@@ -35,6 +40,7 @@ export declare const make: (options: {
|
|
|
35
40
|
/**
|
|
36
41
|
* Provides DecisionModel using an existing TypeSafeClient.
|
|
37
42
|
*
|
|
43
|
+
* @stability unstable
|
|
38
44
|
* @category layers
|
|
39
45
|
* @since 4.0.0
|
|
40
46
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeSafeDecisionModel.d.ts","sourceRoot":"","sources":["../src/TypeSafeDecisionModel.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"TypeSafeDecisionModel.d.ts","sourceRoot":"","sources":["../src/TypeSafeDecisionModel.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,aAAa,MAAM,yBAAyB,CAAA;AACxD,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAGpD;;;;;;GAMG;AACH,MAAM,MAAM,KAAK,GAAG,YAAY,GAAG,aAAa,GAAG,YAAY,CAAA;AAE/D;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,UACT,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,KAC3B,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,aAAa,EAAE,cAAc,CACrB,CAAA;AAEnD;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI;oBAEc,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;uEAuDnD,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,YACP;IAAE,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAA;CAAE,KACjD,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,aAAa,EAAE,KAAK,EAAE,cAAc,CACP,CAAA"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TypeSafe's System One implementation of DecisionModel.
|
|
3
3
|
*
|
|
4
|
+
* @stability unstable
|
|
4
5
|
* @since 4.0.0
|
|
5
6
|
*/
|
|
7
|
+
import * as DecisionModel from "effect/ai/DecisionModel";
|
|
8
|
+
import * as AiModel from "effect/ai/Model";
|
|
6
9
|
import * as Effect from "effect/Effect";
|
|
7
10
|
import * as Layer from "effect/Layer";
|
|
8
|
-
import * as DecisionModel from "effect/unstable/ai/DecisionModel";
|
|
9
|
-
import * as AiModel from "effect/unstable/ai/Model";
|
|
10
11
|
import { TypeSafeClient } from "./TypeSafeClient.js";
|
|
11
12
|
/**
|
|
12
13
|
* Creates a decision model with TypeSafe provider metadata.
|
|
13
14
|
*
|
|
15
|
+
* @stability unstable
|
|
14
16
|
* @category constructors
|
|
15
17
|
* @since 4.0.0
|
|
16
18
|
*/
|
|
@@ -18,15 +20,18 @@ export const model = model => AiModel.make("typesafe", model, layer({
|
|
|
18
20
|
model
|
|
19
21
|
}));
|
|
20
22
|
/**
|
|
21
|
-
* Builds a decision service.
|
|
22
|
-
* DecisionModel validates distributions and
|
|
23
|
+
* Builds a decision service. Probabilities arrive rounded to two decimals, so
|
|
24
|
+
* DecisionModel rescales small sum drift when it validates distributions and
|
|
25
|
+
* derives rating labels.
|
|
23
26
|
*
|
|
27
|
+
* @stability unstable
|
|
24
28
|
* @category constructors
|
|
25
29
|
* @since 4.0.0
|
|
26
30
|
*/
|
|
27
31
|
export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
28
32
|
const client = yield* TypeSafeClient;
|
|
29
33
|
return yield* DecisionModel.make({
|
|
34
|
+
probabilityPrecision: 2,
|
|
30
35
|
decide: Effect.fnUntraced(function* ({
|
|
31
36
|
state,
|
|
32
37
|
decisions
|
|
@@ -111,6 +116,7 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
|
111
116
|
/**
|
|
112
117
|
* Provides DecisionModel using an existing TypeSafeClient.
|
|
113
118
|
*
|
|
119
|
+
* @stability unstable
|
|
114
120
|
* @category layers
|
|
115
121
|
* @since 4.0.0
|
|
116
122
|
*/
|