@effect/ai-cloudflare 0.0.0-stage → 4.0.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/AGENTS.md +410 -0
- package/CLAUDE.md +410 -0
- package/LICENSE +21 -0
- package/README.md +43 -2
- package/ai-docs/README.md +44 -0
- package/ai-docs/package.json +36 -0
- package/ai-docs/src/01_effect/01_basics/01_effect-gen.ts +30 -0
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +52 -0
- package/ai-docs/src/01_effect/01_basics/10_creating-effects.ts +74 -0
- package/ai-docs/src/01_effect/01_basics/index.md +7 -0
- package/ai-docs/src/01_effect/02_schema/10_schema-basics.ts +43 -0
- package/ai-docs/src/01_effect/02_schema/index.md +7 -0
- package/ai-docs/src/01_effect/03_services/01_service.ts +45 -0
- package/ai-docs/src/01_effect/03_services/10_reference.ts +10 -0
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +70 -0
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +66 -0
- package/ai-docs/src/01_effect/03_services/index.md +5 -0
- package/ai-docs/src/01_effect/04_errors/01_error-handling.ts +30 -0
- package/ai-docs/src/01_effect/04_errors/10_catch-tags.ts +24 -0
- package/ai-docs/src/01_effect/04_errors/20_reason-errors.ts +64 -0
- package/ai-docs/src/01_effect/04_errors/index.md +1 -0
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +105 -0
- package/ai-docs/src/01_effect/05_resources/20_layer-side-effects.ts +31 -0
- package/ai-docs/src/01_effect/05_resources/30_layer-map.ts +86 -0
- package/ai-docs/src/01_effect/05_resources/index.md +3 -0
- package/ai-docs/src/01_effect/06_running/10_run-main.ts +30 -0
- package/ai-docs/src/01_effect/06_running/20_layer-launch.ts +27 -0
- package/ai-docs/src/01_effect/06_running/index.md +1 -0
- package/ai-docs/src/01_effect/07_pubsub/10_pubsub.ts +56 -0
- package/ai-docs/src/01_effect/07_pubsub/index.md +3 -0
- package/ai-docs/src/03_stream/10_creating-streams.ts +103 -0
- package/ai-docs/src/03_stream/20_consuming-streams.ts +137 -0
- package/ai-docs/src/03_stream/30_encoding.ts +163 -0
- package/ai-docs/src/03_stream/index.md +4 -0
- package/ai-docs/src/04_integration/10_managed-runtime.ts +129 -0
- package/ai-docs/src/04_integration/index.md +5 -0
- package/ai-docs/src/05_batching/10_request-resolver.ts +89 -0
- package/ai-docs/src/05_batching/index.md +3 -0
- package/ai-docs/src/06_schedule/10_schedules.ts +110 -0
- package/ai-docs/src/06_schedule/index.md +3 -0
- package/ai-docs/src/07_datetime/10_creating-and-formatting.ts +30 -0
- package/ai-docs/src/07_datetime/20_time-zones.ts +44 -0
- package/ai-docs/src/07_datetime/index.md +5 -0
- package/ai-docs/src/08_observability/10_logging.ts +66 -0
- package/ai-docs/src/08_observability/20_otlp-tracing.ts +95 -0
- package/ai-docs/src/08_observability/index.md +7 -0
- package/ai-docs/src/09_testing/10_effect-tests.ts +55 -0
- package/ai-docs/src/09_testing/20_layer-tests.ts +138 -0
- package/ai-docs/src/09_testing/index.md +1 -0
- package/ai-docs/src/10_predicate/01_basics.ts +14 -0
- package/ai-docs/src/10_predicate/index.md +9 -0
- package/ai-docs/src/40_sql/10_basics.ts +175 -0
- package/ai-docs/src/40_sql/index.md +6 -0
- package/ai-docs/src/50_http-client/10_basics.ts +102 -0
- package/ai-docs/src/50_http-client/index.md +3 -0
- package/ai-docs/src/51_http-server/10_basics.ts +118 -0
- package/ai-docs/src/51_http-server/20_testing.ts +100 -0
- package/ai-docs/src/51_http-server/fixtures/api/Api.ts +14 -0
- package/ai-docs/src/51_http-server/fixtures/api/Authorization.ts +36 -0
- package/ai-docs/src/51_http-server/fixtures/api/System.ts +10 -0
- package/ai-docs/src/51_http-server/fixtures/api/Users.ts +107 -0
- package/ai-docs/src/51_http-server/fixtures/domain/User.ts +21 -0
- package/ai-docs/src/51_http-server/fixtures/domain/UserErrors.ts +22 -0
- package/ai-docs/src/51_http-server/fixtures/server/Authorization.ts +37 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users/http.ts +80 -0
- package/ai-docs/src/51_http-server/fixtures/server/Users.ts +183 -0
- package/ai-docs/src/51_http-server/index.md +3 -0
- package/ai-docs/src/60_child-process/10_working-with-child-processes.ts +117 -0
- package/ai-docs/src/60_child-process/index.md +3 -0
- package/ai-docs/src/70_cli/10_basics.ts +162 -0
- package/ai-docs/src/70_cli/index.md +5 -0
- package/ai-docs/src/71_ai/10_language-model.ts +156 -0
- package/ai-docs/src/71_ai/20_tools.ts +226 -0
- package/ai-docs/src/71_ai/30_chat.ts +158 -0
- package/ai-docs/src/71_ai/fixtures/domain/LaunchPlan.ts +9 -0
- package/ai-docs/src/71_ai/index.md +5 -0
- package/ai-docs/src/80_cluster/10_entities.ts +97 -0
- package/ai-docs/src/80_cluster/index.md +4 -0
- package/ai-docs/src/index.md +10 -0
- package/ai-docs/tsconfig.json +24 -0
- package/dist/CloudflareClient.d.ts +79 -0
- package/dist/CloudflareClient.d.ts.map +1 -0
- package/dist/CloudflareClient.js +86 -0
- package/dist/CloudflareClient.js.map +1 -0
- package/dist/CloudflareDecisionModel.d.ts +49 -0
- package/dist/CloudflareDecisionModel.d.ts.map +1 -0
- package/dist/CloudflareDecisionModel.js +122 -0
- package/dist/CloudflareDecisionModel.js.map +1 -0
- package/dist/CloudflareSchema.d.ts +186 -0
- package/dist/CloudflareSchema.d.ts.map +1 -0
- package/dist/CloudflareSchema.js +128 -0
- package/dist/CloudflareSchema.js.map +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/errors.d.ts +7 -0
- package/dist/internal/errors.d.ts.map +1 -0
- package/dist/internal/errors.js +109 -0
- package/dist/internal/errors.js.map +1 -0
- package/package.json +58 -3
- package/src/CloudflareClient.ts +149 -0
- package/src/CloudflareDecisionModel.ts +111 -0
- package/src/CloudflareSchema.ts +131 -0
- package/src/index.ts +23 -0
- package/src/internal/errors.ts +101 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloudflareDecisionModel.js","names":[],"sources":["../src/CloudflareDecisionModel.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;AAMA,OAAO,KAAK,aAAa,MAAM,yBAAyB;AACxD,OAAO,KAAK,OAAO,MAAM,iBAAiB;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc;AACrC,SAAS,gBAAgB,QAAQ,uBAAuB;AAYxD;;;;;;;AAOA,OAAO,MAAM,KAAK,GAChB,KAAY,IAEZ,OAAO,CAAC,IAAI,CAAC,YAAY,EAAE,KAAK,EAAE,KAAK,CAAC;EAAE;AAAK,CAAE,CAAC,CAAC;AAErD;;;;;;;AAOA,OAAO,MAAM,IAAI,gBAAG,MAAM,CAAC,UAAU,CACnC,WACE,OAAkC;EAElC,MAAM,MAAM,GAAG,OAAO,gBAAgB;EACtC,OAAO,OAAO,aAAa,CAAC,IAAI,CAAC;IAC/B,oBAAoB,EAAE,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,WAAU;MAAE,KAAK;MAAE;IAAS,CAAE;MACtD,MAAM,SAAS,GAA6D,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;MAC/F,KAAK,MAAM,CAAC,GAAG,EAAE,QAAQ,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;QACvD,QAAQ,QAAQ,CAAC,IAAI;UACnB,KAAK,UAAU;YACb,SAAS,CAAC,GAAG,CAAC,GAAG;cAAE,IAAI,EAAE,QAAQ;cAAE,YAAY,EAAE,QAAQ,CAAC,YAAY;cAAE,QAAQ,EAAE,QAAQ,CAAC;YAAQ,CAAE;YACrG;UACF,KAAK,MAAM;YACT,SAAS,CAAC,GAAG,CAAC,GAAG;cAAE,IAAI,EAAE,OAAO;cAAE,YAAY,EAAE,QAAQ,CAAC,YAA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,GAAG,WAAW;cAC3E;cACA,OAAO,CAAC,GAAG,CAAC,GAAG;gBAAE,IAAI,EAAE,MAAM;gBAAE,MAAM,EAAE,MAAM,CAAC,KAAK;gBAAE,aAAa;gBAAE,UAAU,EAAE,MAAM,CAAC;cAAU,CAAE;cACnG;YACF;UACA,KAAK,MAAM;YACT,OAAO,CAAC,GAAG,CAAC,GAAG;cAAE,IAAI,EAAE,aAAa;cAAE,WAAW,EAAE,MAAM,CAAC;YAAI,CAAE;YAChE;QACJ;MACF;MACA,OAAO;QACL,OAAO;QACP,KAAK,EAAE;UAAE,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,YAAY;UAAE,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC;QAAa;OAC9F;IACH,CAAC;GACF,CAAC;AACJ,CAAC,CACF;AAED;;;;;;;AAOA,OAAO,MAAM,KAAK,GAChB,OAAkC,IAElC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codecs for text and JSON decisions from Cloudflare Clef models.
|
|
3
|
+
*
|
|
4
|
+
* @stability unstable
|
|
5
|
+
* @since 4.0.0
|
|
6
|
+
*/
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
/**
|
|
9
|
+
* A classification question.
|
|
10
|
+
*
|
|
11
|
+
* @stability unstable
|
|
12
|
+
* @category schemas
|
|
13
|
+
* @since 4.0.0
|
|
14
|
+
*/
|
|
15
|
+
export declare const ChoiceQuestion: Schema.Struct<{
|
|
16
|
+
readonly type: Schema.Literal<"choice">;
|
|
17
|
+
readonly instructions: Schema.String;
|
|
18
|
+
readonly criteria: Schema.$Record<Schema.String, Schema.String>;
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* An ordered rating question.
|
|
22
|
+
*
|
|
23
|
+
* @stability unstable
|
|
24
|
+
* @category schemas
|
|
25
|
+
* @since 4.0.0
|
|
26
|
+
*/
|
|
27
|
+
export declare const ScoreQuestion: Schema.Struct<{
|
|
28
|
+
readonly type: Schema.Literal<"score">;
|
|
29
|
+
readonly instructions: Schema.String;
|
|
30
|
+
readonly criteria: Schema.$Array<Schema.String>;
|
|
31
|
+
}>;
|
|
32
|
+
/**
|
|
33
|
+
* A probability question.
|
|
34
|
+
*
|
|
35
|
+
* @stability unstable
|
|
36
|
+
* @category schemas
|
|
37
|
+
* @since 4.0.0
|
|
38
|
+
*/
|
|
39
|
+
export declare const NoulQuestion: Schema.Struct<{
|
|
40
|
+
readonly type: Schema.Literal<"noul">;
|
|
41
|
+
readonly instructions: Schema.String;
|
|
42
|
+
readonly criteria: Schema.optional<Schema.Struct<{
|
|
43
|
+
readonly false: Schema.String;
|
|
44
|
+
readonly true: Schema.String;
|
|
45
|
+
}>>;
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* A Clef classification, rating, or probability question.
|
|
49
|
+
*
|
|
50
|
+
* @stability unstable
|
|
51
|
+
* @category schemas
|
|
52
|
+
* @since 4.0.0
|
|
53
|
+
*/
|
|
54
|
+
export declare const Question: Schema.Union<readonly [Schema.Struct<{
|
|
55
|
+
readonly type: Schema.Literal<"choice">;
|
|
56
|
+
readonly instructions: Schema.String;
|
|
57
|
+
readonly criteria: Schema.$Record<Schema.String, Schema.String>;
|
|
58
|
+
}>, Schema.Struct<{
|
|
59
|
+
readonly type: Schema.Literal<"score">;
|
|
60
|
+
readonly instructions: Schema.String;
|
|
61
|
+
readonly criteria: Schema.$Array<Schema.String>;
|
|
62
|
+
}>, Schema.Struct<{
|
|
63
|
+
readonly type: Schema.Literal<"noul">;
|
|
64
|
+
readonly instructions: Schema.String;
|
|
65
|
+
readonly criteria: Schema.optional<Schema.Struct<{
|
|
66
|
+
readonly false: Schema.String;
|
|
67
|
+
readonly true: Schema.String;
|
|
68
|
+
}>>;
|
|
69
|
+
}>]>;
|
|
70
|
+
/**
|
|
71
|
+
* A batch of questions about text or JSON state.
|
|
72
|
+
*
|
|
73
|
+
* @stability unstable
|
|
74
|
+
* @category schemas
|
|
75
|
+
* @since 4.0.0
|
|
76
|
+
*/
|
|
77
|
+
export declare const DecisionsRequest: Schema.Struct<{
|
|
78
|
+
readonly model: Schema.Union<readonly [Schema.Literals<readonly ["clef", "clef-flash"]>, Schema.StringForLiteralAutocomplete]>;
|
|
79
|
+
readonly state: Schema.Codec<Schema.Json, Schema.Json, never, never>;
|
|
80
|
+
readonly questions: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
|
|
81
|
+
readonly type: Schema.Literal<"choice">;
|
|
82
|
+
readonly instructions: Schema.String;
|
|
83
|
+
readonly criteria: Schema.$Record<Schema.String, Schema.String>;
|
|
84
|
+
}>, Schema.Struct<{
|
|
85
|
+
readonly type: Schema.Literal<"score">;
|
|
86
|
+
readonly instructions: Schema.String;
|
|
87
|
+
readonly criteria: Schema.$Array<Schema.String>;
|
|
88
|
+
}>, Schema.Struct<{
|
|
89
|
+
readonly type: Schema.Literal<"noul">;
|
|
90
|
+
readonly instructions: Schema.String;
|
|
91
|
+
readonly criteria: Schema.optional<Schema.Struct<{
|
|
92
|
+
readonly false: Schema.String;
|
|
93
|
+
readonly true: Schema.String;
|
|
94
|
+
}>>;
|
|
95
|
+
}>]>>;
|
|
96
|
+
}>;
|
|
97
|
+
/**
|
|
98
|
+
* A classification distribution.
|
|
99
|
+
*
|
|
100
|
+
* @stability unstable
|
|
101
|
+
* @category schemas
|
|
102
|
+
* @since 4.0.0
|
|
103
|
+
*/
|
|
104
|
+
export declare const ChoiceAnswer: Schema.Struct<{
|
|
105
|
+
readonly type: Schema.Literal<"choice">;
|
|
106
|
+
readonly choice: Schema.String;
|
|
107
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
108
|
+
readonly confidence: Schema.Number;
|
|
109
|
+
}>;
|
|
110
|
+
/**
|
|
111
|
+
* A zero-based rating and index-keyed distribution.
|
|
112
|
+
*
|
|
113
|
+
* @stability unstable
|
|
114
|
+
* @category schemas
|
|
115
|
+
* @since 4.0.0
|
|
116
|
+
*/
|
|
117
|
+
export declare const ScoreAnswer: Schema.Struct<{
|
|
118
|
+
readonly type: Schema.Literal<"score">;
|
|
119
|
+
readonly score: Schema.Number;
|
|
120
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
121
|
+
readonly confidence: Schema.Number;
|
|
122
|
+
readonly legend: Schema.$Record<Schema.String, Schema.String>;
|
|
123
|
+
}>;
|
|
124
|
+
/**
|
|
125
|
+
* A Bernoulli probability.
|
|
126
|
+
*
|
|
127
|
+
* @stability unstable
|
|
128
|
+
* @category schemas
|
|
129
|
+
* @since 4.0.0
|
|
130
|
+
*/
|
|
131
|
+
export declare const NoulAnswer: Schema.Struct<{
|
|
132
|
+
readonly type: Schema.Literal<"noul">;
|
|
133
|
+
readonly noul: Schema.Number;
|
|
134
|
+
}>;
|
|
135
|
+
/**
|
|
136
|
+
* A Clef classification, rating, or probability answer.
|
|
137
|
+
*
|
|
138
|
+
* @stability unstable
|
|
139
|
+
* @category schemas
|
|
140
|
+
* @since 4.0.0
|
|
141
|
+
*/
|
|
142
|
+
export declare const Answer: Schema.Union<readonly [Schema.Struct<{
|
|
143
|
+
readonly type: Schema.Literal<"choice">;
|
|
144
|
+
readonly choice: Schema.String;
|
|
145
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
146
|
+
readonly confidence: Schema.Number;
|
|
147
|
+
}>, Schema.Struct<{
|
|
148
|
+
readonly type: Schema.Literal<"score">;
|
|
149
|
+
readonly score: Schema.Number;
|
|
150
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
151
|
+
readonly confidence: Schema.Number;
|
|
152
|
+
readonly legend: Schema.$Record<Schema.String, Schema.String>;
|
|
153
|
+
}>, Schema.Struct<{
|
|
154
|
+
readonly type: Schema.Literal<"noul">;
|
|
155
|
+
readonly noul: Schema.Number;
|
|
156
|
+
}>]>;
|
|
157
|
+
/**
|
|
158
|
+
* Answers and token usage for a batch.
|
|
159
|
+
*
|
|
160
|
+
* @stability unstable
|
|
161
|
+
* @category schemas
|
|
162
|
+
* @since 4.0.0
|
|
163
|
+
*/
|
|
164
|
+
export declare const DecisionsResponse: Schema.Struct<{
|
|
165
|
+
readonly model: Schema.String;
|
|
166
|
+
readonly answers: Schema.$Record<Schema.String, Schema.Union<readonly [Schema.Struct<{
|
|
167
|
+
readonly type: Schema.Literal<"choice">;
|
|
168
|
+
readonly choice: Schema.String;
|
|
169
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
170
|
+
readonly confidence: Schema.Number;
|
|
171
|
+
}>, Schema.Struct<{
|
|
172
|
+
readonly type: Schema.Literal<"score">;
|
|
173
|
+
readonly score: Schema.Number;
|
|
174
|
+
readonly probabilities: Schema.$Record<Schema.String, Schema.Number>;
|
|
175
|
+
readonly confidence: Schema.Number;
|
|
176
|
+
readonly legend: Schema.$Record<Schema.String, Schema.String>;
|
|
177
|
+
}>, Schema.Struct<{
|
|
178
|
+
readonly type: Schema.Literal<"noul">;
|
|
179
|
+
readonly noul: Schema.Number;
|
|
180
|
+
}>]>>;
|
|
181
|
+
readonly usage: Schema.Struct<{
|
|
182
|
+
readonly input_tokens: Schema.Int;
|
|
183
|
+
readonly output_tokens: Schema.Int;
|
|
184
|
+
}>;
|
|
185
|
+
}>;
|
|
186
|
+
//# sourceMappingURL=CloudflareSchema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloudflareSchema.d.ts","sourceRoot":"","sources":["../src/CloudflareSchema.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,cAAc;;;;EAIzB,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,aAAa;;;;EAIxB,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;;;EAIvB,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;IAA8D,CAAA;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;EAI3B,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY;;;;;EAKvB,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;;;;;EAMtB,CAAA;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,UAAU;;;EAAuE,CAAA;AAE9F;;;;;;GAMG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;IAAwD,CAAA;AAE3E;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;EAO5B,CAAA"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codecs for text and JSON decisions from Cloudflare Clef models.
|
|
3
|
+
*
|
|
4
|
+
* @stability unstable
|
|
5
|
+
* @since 4.0.0
|
|
6
|
+
*/
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
/**
|
|
9
|
+
* A classification question.
|
|
10
|
+
*
|
|
11
|
+
* @stability unstable
|
|
12
|
+
* @category schemas
|
|
13
|
+
* @since 4.0.0
|
|
14
|
+
*/
|
|
15
|
+
export const ChoiceQuestion = /*#__PURE__*/Schema.Struct({
|
|
16
|
+
type: /*#__PURE__*/Schema.Literal("choice"),
|
|
17
|
+
instructions: Schema.String,
|
|
18
|
+
criteria: /*#__PURE__*/Schema.Record(Schema.String, Schema.String)
|
|
19
|
+
});
|
|
20
|
+
/**
|
|
21
|
+
* An ordered rating question.
|
|
22
|
+
*
|
|
23
|
+
* @stability unstable
|
|
24
|
+
* @category schemas
|
|
25
|
+
* @since 4.0.0
|
|
26
|
+
*/
|
|
27
|
+
export const ScoreQuestion = /*#__PURE__*/Schema.Struct({
|
|
28
|
+
type: /*#__PURE__*/Schema.Literal("score"),
|
|
29
|
+
instructions: Schema.String,
|
|
30
|
+
criteria: /*#__PURE__*/Schema.Array(Schema.String)
|
|
31
|
+
});
|
|
32
|
+
/**
|
|
33
|
+
* A probability question.
|
|
34
|
+
*
|
|
35
|
+
* @stability unstable
|
|
36
|
+
* @category schemas
|
|
37
|
+
* @since 4.0.0
|
|
38
|
+
*/
|
|
39
|
+
export const NoulQuestion = /*#__PURE__*/Schema.Struct({
|
|
40
|
+
type: /*#__PURE__*/Schema.Literal("noul"),
|
|
41
|
+
instructions: Schema.String,
|
|
42
|
+
criteria: /*#__PURE__*/Schema.optional(/*#__PURE__*/Schema.Struct({
|
|
43
|
+
false: Schema.String,
|
|
44
|
+
true: Schema.String
|
|
45
|
+
}))
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* A Clef classification, rating, or probability question.
|
|
49
|
+
*
|
|
50
|
+
* @stability unstable
|
|
51
|
+
* @category schemas
|
|
52
|
+
* @since 4.0.0
|
|
53
|
+
*/
|
|
54
|
+
export const Question = /*#__PURE__*/Schema.Union([ChoiceQuestion, ScoreQuestion, NoulQuestion]);
|
|
55
|
+
/**
|
|
56
|
+
* A batch of questions about text or JSON state.
|
|
57
|
+
*
|
|
58
|
+
* @stability unstable
|
|
59
|
+
* @category schemas
|
|
60
|
+
* @since 4.0.0
|
|
61
|
+
*/
|
|
62
|
+
export const DecisionsRequest = /*#__PURE__*/Schema.Struct({
|
|
63
|
+
model: /*#__PURE__*/Schema.Union([/*#__PURE__*/Schema.Literals(["clef", "clef-flash"]), Schema.StringForLiteralAutocomplete]),
|
|
64
|
+
state: Schema.Json,
|
|
65
|
+
questions: /*#__PURE__*/Schema.Record(Schema.String, Question)
|
|
66
|
+
});
|
|
67
|
+
/**
|
|
68
|
+
* A classification distribution.
|
|
69
|
+
*
|
|
70
|
+
* @stability unstable
|
|
71
|
+
* @category schemas
|
|
72
|
+
* @since 4.0.0
|
|
73
|
+
*/
|
|
74
|
+
export const ChoiceAnswer = /*#__PURE__*/Schema.Struct({
|
|
75
|
+
type: /*#__PURE__*/Schema.Literal("choice"),
|
|
76
|
+
choice: Schema.String,
|
|
77
|
+
probabilities: /*#__PURE__*/Schema.Record(Schema.String, Schema.Number),
|
|
78
|
+
confidence: Schema.Number
|
|
79
|
+
});
|
|
80
|
+
/**
|
|
81
|
+
* A zero-based rating and index-keyed distribution.
|
|
82
|
+
*
|
|
83
|
+
* @stability unstable
|
|
84
|
+
* @category schemas
|
|
85
|
+
* @since 4.0.0
|
|
86
|
+
*/
|
|
87
|
+
export const ScoreAnswer = /*#__PURE__*/Schema.Struct({
|
|
88
|
+
type: /*#__PURE__*/Schema.Literal("score"),
|
|
89
|
+
score: Schema.Number,
|
|
90
|
+
probabilities: /*#__PURE__*/Schema.Record(Schema.String, Schema.Number),
|
|
91
|
+
confidence: Schema.Number,
|
|
92
|
+
legend: /*#__PURE__*/Schema.Record(Schema.String, Schema.String)
|
|
93
|
+
});
|
|
94
|
+
/**
|
|
95
|
+
* A Bernoulli probability.
|
|
96
|
+
*
|
|
97
|
+
* @stability unstable
|
|
98
|
+
* @category schemas
|
|
99
|
+
* @since 4.0.0
|
|
100
|
+
*/
|
|
101
|
+
export const NoulAnswer = /*#__PURE__*/Schema.Struct({
|
|
102
|
+
type: /*#__PURE__*/Schema.Literal("noul"),
|
|
103
|
+
noul: Schema.Number
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* A Clef classification, rating, or probability answer.
|
|
107
|
+
*
|
|
108
|
+
* @stability unstable
|
|
109
|
+
* @category schemas
|
|
110
|
+
* @since 4.0.0
|
|
111
|
+
*/
|
|
112
|
+
export const Answer = /*#__PURE__*/Schema.Union([ChoiceAnswer, ScoreAnswer, NoulAnswer]);
|
|
113
|
+
/**
|
|
114
|
+
* Answers and token usage for a batch.
|
|
115
|
+
*
|
|
116
|
+
* @stability unstable
|
|
117
|
+
* @category schemas
|
|
118
|
+
* @since 4.0.0
|
|
119
|
+
*/
|
|
120
|
+
export const DecisionsResponse = /*#__PURE__*/Schema.Struct({
|
|
121
|
+
model: Schema.String,
|
|
122
|
+
answers: /*#__PURE__*/Schema.Record(Schema.String, Answer),
|
|
123
|
+
usage: /*#__PURE__*/Schema.Struct({
|
|
124
|
+
input_tokens: Schema.Int,
|
|
125
|
+
output_tokens: Schema.Int
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=CloudflareSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CloudflareSchema.js","names":[],"sources":["../src/CloudflareSchema.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;;AAMA,OAAO,KAAK,MAAM,MAAM,eAAe;AAEvC;;;;;;;AAOA,OAAO,MAAM,cAAc,gBAAG,MAAM,CAAC,MAAM,CAAC;EAC1C,IAAI,eAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC;EAC9B,YAAY,EAAE,MAAM,CAAC,MAAM;EAC3B,QAAQ,eAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM;CACrD,CAAC;AAEF;;;;;;;AAOA,OAAO,MAAM,aAAa,gBAAG,MAAM,CAAC,MAAM,CAAC;EACzC,IAAI,eAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;EAC7B,YAAY,EAAE,MAAM,CAAC,MAAM;EAC3B,QAAQ,eAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM;CACrC,CAAC;AAEF;;;;;;;AAOA,OAAO,MAAM,YAAY,gBAAG,MAAM,CAAC,MAAM,CAAC;EACxC,IAAI,eAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;EAC5B,YAAY,EAAE,MAAM,CAAC,MAAM;EAC3B,QAAQ,eAAE,MAAM,CAAC,QAAQ,cAAC,MAAM,CAAC,MAAM,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC,MAAM;IAA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,gBAAG,MAAM,CAAC,MAAM,CAAC;EAAE,IAAI,eAAE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;EAAE,IAAI,EAAE,MAAM,CAAC;AAAM,CAAE,CAAC;AAE9F;;;;;;;AAOA,OAAO,MAAM,MAAM,gBAAG,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,WAAW,EAAE,UAAU,CAAC,CAAC;AAE3E;;;;;;;AAOA,OAAO,MAAM,iBAAiB,gBAAG,MAAM,CAAC,MAAM,CAAC;EAC7C,KAAK,EAAE,MAAM,CAAC,MAAM;EACpB,OAAO,eAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;EAC7C,KAAK,eAAE,MAAM,CAAC,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC,GAAG;IACxB,aAAa,EAAE,MAAM,CAAC;GACvB;CACF,CAAC","ignoreList":[]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 4.0.0
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @stability unstable
|
|
6
|
+
* @since 4.0.0
|
|
7
|
+
*/
|
|
8
|
+
export * as CloudflareClient from "./CloudflareClient.ts";
|
|
9
|
+
/**
|
|
10
|
+
* @stability unstable
|
|
11
|
+
* @since 4.0.0
|
|
12
|
+
*/
|
|
13
|
+
export * as CloudflareDecisionModel from "./CloudflareDecisionModel.ts";
|
|
14
|
+
/**
|
|
15
|
+
* @stability unstable
|
|
16
|
+
* @since 4.0.0
|
|
17
|
+
*/
|
|
18
|
+
export * as CloudflareSchema from "./CloudflareSchema.ts";
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;GAGG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA;AAEzD;;;GAGG;AACH,OAAO,KAAK,uBAAuB,MAAM,8BAA8B,CAAA;AAEvE;;;GAGG;AACH,OAAO,KAAK,gBAAgB,MAAM,uBAAuB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @since 4.0.0
|
|
3
|
+
*/
|
|
4
|
+
// @barrel
|
|
5
|
+
/**
|
|
6
|
+
* @stability unstable
|
|
7
|
+
* @since 4.0.0
|
|
8
|
+
*/
|
|
9
|
+
export * as CloudflareClient from "./CloudflareClient.js";
|
|
10
|
+
/**
|
|
11
|
+
* @stability unstable
|
|
12
|
+
* @since 4.0.0
|
|
13
|
+
*/
|
|
14
|
+
export * as CloudflareDecisionModel from "./CloudflareDecisionModel.js";
|
|
15
|
+
/**
|
|
16
|
+
* @stability unstable
|
|
17
|
+
* @since 4.0.0
|
|
18
|
+
*/
|
|
19
|
+
export * as CloudflareSchema from "./CloudflareSchema.js";
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAIA;AAEA;;;;AAIA,OAAO,KAAK,gBAAgB,MAAM,uBAAuB;AAEzD;;;;AAIA,OAAO,KAAK,uBAAuB,MAAM,8BAA8B;AAEvE;;;;AAIA,OAAO,KAAK,gBAAgB,MAAM,uBAAuB","ignoreList":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as AiError from "effect/ai/AiError";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
4
|
+
import type * as HttpClientResponse from "effect/http/HttpClientResponse";
|
|
5
|
+
export declare const mapResponseError: (response: HttpClientResponse.HttpClientResponse) => Effect.Effect<never, AiError.AiError, never>;
|
|
6
|
+
export declare const mapHttpClientError: (error: HttpClientError.HttpClientError) => Effect.Effect<never, AiError.AiError, never>;
|
|
7
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/internal/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,mBAAmB,CAAA;AAE5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,eAAe,MAAM,6BAA6B,CAAA;AAEnE,OAAO,KAAK,KAAK,kBAAkB,MAAM,gCAAgC,CAAA;AA+BzE,eAAO,MAAM,gBAAgB,mGAqC5B,CAAA;AAED,eAAO,MAAM,kBAAkB,0FAyB9B,CAAA"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import * as AiError from "effect/ai/AiError";
|
|
2
|
+
import * as Duration from "effect/Duration";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Num from "effect/Number";
|
|
5
|
+
import * as Option from "effect/Option";
|
|
6
|
+
import * as Redactable from "effect/Redactable";
|
|
7
|
+
import * as Schema from "effect/Schema";
|
|
8
|
+
const requestDetails = request => ({
|
|
9
|
+
method: request.method,
|
|
10
|
+
url: request.url,
|
|
11
|
+
urlParams: Array.from(request.urlParams),
|
|
12
|
+
hash: Option.getOrUndefined(request.hash),
|
|
13
|
+
headers: Redactable.redact(request.headers)
|
|
14
|
+
});
|
|
15
|
+
const ErrorBody = /*#__PURE__*/Schema.Struct({
|
|
16
|
+
errors: /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Struct({
|
|
17
|
+
code: Schema.Number,
|
|
18
|
+
message: Schema.String
|
|
19
|
+
}))
|
|
20
|
+
});
|
|
21
|
+
const decodeErrorBody = /*#__PURE__*/Schema.decodeUnknownOption(ErrorBody);
|
|
22
|
+
const retryAfter = raw => {
|
|
23
|
+
if (raw === undefined || raw.trim() === "") return undefined;
|
|
24
|
+
const seconds = Option.getOrUndefined(Num.parse(raw));
|
|
25
|
+
if (seconds !== undefined) return Number.isFinite(seconds) && seconds >= 0 ? Duration.seconds(seconds) : undefined;
|
|
26
|
+
const date = Date.parse(raw);
|
|
27
|
+
return Number.isNaN(date) ? undefined : Duration.millis(Math.max(0, date - Date.now()));
|
|
28
|
+
};
|
|
29
|
+
const fail = reason => Effect.fail(AiError.make({
|
|
30
|
+
module: "CloudflareClient",
|
|
31
|
+
method: "createDecisions",
|
|
32
|
+
reason
|
|
33
|
+
}));
|
|
34
|
+
export const mapResponseError = /*#__PURE__*/Effect.fnUntraced(function* (response) {
|
|
35
|
+
const {
|
|
36
|
+
request,
|
|
37
|
+
status
|
|
38
|
+
} = response;
|
|
39
|
+
const body = yield* response.text.pipe(Effect.orElseSucceed(() => undefined));
|
|
40
|
+
const parsed = yield* Effect.try(() => JSON.parse(body ?? "")).pipe(Effect.orElseSucceed(() => undefined));
|
|
41
|
+
const details = Option.getOrUndefined(decodeErrorBody(parsed));
|
|
42
|
+
const http = {
|
|
43
|
+
request: requestDetails(request),
|
|
44
|
+
response: {
|
|
45
|
+
status,
|
|
46
|
+
headers: Redactable.redact(response.headers)
|
|
47
|
+
},
|
|
48
|
+
body
|
|
49
|
+
};
|
|
50
|
+
const description = AiError.buildErrorDescription({
|
|
51
|
+
status,
|
|
52
|
+
method: request.method,
|
|
53
|
+
url: request.url,
|
|
54
|
+
body,
|
|
55
|
+
message: details?.errors.map(error => error.message).join("; "),
|
|
56
|
+
errorCode: details?.errors[0]?.code,
|
|
57
|
+
requestId: response.headers["cf-ray"]
|
|
58
|
+
});
|
|
59
|
+
if (status === 429) {
|
|
60
|
+
return yield* fail(new AiError.RateLimitError({
|
|
61
|
+
retryAfter: retryAfter(response.headers["retry-after"]),
|
|
62
|
+
http,
|
|
63
|
+
metadata: {
|
|
64
|
+
cloudflare: {
|
|
65
|
+
rayId: response.headers["cf-ray"] ?? null,
|
|
66
|
+
errors: details?.errors ?? []
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
if (status === 404 || status === 422) {
|
|
72
|
+
return yield* fail(new AiError.InvalidRequestError({
|
|
73
|
+
description,
|
|
74
|
+
http
|
|
75
|
+
}));
|
|
76
|
+
}
|
|
77
|
+
if (status >= 200 && status < 300) {
|
|
78
|
+
return yield* fail(new AiError.InternalProviderError({
|
|
79
|
+
description,
|
|
80
|
+
http
|
|
81
|
+
}));
|
|
82
|
+
}
|
|
83
|
+
return yield* fail(AiError.reasonFromHttpStatus({
|
|
84
|
+
status,
|
|
85
|
+
description,
|
|
86
|
+
http
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
export const mapHttpClientError = /*#__PURE__*/Effect.fnUntraced(function* (error) {
|
|
90
|
+
const source = error.reason;
|
|
91
|
+
switch (source._tag) {
|
|
92
|
+
case "TransportError":
|
|
93
|
+
case "EncodeError":
|
|
94
|
+
case "InvalidUrlError":
|
|
95
|
+
return yield* fail(new AiError.NetworkError({
|
|
96
|
+
reason: source._tag,
|
|
97
|
+
description: source.description,
|
|
98
|
+
request: requestDetails(source.request)
|
|
99
|
+
}));
|
|
100
|
+
case "DecodeError":
|
|
101
|
+
case "EmptyBodyError":
|
|
102
|
+
return yield* fail(new AiError.InvalidOutputError({
|
|
103
|
+
description: source.description ?? "Failed to decode Cloudflare response"
|
|
104
|
+
}));
|
|
105
|
+
case "StatusCodeError":
|
|
106
|
+
return yield* mapResponseError(source.response);
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../../src/internal/errors.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,mBAAmB;AAC5C,OAAO,KAAK,QAAQ,MAAM,iBAAiB;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe;AAIvC,OAAO,KAAK,GAAG,MAAM,eAAe;AACpC,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M,CAAC,IAAI;QACnB,WAAW,EAAE,MAAM,CAAC,WAAW;QAC/B,OAAO,EAAE,cAAc,CAAC,MAAM,CAAC,OAAO;OACvC,CAAC,CACH;IACH,KAAK,aAAa;IAClB,KAAK,gBAAgB;MACnB,OAAO,OAAO,IAAI,CAChB,IAAI,OAAO,CAAC,kBAAkB,CAAC;QAC7B,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI;OACpC,CAAC,CACH;IACH,KAAK,iBAAiB;MACpB,OAAO,OAAO,gBAAgB,CAAC,MAAM,CAAC,QAAQ,CAAC;EACnD;AACF,CAAC,CACF","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,61 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@effect/ai-cloudflare",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"version": "4.0.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "A Cloudflare Workers AI decision provider for Effect",
|
|
7
|
+
"homepage": "https://effect.website",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/Effect-TS/effect.git",
|
|
11
|
+
"directory": "packages/ai/cloudflare"
|
|
12
|
+
},
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/Effect-TS/effect/issues"
|
|
15
|
+
},
|
|
16
|
+
"tags": [
|
|
17
|
+
"typescript",
|
|
18
|
+
"ai",
|
|
19
|
+
"cloudflare"
|
|
20
|
+
],
|
|
21
|
+
"keywords": [
|
|
22
|
+
"typescript",
|
|
23
|
+
"ai",
|
|
24
|
+
"cloudflare"
|
|
25
|
+
],
|
|
26
|
+
"sideEffects": [],
|
|
27
|
+
"exports": {
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
".": "./dist/index.js",
|
|
30
|
+
"./*": "./dist/*.js",
|
|
31
|
+
"./internal/*": null,
|
|
32
|
+
"./index": null,
|
|
33
|
+
"./*/index": null
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"src/**/*.ts",
|
|
37
|
+
"dist/**/*.js",
|
|
38
|
+
"dist/**/*.js.map",
|
|
39
|
+
"dist/**/*.d.ts",
|
|
40
|
+
"dist/**/*.d.ts.map",
|
|
41
|
+
"AGENTS.md",
|
|
42
|
+
"CLAUDE.md",
|
|
43
|
+
"ai-docs/**/*"
|
|
44
|
+
],
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public",
|
|
47
|
+
"provenance": true
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"effect": "^4.0.1"
|
|
51
|
+
},
|
|
52
|
+
"peerDependencies": {
|
|
53
|
+
"effect": "^4.0.1"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"codegen": "effect-utils codegen",
|
|
57
|
+
"build": "tsc -b tsconfig.json && pnpm babel",
|
|
58
|
+
"babel": "babel dist --plugins annotate-pure-calls --out-dir dist --source-maps",
|
|
59
|
+
"check": "tsc -b tsconfig.json"
|
|
60
|
+
}
|
|
6
61
|
}
|