@fastpaca/cria 1.2.0 → 1.4.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/README.md +29 -7
- package/dist/components/summary.d.ts +12 -13
- package/dist/components/summary.d.ts.map +1 -1
- package/dist/components/summary.js +26 -26
- package/dist/components/summary.js.map +1 -1
- package/dist/components/vector-search.d.ts +8 -3
- package/dist/components/vector-search.d.ts.map +1 -1
- package/dist/components/vector-search.js.map +1 -1
- package/dist/dsl.d.ts +117 -85
- package/dist/dsl.d.ts.map +1 -1
- package/dist/dsl.js +232 -124
- package/dist/dsl.js.map +1 -1
- package/dist/eval/index.d.ts +38 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +34 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/judge.d.ts +19 -0
- package/dist/eval/judge.d.ts.map +1 -0
- package/dist/eval/judge.js +46 -0
- package/dist/eval/judge.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/dist/integrations/ai-sdk.d.ts +22 -0
- package/dist/integrations/ai-sdk.d.ts.map +1 -0
- package/dist/integrations/ai-sdk.js +172 -0
- package/dist/integrations/ai-sdk.js.map +1 -0
- package/dist/integrations/anthropic.d.ts +50 -0
- package/dist/integrations/anthropic.d.ts.map +1 -0
- package/dist/{anthropic/index.js → integrations/anthropic.js} +28 -89
- package/dist/integrations/anthropic.js.map +1 -0
- package/dist/{openai/index.d.ts → integrations/openai.d.ts} +8 -33
- package/dist/integrations/openai.d.ts.map +1 -0
- package/dist/{openai/index.js → integrations/openai.js} +20 -61
- package/dist/integrations/openai.js.map +1 -0
- package/dist/render.js +1 -1
- package/dist/render.js.map +1 -1
- package/dist/types.d.ts +17 -30
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +11 -7
- package/dist/ai-sdk/index.d.ts +0 -68
- package/dist/ai-sdk/index.d.ts.map +0 -1
- package/dist/ai-sdk/index.js +0 -375
- package/dist/ai-sdk/index.js.map +0 -1
- package/dist/anthropic/index.d.ts +0 -102
- package/dist/anthropic/index.d.ts.map +0 -1
- package/dist/anthropic/index.js.map +0 -1
- package/dist/openai/index.d.ts.map +0 -1
- package/dist/openai/index.js.map +0 -1
package/README.md
CHANGED
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
<a href="https://github.com/fastpaca/cria/actions/workflows/ci.yml"><img src="https://github.com/fastpaca/cria/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
13
13
|
<a href="https://www.npmjs.com/package/@fastpaca/cria"><img src="https://img.shields.io/npm/v/@fastpaca/cria?logo=npm&logoColor=white" alt="npm"></a>
|
|
14
|
-
<a href="https://www.npmjs.com/package/@fastpaca/cria"><img src="https://img.shields.io/npm/dm/@fastpaca/cria" alt="Downloads"></a>
|
|
15
14
|
<a href="https://opensource.org/license/mit"><img src="https://img.shields.io/badge/license-MIT-blue" alt="License"></a>
|
|
16
15
|
</p>
|
|
17
16
|
|
|
@@ -28,15 +27,14 @@ const messages = await cria
|
|
|
28
27
|
.prompt()
|
|
29
28
|
.system("You are a research assistant.")
|
|
30
29
|
.vectorSearch({ store, query: question, limit: 10 })
|
|
31
|
-
.provider(
|
|
32
|
-
.summary(conversation, { store: memory })
|
|
33
|
-
.last(conversation, { N: 20 })
|
|
30
|
+
.provider(provider, (p) =>
|
|
31
|
+
p.summary(conversation, { store: memory }).last(conversation, { N: 20 })
|
|
34
32
|
)
|
|
35
33
|
.user(question)
|
|
36
34
|
.render({ budget: 200_000, renderer });
|
|
37
35
|
```
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
Start with **[Quickstart](docs/quickstart.md)**, then use **[Docs](docs/README.md)** to jump to the right how-to.
|
|
40
38
|
|
|
41
39
|
## Use Cria when you need...
|
|
42
40
|
|
|
@@ -120,6 +118,30 @@ const { text } = await generateText({ model, messages });
|
|
|
120
118
|
```
|
|
121
119
|
</details>
|
|
122
120
|
|
|
121
|
+
## Evaluation (LLM-as-a-judge)
|
|
122
|
+
|
|
123
|
+
Use the `@fastpaca/cria/eval` entrypoint for judge-style evaluation helpers.
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
import { c, cria } from "@fastpaca/cria";
|
|
127
|
+
import { createProvider } from "@fastpaca/cria/ai-sdk";
|
|
128
|
+
import { createJudge } from "@fastpaca/cria/eval";
|
|
129
|
+
import { openai } from "@ai-sdk/openai";
|
|
130
|
+
|
|
131
|
+
const judge = createJudge({
|
|
132
|
+
target: createProvider(openai("gpt-4o")),
|
|
133
|
+
evaluator: createProvider(openai("gpt-4o-mini")),
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const prompt = await cria
|
|
137
|
+
.prompt()
|
|
138
|
+
.system("You are a helpful customer support agent.")
|
|
139
|
+
.user("How do I update my payment method?")
|
|
140
|
+
.build();
|
|
141
|
+
|
|
142
|
+
await judge(prompt).toPass(c`Helpfulness in addressing the user's question`);
|
|
143
|
+
```
|
|
144
|
+
|
|
123
145
|
## Roadmap
|
|
124
146
|
|
|
125
147
|
**Done**
|
|
@@ -131,13 +153,13 @@ const { text } = await generateText({ model, messages });
|
|
|
131
153
|
- [x] Memory: InMemoryStore, Redis, Postgres, Chroma, Qdrant
|
|
132
154
|
- [x] Observability: render hooks, validation schemas, snapshots, OpenTelemetry
|
|
133
155
|
- [x] Tokenizer helpers
|
|
156
|
+
- [x] Prompt eval / testing functionality
|
|
134
157
|
|
|
135
158
|
**Planned**
|
|
136
159
|
|
|
137
160
|
- [ ] Next.js adapter
|
|
138
161
|
- [ ] GenAI semantic conventions for OpenTelemetry
|
|
139
162
|
- [ ] Visualization tool
|
|
140
|
-
- [ ] Prompt eval / testing functionality
|
|
141
163
|
|
|
142
164
|
## Contributing
|
|
143
165
|
|
|
@@ -154,7 +176,7 @@ const { text } = await generateText({ model, messages });
|
|
|
154
176
|
## FAQ
|
|
155
177
|
|
|
156
178
|
- **Does this replace my LLM SDK?** No - Cria builds prompt structures. You still use your SDK to call the model.
|
|
157
|
-
- **How do I tune token budgets?** Pass `budget` to `render()` and set priorities on regions
|
|
179
|
+
- **How do I tune token budgets?** Pass `budget` to `render()` and set priorities on regions; see [docs/how-to/fit-and-compaction.md](docs/how-to/fit-and-compaction.md).
|
|
158
180
|
- **Is this production-ready?** Not yet! It is a work in progress and you should test it out before you run this in production.
|
|
159
181
|
|
|
160
182
|
## License
|
|
@@ -45,7 +45,7 @@ interface SummaryProps {
|
|
|
45
45
|
* replaces the original content.
|
|
46
46
|
*
|
|
47
47
|
* If no `summarize` function is provided, the component will use the
|
|
48
|
-
* `ModelProvider` from an ancestor provider
|
|
48
|
+
* `ModelProvider` from an ancestor provider scope with a default
|
|
49
49
|
* summarization prompt.
|
|
50
50
|
*
|
|
51
51
|
* @example Using a custom summarizer
|
|
@@ -66,23 +66,22 @@ interface SummaryProps {
|
|
|
66
66
|
* </Summary>
|
|
67
67
|
* ```
|
|
68
68
|
*
|
|
69
|
-
* @example Using a provider
|
|
70
|
-
* ```
|
|
71
|
-
* import {
|
|
72
|
-
* import {
|
|
69
|
+
* @example Using a provider scope (DSL)
|
|
70
|
+
* ```ts
|
|
71
|
+
* import { cria, InMemoryStore, type StoredSummary } from "@fastpaca/cria";
|
|
72
|
+
* import { createProvider } from "@fastpaca/cria/ai-sdk";
|
|
73
73
|
* import { openai } from "@ai-sdk/openai";
|
|
74
74
|
*
|
|
75
75
|
* const store = new InMemoryStore<StoredSummary>();
|
|
76
|
+
* const provider = createProvider(openai("gpt-4o"));
|
|
76
77
|
*
|
|
77
|
-
* const prompt =
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* </AISDKProvider>
|
|
83
|
-
* );
|
|
78
|
+
* const prompt = cria
|
|
79
|
+
* .prompt()
|
|
80
|
+
* .provider(provider, (p) =>
|
|
81
|
+
* p.summary(conversationHistory, { id: "conv-history", store, priority: 2 })
|
|
82
|
+
* );
|
|
84
83
|
*
|
|
85
|
-
* const result = await render(
|
|
84
|
+
* const result = await prompt.render({ tokenizer, budget: 4000 });
|
|
86
85
|
* ```
|
|
87
86
|
*/
|
|
88
87
|
export declare function Summary({ id, store, summarize, priority, children, }: SummaryProps): PromptElement;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/components/summary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"summary.d.ts","sourceRoot":"","sources":["../../src/components/summary.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,EACV,YAAY,EAEZ,cAAc,EACd,aAAa,EAGd,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,iBAAiB,KAAK,YAAY,CAAC,MAAM,CAAC,CAAC;AAyF1E,UAAU,YAAY;IACpB,sDAAsD;IACtD,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,KAAK,EAAE,QAAQ,CAAC,aAAa,CAAC,CAAC;IAC/B;;;OAGG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,OAAO,CAAC,EACtB,EAAE,EACF,KAAK,EACL,SAAS,EACT,QAAY,EACZ,QAAa,GACd,EAAE,YAAY,GAAG,aAAa,CAM9B"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { cria } from "../dsl";
|
|
1
2
|
/**
|
|
2
3
|
* Default summarizer that uses a ModelProvider.
|
|
3
4
|
* This is used when no custom summarize function is provided.
|
|
4
5
|
*/
|
|
5
6
|
async function defaultSummarizer(ctx, provider) {
|
|
6
7
|
const systemPrompt = "You are a conversation summarizer. Create a concise summary that captures the key points and context needed to continue the conversation. Be brief but preserve essential information.";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
userPrompt = `Here is the existing summary of the conversation so far:
|
|
8
|
+
const userPrompt = ctx.existingSummary
|
|
9
|
+
? `Here is the existing summary of the conversation so far:
|
|
10
10
|
|
|
11
11
|
${ctx.existingSummary}
|
|
12
12
|
|
|
@@ -14,18 +14,19 @@ Here is new conversation content to incorporate into the summary:
|
|
|
14
14
|
|
|
15
15
|
${ctx.content}
|
|
16
16
|
|
|
17
|
-
Please provide an updated summary that incorporates both the existing summary and the new content
|
|
18
|
-
|
|
19
|
-
else {
|
|
20
|
-
userPrompt = `Please summarize the following conversation:
|
|
17
|
+
Please provide an updated summary that incorporates both the existing summary and the new content.`
|
|
18
|
+
: `Please summarize the following conversation:
|
|
21
19
|
|
|
22
20
|
${ctx.content}`;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
system
|
|
26
|
-
|
|
21
|
+
const rendered = await cria
|
|
22
|
+
.prompt()
|
|
23
|
+
.system(systemPrompt)
|
|
24
|
+
.user(userPrompt)
|
|
25
|
+
.render({
|
|
26
|
+
renderer: provider.renderer,
|
|
27
|
+
...(provider.tokenizer ? { tokenizer: provider.tokenizer } : {}),
|
|
27
28
|
});
|
|
28
|
-
return
|
|
29
|
+
return provider.completion(rendered);
|
|
29
30
|
}
|
|
30
31
|
function createSummaryStrategy({ id, store, summarize, }) {
|
|
31
32
|
return async (input) => {
|
|
@@ -44,7 +45,7 @@ function createSummaryStrategy({ id, store, summarize, }) {
|
|
|
44
45
|
newSummary = await defaultSummarizer(summarizerContext, context.provider);
|
|
45
46
|
}
|
|
46
47
|
else {
|
|
47
|
-
throw new Error(`Summary "${id}" requires either a 'summarize' function or a provider scope.
|
|
48
|
+
throw new Error(`Summary "${id}" requires either a 'summarize' function or a provider scope. Use cria.provider(modelProvider, (p) => p.summary(...)) to supply one.`);
|
|
48
49
|
}
|
|
49
50
|
const newTokenCount = tokenizer(newSummary);
|
|
50
51
|
await store.set(id, {
|
|
@@ -68,7 +69,7 @@ function createSummaryStrategy({ id, store, summarize, }) {
|
|
|
68
69
|
* replaces the original content.
|
|
69
70
|
*
|
|
70
71
|
* If no `summarize` function is provided, the component will use the
|
|
71
|
-
* `ModelProvider` from an ancestor provider
|
|
72
|
+
* `ModelProvider` from an ancestor provider scope with a default
|
|
72
73
|
* summarization prompt.
|
|
73
74
|
*
|
|
74
75
|
* @example Using a custom summarizer
|
|
@@ -89,23 +90,22 @@ function createSummaryStrategy({ id, store, summarize, }) {
|
|
|
89
90
|
* </Summary>
|
|
90
91
|
* ```
|
|
91
92
|
*
|
|
92
|
-
* @example Using a provider
|
|
93
|
-
* ```
|
|
94
|
-
* import {
|
|
95
|
-
* import {
|
|
93
|
+
* @example Using a provider scope (DSL)
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { cria, InMemoryStore, type StoredSummary } from "@fastpaca/cria";
|
|
96
|
+
* import { createProvider } from "@fastpaca/cria/ai-sdk";
|
|
96
97
|
* import { openai } from "@ai-sdk/openai";
|
|
97
98
|
*
|
|
98
99
|
* const store = new InMemoryStore<StoredSummary>();
|
|
100
|
+
* const provider = createProvider(openai("gpt-4o"));
|
|
99
101
|
*
|
|
100
|
-
* const prompt =
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
* </AISDKProvider>
|
|
106
|
-
* );
|
|
102
|
+
* const prompt = cria
|
|
103
|
+
* .prompt()
|
|
104
|
+
* .provider(provider, (p) =>
|
|
105
|
+
* p.summary(conversationHistory, { id: "conv-history", store, priority: 2 })
|
|
106
|
+
* );
|
|
107
107
|
*
|
|
108
|
-
* const result = await render(
|
|
108
|
+
* const result = await prompt.render({ tokenizer, budget: 4000 });
|
|
109
109
|
* ```
|
|
110
110
|
*/
|
|
111
111
|
export function Summary({ id, store, summarize, priority = 0, children = [], }) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/components/summary.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"summary.js","sourceRoot":"","sources":["../../src/components/summary.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAoC9B;;;GAGG;AACH,KAAK,UAAU,iBAAiB,CAC9B,GAAsB,EACtB,QAAgC;IAEhC,MAAM,YAAY,GAChB,wLAAwL,CAAC;IAE3L,MAAM,UAAU,GAAG,GAAG,CAAC,eAAe;QACpC,CAAC,CAAC;;EAEJ,GAAG,CAAC,eAAe;;;;EAInB,GAAG,CAAC,OAAO;;mGAEsF;QAC/F,CAAC,CAAC;;EAEJ,GAAG,CAAC,OAAO,EAAE,CAAC;IAEd,MAAM,QAAQ,GAAG,MAAM,IAAI;SACxB,MAAM,EAAE;SACR,MAAM,CAAC,YAAY,CAAC;SACpB,IAAI,CAAC,UAAU,CAAC;SAChB,MAAM,CAAC;QACN,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC,CAAC;IAEL,OAAO,QAAQ,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACvC,CAAC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H,MAAM,UAAU,OAAO,CAAC,EACtB,EAAE,EACF,KAAK,EACL,SAAS,EACT,QAAQ,GAAG,CAAC,EACZ,QAAQ,GAAG,EAAE,GACA;IACb,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,qBAAqB,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;QACzD,QAAQ;KACT,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type { VectorMemory, VectorSearchResult } from "../memory";
|
|
2
|
-
import type {
|
|
2
|
+
import type { PromptChildren, PromptElement } from "../types";
|
|
3
|
+
/** Simple message shape for query extraction. */
|
|
4
|
+
interface Message {
|
|
5
|
+
role: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}
|
|
3
8
|
/**
|
|
4
9
|
* Function that formats search results into prompt content.
|
|
5
10
|
*
|
|
6
11
|
* @template T - The type of data stored in the vector memory
|
|
7
12
|
*/
|
|
8
13
|
export type ResultFormatter<T = unknown> = (results: VectorSearchResult<T>[]) => string;
|
|
9
|
-
type QueryExtractor = (messages:
|
|
14
|
+
type QueryExtractor = (messages: Message[]) => string | null | undefined;
|
|
10
15
|
interface VectorSearchProps<T = unknown> {
|
|
11
16
|
/** Vector memory store to search */
|
|
12
17
|
store: VectorMemory<T>;
|
|
@@ -18,7 +23,7 @@ interface VectorSearchProps<T = unknown> {
|
|
|
18
23
|
/**
|
|
19
24
|
* Optional messages to derive a query from (uses last user message by default).
|
|
20
25
|
*/
|
|
21
|
-
messages?:
|
|
26
|
+
messages?: Message[];
|
|
22
27
|
/** Custom query extractor (overrides the default last-user-message behavior). */
|
|
23
28
|
extractQuery?: QueryExtractor;
|
|
24
29
|
/** Maximum number of results to return. Default: 5 */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-search.d.ts","sourceRoot":"","sources":["../../src/components/vector-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EAEZ,kBAAkB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;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAAE,EAC9C,KAAK,EACL,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,KAAS,EACT,SAAS,EACT,aAAgC,EAChC,QAAY,EACZ,EAAE,EACF,QAAQ,GACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,aAAa,CAAC,CA2B/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-search.js","sourceRoot":"","sources":["../../src/components/vector-search.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vector-search.js","sourceRoot":"","sources":["../../src/components/vector-search.ts"],"names":[],"mappings":"AAsBA;;;GAGG;AACH,SAAS,gBAAgB,CAAI,OAAgC;IAC3D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,oCAAoC,CAAC;IAC9C,CAAC;IAED,OAAO,OAAO;SACX,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACrB,MAAM,IAAI,GACR,OAAO,MAAM,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ;YACnC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI;YACnB,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACjD,OAAO,IAAI,KAAK,GAAG,CAAC,aAAa,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC;IACvE,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC;AAgCD,SAAS,iBAAiB,CAAC,QAAyB;IAClD,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,MA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AQ,CAAC;YACpC,CAAC,CAAC,mBAAmB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACxC,MAAM,OAAO,GAAG,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QACxC,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAc,EAC9C,KAAK,EACL,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,KAAK,GAAG,CAAC,EACT,SAAS,EACT,aAAa,GAAG,gBAAgB,EAChC,QAAQ,GAAG,CAAC,EACZ,EAAE,EACF,QAAQ,GACa;IACrB,MAAM,UAAU,GAAG,WAAW,CAAC;QAC7B,KAAK;QACL,QAAQ;QACR,YAAY;QACZ,QAAQ;KACT,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;IACJ,CAAC;IAED,MAAM,aAAa,GAAwB;QACzC,KAAK;QACL,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;KAC9C,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;IAC9D,MAAM,OAAO,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAEvC,OAAO;QACL,QAAQ;QACR,QAAQ,EAAE,CAAC,OAAO,CAAmB;QACrC,GAAG,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;KAClB,CAAC;AACJ,CAAC"}
|
package/dist/dsl.d.ts
CHANGED
|
@@ -17,52 +17,30 @@
|
|
|
17
17
|
import type { ResultFormatter, StoredSummary, Summarizer } from "./components";
|
|
18
18
|
import type { KVMemory, VectorMemory } from "./memory";
|
|
19
19
|
import type { RenderOptions } from "./render";
|
|
20
|
-
import type { ModelProvider, PromptElement, PromptRenderer, PromptRole } from "./types";
|
|
20
|
+
import type { CriaContext, ModelProvider, PromptChild, PromptChildren, PromptElement, PromptRenderer, PromptRole } from "./types";
|
|
21
|
+
type TextValue = PromptChild | boolean | number | null | undefined;
|
|
22
|
+
export type TextInput = TextValue | readonly TextInput[];
|
|
23
|
+
export type ScopeContent = TextInput | PromptBuilder | Promise<PromptElement> | Promise<string>;
|
|
24
|
+
/**
|
|
25
|
+
* Children can include promises (async components like VectorSearch).
|
|
26
|
+
* These are resolved when `.build()` resolves the tree.
|
|
27
|
+
*/
|
|
28
|
+
export type BuilderChild = PromptElement | PromptBuilder | string | Promise<PromptElement> | Promise<string>;
|
|
21
29
|
type RenderResult<TOptions extends RenderOptions> = TOptions extends {
|
|
22
30
|
renderer: PromptRenderer<infer TOutput>;
|
|
23
31
|
} ? TOutput : string;
|
|
24
32
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* Every method returns a new immutable builder instance.
|
|
28
|
-
* Call `.build()` to get the final `PromptElement`.
|
|
33
|
+
* Shared fluent API for prompt-level and message-level builders.
|
|
34
|
+
* Keeps component helpers available inside nested scopes.
|
|
29
35
|
*/
|
|
30
|
-
export declare class
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
*/
|
|
37
|
-
static create(): PromptBuilder;
|
|
38
|
-
/**
|
|
39
|
-
* Add a system message.
|
|
40
|
-
*/
|
|
41
|
-
system(text: string, opts?: {
|
|
42
|
-
priority?: number;
|
|
43
|
-
id?: string;
|
|
44
|
-
}): PromptBuilder;
|
|
45
|
-
/**
|
|
46
|
-
* Add a user message.
|
|
47
|
-
*/
|
|
48
|
-
user(text: string, opts?: {
|
|
49
|
-
priority?: number;
|
|
50
|
-
id?: string;
|
|
51
|
-
}): PromptBuilder;
|
|
52
|
-
/**
|
|
53
|
-
* Add an assistant message.
|
|
54
|
-
*/
|
|
55
|
-
assistant(text: string, opts?: {
|
|
56
|
-
priority?: number;
|
|
36
|
+
export declare abstract class BuilderBase<TBuilder extends BuilderBase<TBuilder>> {
|
|
37
|
+
protected readonly children: BuilderChild[];
|
|
38
|
+
protected readonly context: CriaContext | undefined;
|
|
39
|
+
protected constructor(children?: BuilderChild[], context?: CriaContext | undefined);
|
|
40
|
+
protected abstract create(children: BuilderChild[], context: CriaContext | undefined): TBuilder;
|
|
41
|
+
scope(fn: (builder: TBuilder) => TBuilder, opts?: {
|
|
57
42
|
id?: string;
|
|
58
|
-
}):
|
|
59
|
-
/**
|
|
60
|
-
* Add a message with a custom role.
|
|
61
|
-
*/
|
|
62
|
-
message(role: PromptRole, text: string, opts?: {
|
|
63
|
-
priority?: number;
|
|
64
|
-
id?: string;
|
|
65
|
-
}): PromptBuilder;
|
|
43
|
+
}): TBuilder;
|
|
66
44
|
/**
|
|
67
45
|
* Add content that will be truncated when over budget.
|
|
68
46
|
*/
|
|
@@ -71,63 +49,35 @@ export declare class PromptBuilder {
|
|
|
71
49
|
from?: "start" | "end";
|
|
72
50
|
priority?: number;
|
|
73
51
|
id?: string;
|
|
74
|
-
}):
|
|
52
|
+
}): TBuilder;
|
|
75
53
|
/**
|
|
76
54
|
* Add content that will be entirely removed when over budget.
|
|
77
55
|
*/
|
|
78
56
|
omit(content: string | PromptElement | PromptBuilder, opts?: {
|
|
79
57
|
priority?: number;
|
|
80
58
|
id?: string;
|
|
81
|
-
}):
|
|
82
|
-
/**
|
|
83
|
-
* Create a nested section.
|
|
84
|
-
*
|
|
85
|
-
* @example Anonymous section
|
|
86
|
-
* ```typescript
|
|
87
|
-
* .section((s) => s.truncate(content, { budget: 1000 }))
|
|
88
|
-
* ```
|
|
89
|
-
*
|
|
90
|
-
* @example Named section
|
|
91
|
-
* ```typescript
|
|
92
|
-
* .section("context", (s) => s.truncate(content, { budget: 1000 }))
|
|
93
|
-
* ```
|
|
94
|
-
*/
|
|
95
|
-
region(fn: (builder: PromptBuilder) => PromptBuilder): PromptBuilder;
|
|
96
|
-
region(name: string, fn: (builder: PromptBuilder) => PromptBuilder): PromptBuilder;
|
|
97
|
-
/**
|
|
98
|
-
* Create a nested section/region.
|
|
99
|
-
*
|
|
100
|
-
* @example Anonymous section
|
|
101
|
-
* ```typescript
|
|
102
|
-
* .section((s) => s.truncate(content, { budget: 1000 }))
|
|
103
|
-
* ```
|
|
104
|
-
*
|
|
105
|
-
* @example Named section
|
|
106
|
-
* ```typescript
|
|
107
|
-
* .section("context", (s) => s.truncate(content, { budget: 1000 }))
|
|
108
|
-
* ```
|
|
109
|
-
*/
|
|
110
|
-
section(fn: (builder: PromptBuilder) => PromptBuilder): PromptBuilder;
|
|
111
|
-
section(name: string, fn: (builder: PromptBuilder) => PromptBuilder): PromptBuilder;
|
|
59
|
+
}): TBuilder;
|
|
112
60
|
/**
|
|
113
61
|
* Merge another builder's contents into this one (zod-like merge).
|
|
114
62
|
* Contexts must be compatible (either identical or undefined).
|
|
115
63
|
*/
|
|
116
|
-
merge(...builders:
|
|
64
|
+
merge(...builders: TBuilder[]): TBuilder;
|
|
117
65
|
/**
|
|
118
66
|
* Create a provider scope for AI-powered operations like Summary.
|
|
119
67
|
*
|
|
120
68
|
* @example
|
|
121
69
|
* ```typescript
|
|
122
|
-
* import {
|
|
70
|
+
* import { createProvider } from "@fastpaca/cria/ai-sdk";
|
|
71
|
+
* import { openai } from "@ai-sdk/openai";
|
|
123
72
|
*
|
|
124
|
-
* const provider =
|
|
125
|
-
* .
|
|
126
|
-
*
|
|
127
|
-
* )
|
|
73
|
+
* const provider = createProvider(openai("gpt-4o"));
|
|
74
|
+
* cria.prompt()
|
|
75
|
+
* .provider(provider, (p) =>
|
|
76
|
+
* p.summary(content, { id: "conv", store })
|
|
77
|
+
* )
|
|
128
78
|
* ```
|
|
129
79
|
*/
|
|
130
|
-
provider(modelProvider: ModelProvider
|
|
80
|
+
provider(modelProvider: ModelProvider<unknown>, fn: (builder: TBuilder) => TBuilder): TBuilder;
|
|
131
81
|
/**
|
|
132
82
|
* Add vector search results (async, resolved at render time).
|
|
133
83
|
*/
|
|
@@ -139,7 +89,7 @@ export declare class PromptBuilder {
|
|
|
139
89
|
formatter?: ResultFormatter<T>;
|
|
140
90
|
priority?: number;
|
|
141
91
|
id?: string;
|
|
142
|
-
}):
|
|
92
|
+
}): TBuilder;
|
|
143
93
|
/**
|
|
144
94
|
* Add content that will be summarized when over budget.
|
|
145
95
|
*/
|
|
@@ -148,18 +98,69 @@ export declare class PromptBuilder {
|
|
|
148
98
|
store: KVMemory<StoredSummary>;
|
|
149
99
|
summarize?: Summarizer;
|
|
150
100
|
priority?: number;
|
|
151
|
-
}):
|
|
101
|
+
}): TBuilder;
|
|
152
102
|
/**
|
|
153
103
|
* Add a formatted list of examples.
|
|
154
104
|
*/
|
|
155
105
|
examples(title: string, items: (string | PromptElement)[], opts?: {
|
|
156
106
|
priority?: number;
|
|
157
107
|
id?: string;
|
|
158
|
-
}):
|
|
108
|
+
}): TBuilder;
|
|
159
109
|
/**
|
|
160
110
|
* Add a raw PromptElement (escape hatch for advanced usage).
|
|
161
111
|
*/
|
|
162
|
-
raw(element: PromptElement | Promise<PromptElement>):
|
|
112
|
+
raw(element: PromptElement | Promise<PromptElement>): TBuilder;
|
|
113
|
+
buildChildren(): Promise<PromptChildren>;
|
|
114
|
+
protected addChild(child: BuilderChild): TBuilder;
|
|
115
|
+
protected addChildren(children: readonly BuilderChild[]): TBuilder;
|
|
116
|
+
}
|
|
117
|
+
export declare class MessageBuilder extends BuilderBase<MessageBuilder> {
|
|
118
|
+
constructor(children?: BuilderChild[], context?: CriaContext | undefined);
|
|
119
|
+
protected create(children: BuilderChild[], context: CriaContext | undefined): MessageBuilder;
|
|
120
|
+
append(content: ScopeContent): MessageBuilder;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Fluent builder for constructing prompt trees without JSX.
|
|
124
|
+
*
|
|
125
|
+
* Every method returns a new immutable builder instance; large chains will copy
|
|
126
|
+
* child arrays, so keep prompts reasonably sized.
|
|
127
|
+
* Call `.build()` to get the final `PromptElement`.
|
|
128
|
+
*/
|
|
129
|
+
export declare class PromptBuilder extends BuilderBase<PromptBuilder> {
|
|
130
|
+
private constructor();
|
|
131
|
+
/**
|
|
132
|
+
* Create a new empty prompt builder.
|
|
133
|
+
*/
|
|
134
|
+
static create(): PromptBuilder;
|
|
135
|
+
protected create(children: BuilderChild[], context: CriaContext | undefined): PromptBuilder;
|
|
136
|
+
/**
|
|
137
|
+
* Add a system message.
|
|
138
|
+
*/
|
|
139
|
+
system(content: TextInput | ((builder: MessageBuilder) => MessageBuilder), opts?: {
|
|
140
|
+
priority?: number;
|
|
141
|
+
id?: string;
|
|
142
|
+
}): PromptBuilder;
|
|
143
|
+
/**
|
|
144
|
+
* Add a user message.
|
|
145
|
+
*/
|
|
146
|
+
user(content: TextInput | ((builder: MessageBuilder) => MessageBuilder), opts?: {
|
|
147
|
+
priority?: number;
|
|
148
|
+
id?: string;
|
|
149
|
+
}): PromptBuilder;
|
|
150
|
+
/**
|
|
151
|
+
* Add an assistant message.
|
|
152
|
+
*/
|
|
153
|
+
assistant(content: TextInput | ((builder: MessageBuilder) => MessageBuilder), opts?: {
|
|
154
|
+
priority?: number;
|
|
155
|
+
id?: string;
|
|
156
|
+
}): PromptBuilder;
|
|
157
|
+
/**
|
|
158
|
+
* Add a message with a custom role.
|
|
159
|
+
*/
|
|
160
|
+
message(role: PromptRole, content: TextInput | ((builder: MessageBuilder) => MessageBuilder), opts?: {
|
|
161
|
+
priority?: number;
|
|
162
|
+
id?: string;
|
|
163
|
+
}): PromptBuilder;
|
|
163
164
|
/**
|
|
164
165
|
* Build the final PromptElement tree.
|
|
165
166
|
*/
|
|
@@ -169,10 +170,11 @@ export declare class PromptBuilder {
|
|
|
169
170
|
* Equivalent to `render(await builder.build(), options)`.
|
|
170
171
|
*/
|
|
171
172
|
render<TOptions extends RenderOptions>(options: TOptions): Promise<RenderResult<TOptions>>;
|
|
172
|
-
private
|
|
173
|
+
private addMessage;
|
|
173
174
|
}
|
|
175
|
+
export type Prompt = PromptBuilder;
|
|
174
176
|
/**
|
|
175
|
-
* Namespace for building prompts
|
|
177
|
+
* Namespace for building prompts as code.
|
|
176
178
|
*
|
|
177
179
|
* @example
|
|
178
180
|
* ```typescript
|
|
@@ -187,6 +189,7 @@ export declare class PromptBuilder {
|
|
|
187
189
|
*/
|
|
188
190
|
export declare const cria: {
|
|
189
191
|
readonly prompt: () => PromptBuilder;
|
|
192
|
+
readonly c: typeof c;
|
|
190
193
|
readonly merge: (...builders: PromptBuilder[]) => PromptBuilder;
|
|
191
194
|
};
|
|
192
195
|
/**
|
|
@@ -197,5 +200,34 @@ export declare const prompt: () => PromptBuilder;
|
|
|
197
200
|
* Merge multiple builders into one (zod-like merge).
|
|
198
201
|
*/
|
|
199
202
|
export declare const merge: (...builders: PromptBuilder[]) => PromptBuilder;
|
|
203
|
+
/**
|
|
204
|
+
* Tagged template literal function for building prompt children with automatic indentation normalization.
|
|
205
|
+
*
|
|
206
|
+
* Interpolates values into template strings and normalizes indentation by stripping
|
|
207
|
+
* common leading whitespace. Useful for writing multi-line prompt content with clean formatting.
|
|
208
|
+
*
|
|
209
|
+
* @param strings - Template string segments
|
|
210
|
+
* @param values - Interpolated values (strings, numbers, booleans, PromptElements, arrays, etc.)
|
|
211
|
+
* @returns Array of prompt children (strings and PromptElements)
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* import { c } from "@fastpaca/cria";
|
|
216
|
+
*
|
|
217
|
+
* const children = c`
|
|
218
|
+
* System: You are a helpful assistant.
|
|
219
|
+
* User: ${userMessage}
|
|
220
|
+
* Assistant: ${assistantResponse}
|
|
221
|
+
* `;
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* const name = "Alice";
|
|
227
|
+
* const age = 30;
|
|
228
|
+
* const children = c`Name: ${name}, Age: ${age}`;
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
export declare function c(strings: TemplateStringsArray, ...values: readonly TextInput[]): PromptChildren;
|
|
200
232
|
export {};
|
|
201
233
|
//# sourceMappingURL=dsl.d.ts.map
|
package/dist/dsl.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dsl.d.ts","sourceRoot":"","sources":["../src/dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU/E,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"dsl.d.ts","sourceRoot":"","sources":["../src/dsl.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAU/E,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,OAAO,KAAK,EACV,WAAW,EACX,aAAa,EACb,WAAW,EACX,cAAc,EACd,aAAa,EACb,cAAc,EACd,UAAU,EACX,MAAM,SAAS,CAAC;AAEjB,KAAK,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;AAEnE,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,SAAS,SAAS,EAAE,CAAC;AAEzD,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,aAAa,GACb,OAAO,CAAC,aAAa,CAAC,GACtB,O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