liminal 0.14.0 → 0.15.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/CHANGELOG.md +7 -0
- package/Strand.ts +11 -6
- package/assistant.ts +1 -1
- package/assistantStream.ts +1 -1
- package/disable.ts +2 -3
- package/dist/Strand.d.ts +10 -5
- package/dist/Strand.js.map +1 -1
- package/dist/assistant.js +1 -1
- package/dist/assistant.js.map +1 -1
- package/dist/assistantStream.js +1 -1
- package/dist/assistantStream.js.map +1 -1
- package/dist/disable.d.ts +1 -2
- package/dist/disable.js +2 -2
- package/dist/disable.js.map +1 -1
- package/dist/enable.d.ts +3 -3
- package/dist/enable.js +0 -1
- package/dist/enable.js.map +1 -1
- package/dist/patterns/coalesce_models.d.ts +6 -0
- package/dist/patterns/coalesce_models.js +15 -0
- package/dist/patterns/coalesce_models.js.map +1 -0
- package/dist/patterns/{matchGist.js → match_gist.js} +1 -1
- package/dist/patterns/match_gist.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/enable.ts +10 -6
- package/package.json +3 -2
- package/patterns/coalesce_models.ts +30 -0
- package/dist/patterns/index.d.ts +0 -1
- package/dist/patterns/index.js +0 -2
- package/dist/patterns/index.js.map +0 -1
- package/dist/patterns/matchGist.js.map +0 -1
- package/patterns/index.ts +0 -1
- /package/dist/patterns/{matchGist.d.ts → match_gist.d.ts} +0 -0
- /package/patterns/{matchGist.ts → match_gist.ts} +0 -0
package/enable.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { AiToolkit } from "@effect/ai/AiToolkit"
|
|
1
|
+
import type { AiTool, AnyStructSchema, Handler } from "@effect/ai/AiTool"
|
|
3
2
|
import * as Effect from "effect/Effect"
|
|
3
|
+
import type { Schema } from "effect/Schema"
|
|
4
4
|
import { Strand } from "./Strand.ts"
|
|
5
5
|
|
|
6
|
-
export const enable: <
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
export const enable: <
|
|
7
|
+
K extends string,
|
|
8
|
+
E extends Schema.All,
|
|
9
|
+
R,
|
|
10
|
+
>(
|
|
11
|
+
toolkit: AiTool<K, AnyStructSchema, Schema.Any, E, R>,
|
|
12
|
+
) => Effect.Effect<void, E, Handler<K> | Strand | R> = (toolkit) =>
|
|
9
13
|
Effect.map(Strand, ({ tools }) => {
|
|
10
|
-
tools.add(toolkit)
|
|
14
|
+
tools.add(toolkit as never)
|
|
11
15
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "liminal",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/harrysolovay/liminal.git",
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
"exports": {
|
|
14
14
|
".": "./index.ts",
|
|
15
15
|
"./package.json": "./package.json",
|
|
16
|
-
"./patterns": "./patterns/
|
|
16
|
+
"./patterns/coalesce_models": "./patterns/coalesce_models.ts",
|
|
17
|
+
"./patterns/match_gist": "./patterns/match_gist.ts"
|
|
17
18
|
},
|
|
18
19
|
"description": "An Effect AI toolkit for conversation state management.",
|
|
19
20
|
"homepage": "https://liminal.land",
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AiError } from "@effect/ai/AiError"
|
|
2
|
+
import type { AiLanguageModel } from "@effect/ai/AiLanguageModel"
|
|
3
|
+
import type { AiModel } from "@effect/ai/AiModel"
|
|
4
|
+
import * as Effect from "effect/Effect"
|
|
5
|
+
import { assistant } from "../assistant.ts"
|
|
6
|
+
import type { Strand } from "../Strand.ts"
|
|
7
|
+
import { user } from "../user.ts"
|
|
8
|
+
|
|
9
|
+
export const coalesceModels: <E, R, M extends Array<AiModel<any, any>>>(
|
|
10
|
+
effect: Effect.Effect<any, E, R>,
|
|
11
|
+
models: M,
|
|
12
|
+
) => Effect.Effect<
|
|
13
|
+
string,
|
|
14
|
+
AiError | E,
|
|
15
|
+
Strand | AiLanguageModel | ([M[number]] extends [AiModel<any, infer R>] ? R : never)
|
|
16
|
+
> = Effect.fn(
|
|
17
|
+
function*(effect, models) {
|
|
18
|
+
const all = yield* Effect.all(models.map((model) => effect.pipe(Effect.provide(model)))) as Effect.Effect<
|
|
19
|
+
Array<unknown>
|
|
20
|
+
>
|
|
21
|
+
yield* user`
|
|
22
|
+
Coalesce the following items into a single item:
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
${all.map((item) => JSON.stringify(item, null, 2)).join("\n\n---")}
|
|
27
|
+
`
|
|
28
|
+
return yield* assistant
|
|
29
|
+
},
|
|
30
|
+
)
|
package/dist/patterns/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./matchGist.ts";
|
package/dist/patterns/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../patterns/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"matchGist.js","sourceRoot":"","sources":["../../patterns/matchGist.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAA;AAEjC,MAAM,CAAC,MAAM,SAAS,GAIlB,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAC,MAAM;IACpC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxC,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,MAAM,CAC/B,IAAI,CAAA;;;UAGE,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC;KAC9B,EACD,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,YAAY,CAAC,CAAC,CACjD,CAAA;IACD,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,WAAW,CAAE,CAAA;AACpC,CAAC,CAAC,CAAA"}
|
package/patterns/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./matchGist.ts"
|
|
File without changes
|
|
File without changes
|