@gammatech/aijsx 0.3.0-beta.5 → 0.3.0-beta.7
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/dist/{createElement-_dIoXoIE.d.mts → createElement-t8vKixcE.d.mts} +3 -5
- package/dist/{createElement-_dIoXoIE.d.ts → createElement-t8vKixcE.d.ts} +3 -5
- package/dist/index.d.mts +38 -36
- package/dist/index.d.ts +38 -36
- package/dist/index.js +35 -37
- package/dist/index.mjs +35 -37
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/package.json +2 -3
|
@@ -39,10 +39,7 @@ type EvaluatorResult = {
|
|
|
39
39
|
description?: string;
|
|
40
40
|
debug?: string;
|
|
41
41
|
};
|
|
42
|
-
type EvaluatorFn<V extends Record<string, any> = Record<string, any>, O = any> = (
|
|
43
|
-
promptKey: string;
|
|
44
|
-
variables: V;
|
|
45
|
-
}, result: O) => Promise<EvaluatorResult | EvaluatorResult[]>;
|
|
42
|
+
type EvaluatorFn<V extends Record<string, any> = Record<string, any>, O = any> = (variables: V, result: O) => Promise<EvaluatorResult | EvaluatorResult[]>;
|
|
46
43
|
type OutputParser<O> = {
|
|
47
44
|
schema: ZodTypeAny;
|
|
48
45
|
parse: (result: string) => O;
|
|
@@ -61,6 +58,7 @@ interface PromptParsed<V extends Record<string, any> = Record<string, any>, O =
|
|
|
61
58
|
outputParser: OutputParser<O>;
|
|
62
59
|
}
|
|
63
60
|
type Chain<V extends Record<string, any> = Record<string, any>, R = any> = {
|
|
61
|
+
key: string;
|
|
64
62
|
run: (vars: V, context: RenderContext) => R;
|
|
65
63
|
schema: ZodObject<ZodRawShape>;
|
|
66
64
|
};
|
|
@@ -202,4 +200,4 @@ declare function AIFragment({ children }: {
|
|
|
202
200
|
children: AINode;
|
|
203
201
|
}): Renderable;
|
|
204
202
|
|
|
205
|
-
export { type
|
|
203
|
+
export { type AIComponent as A, BoundLogger as B, type ContextValues as C, type PropsOfAIComponent as D, type EvaluatorFn as E, type EvaluatorResult as F, type PromptRenderResult as G, LogImplementation as L, NoopLogImplementation as N, type OutputParser as O, type PromptParsed as P, type RenderContext as R, SystemMessage as S, UserMessage as U, type Prompt as a, type Chain as b, type Context as c, type AINode as d, createAIElement as e, AIFragment as f, LoggerContext as g, createContext as h, type ChatCompletionRole as i, AssistantMessage as j, type RenderedConversationMessage as k, computeUsage as l, ChatCompletionError as m, type ChatCompletionRequestPayloads as n, type LogChatCompletionRequest as o, type LogChatCompletionResponse as p, type LogLevel as q, type Logger as r, ConsoleLogger as s, CombinedLogger as t, type Literal as u, type RenderableStream as v, type RenderResult as w, attachedContextSymbol as x, type AIElement as y, type Renderable as z };
|
|
@@ -39,10 +39,7 @@ type EvaluatorResult = {
|
|
|
39
39
|
description?: string;
|
|
40
40
|
debug?: string;
|
|
41
41
|
};
|
|
42
|
-
type EvaluatorFn<V extends Record<string, any> = Record<string, any>, O = any> = (
|
|
43
|
-
promptKey: string;
|
|
44
|
-
variables: V;
|
|
45
|
-
}, result: O) => Promise<EvaluatorResult | EvaluatorResult[]>;
|
|
42
|
+
type EvaluatorFn<V extends Record<string, any> = Record<string, any>, O = any> = (variables: V, result: O) => Promise<EvaluatorResult | EvaluatorResult[]>;
|
|
46
43
|
type OutputParser<O> = {
|
|
47
44
|
schema: ZodTypeAny;
|
|
48
45
|
parse: (result: string) => O;
|
|
@@ -61,6 +58,7 @@ interface PromptParsed<V extends Record<string, any> = Record<string, any>, O =
|
|
|
61
58
|
outputParser: OutputParser<O>;
|
|
62
59
|
}
|
|
63
60
|
type Chain<V extends Record<string, any> = Record<string, any>, R = any> = {
|
|
61
|
+
key: string;
|
|
64
62
|
run: (vars: V, context: RenderContext) => R;
|
|
65
63
|
schema: ZodObject<ZodRawShape>;
|
|
66
64
|
};
|
|
@@ -202,4 +200,4 @@ declare function AIFragment({ children }: {
|
|
|
202
200
|
children: AINode;
|
|
203
201
|
}): Renderable;
|
|
204
202
|
|
|
205
|
-
export { type
|
|
203
|
+
export { type AIComponent as A, BoundLogger as B, type ContextValues as C, type PropsOfAIComponent as D, type EvaluatorFn as E, type EvaluatorResult as F, type PromptRenderResult as G, LogImplementation as L, NoopLogImplementation as N, type OutputParser as O, type PromptParsed as P, type RenderContext as R, SystemMessage as S, UserMessage as U, type Prompt as a, type Chain as b, type Context as c, type AINode as d, createAIElement as e, AIFragment as f, LoggerContext as g, createContext as h, type ChatCompletionRole as i, AssistantMessage as j, type RenderedConversationMessage as k, computeUsage as l, ChatCompletionError as m, type ChatCompletionRequestPayloads as n, type LogChatCompletionRequest as o, type LogChatCompletionResponse as p, type LogLevel as q, type Logger as r, ConsoleLogger as s, CombinedLogger as t, type Literal as u, type RenderableStream as v, type RenderResult as w, attachedContextSymbol as x, type AIElement as y, type Renderable as z };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { R as RenderContext, L as LogImplementation, C as ContextValues,
|
|
2
|
-
export { y as AIElement, f as AIFragment, j as AssistantMessage, B as BoundLogger, m as ChatCompletionError, n as ChatCompletionRequestPayloads, i as ChatCompletionRole, t as CombinedLogger, s as ConsoleLogger, F as EvaluatorResult, u as Literal, o as LogChatCompletionRequest, p as LogChatCompletionResponse, q as LogLevel, r as Logger, g as LoggerContext, N as NoopLogImplementation, O as OutputParser, G as PromptRenderResult, D as PropsOfAIComponent, w as RenderResult, z as Renderable, v as RenderableStream, k as RenderedConversationMessage, S as SystemMessage, U as UserMessage, x as attachedContextSymbol, l as computeUsage, e as createAIElement, h as createContext } from './createElement-
|
|
1
|
+
import { R as RenderContext, L as LogImplementation, C as ContextValues, A as AIComponent, E as EvaluatorFn, P as PromptParsed, a as Prompt, b as Chain, c as Context, d as AINode } from './createElement-t8vKixcE.mjs';
|
|
2
|
+
export { y as AIElement, f as AIFragment, j as AssistantMessage, B as BoundLogger, m as ChatCompletionError, n as ChatCompletionRequestPayloads, i as ChatCompletionRole, t as CombinedLogger, s as ConsoleLogger, F as EvaluatorResult, u as Literal, o as LogChatCompletionRequest, p as LogChatCompletionResponse, q as LogLevel, r as Logger, g as LoggerContext, N as NoopLogImplementation, O as OutputParser, G as PromptRenderResult, D as PropsOfAIComponent, w as RenderResult, z as Renderable, v as RenderableStream, k as RenderedConversationMessage, S as SystemMessage, U as UserMessage, x as attachedContextSymbol, l as computeUsage, e as createAIElement, h as createContext } from './createElement-t8vKixcE.mjs';
|
|
3
|
+
import { ZodObject, ZodRawShape, ZodTypeAny, ZodString, z } from 'zod';
|
|
3
4
|
import { OpenAI } from 'openai';
|
|
4
5
|
export { OpenAI as OpenAIClient } from 'openai';
|
|
5
6
|
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam, ChatCompletionCreateParams } from 'openai/resources';
|
|
6
7
|
import AnthropicClient from '@anthropic-ai/sdk';
|
|
7
8
|
export { default as AnthropicClient } from '@anthropic-ai/sdk';
|
|
8
9
|
export { countTokens as countAnthropicTokens } from '@anthropic-ai/tokenizer';
|
|
9
|
-
import { ZodObject, ZodRawShape, ZodTypeAny, ZodString, z } from 'zod';
|
|
10
10
|
|
|
11
11
|
type CreateRenderContextOptions = {
|
|
12
12
|
logger?: LogImplementation;
|
|
@@ -15,6 +15,41 @@ type CreateRenderContextOptions = {
|
|
|
15
15
|
};
|
|
16
16
|
declare function createRenderContext({ logger, rootRenderId, contextValues, }?: CreateRenderContextOptions): RenderContext;
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* This is a helper function to create a JsxPrompt type
|
|
20
|
+
*/
|
|
21
|
+
declare function createPrompt<K extends string, I extends ZodObject<ZodRawShape>, O extends ZodTypeAny = ZodString>(config: {
|
|
22
|
+
key: K;
|
|
23
|
+
schema: I;
|
|
24
|
+
component: AIComponent<z.infer<I>>;
|
|
25
|
+
evaluators?: EvaluatorFn<z.infer<I>, z.infer<O>>[];
|
|
26
|
+
metadata?: Record<string, any>;
|
|
27
|
+
outputParser: {
|
|
28
|
+
schema: O;
|
|
29
|
+
parse: (result: string) => z.infer<O>;
|
|
30
|
+
};
|
|
31
|
+
}): PromptParsed<z.infer<I>, z.infer<O>>;
|
|
32
|
+
declare function createPrompt<K extends string, I extends ZodObject<ZodRawShape>>(config: {
|
|
33
|
+
key: K;
|
|
34
|
+
schema: I;
|
|
35
|
+
component: AIComponent<z.infer<I>>;
|
|
36
|
+
evaluators?: EvaluatorFn<z.infer<I>, string>[];
|
|
37
|
+
metadata?: Record<string, any>;
|
|
38
|
+
}): Prompt<z.infer<I>>;
|
|
39
|
+
|
|
40
|
+
declare function createChain<I extends ZodObject<ZodRawShape>, R>(chain: {
|
|
41
|
+
key: string;
|
|
42
|
+
run: (variables: z.infer<I>, context: RenderContext) => R;
|
|
43
|
+
schema: I;
|
|
44
|
+
}): Chain<z.infer<I>, R>;
|
|
45
|
+
|
|
46
|
+
declare class PromptParseVariablesError extends Error {
|
|
47
|
+
}
|
|
48
|
+
declare class ChainParseVariablesError extends Error {
|
|
49
|
+
}
|
|
50
|
+
declare class PromptInvalidOutputError extends Error {
|
|
51
|
+
}
|
|
52
|
+
|
|
18
53
|
type OpenAIChatCompletionRequest = OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming;
|
|
19
54
|
type OpenAIChatMessage = ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam;
|
|
20
55
|
declare module '@gammatech/aijsx' {
|
|
@@ -95,37 +130,4 @@ type AnthropicChatCompletionProps = {
|
|
|
95
130
|
*/
|
|
96
131
|
declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, { render, logger, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
|
|
97
132
|
|
|
98
|
-
/**
|
|
99
|
-
* This is a helper function to create a JsxPrompt type
|
|
100
|
-
*/
|
|
101
|
-
declare function createPrompt<K extends string, I extends ZodObject<ZodRawShape>, O extends ZodTypeAny = ZodString>(config: {
|
|
102
|
-
key: K;
|
|
103
|
-
schema: I;
|
|
104
|
-
component: AIComponent<z.infer<I>>;
|
|
105
|
-
evaluators?: EvaluatorFn<z.infer<I>, z.infer<O>>[];
|
|
106
|
-
metadata?: Record<string, any>;
|
|
107
|
-
outputParser: {
|
|
108
|
-
schema: O;
|
|
109
|
-
parse: (result: string) => z.infer<O>;
|
|
110
|
-
};
|
|
111
|
-
}): PromptParsed<z.infer<I>, z.infer<O>>;
|
|
112
|
-
declare function createPrompt<K extends string, I extends ZodObject<ZodRawShape>>(config: {
|
|
113
|
-
key: K;
|
|
114
|
-
schema: I;
|
|
115
|
-
component: AIComponent<z.infer<I>>;
|
|
116
|
-
evaluators?: EvaluatorFn<z.infer<I>, string>[];
|
|
117
|
-
metadata?: Record<string, any>;
|
|
118
|
-
}): Prompt<z.infer<I>>;
|
|
119
|
-
declare function createChain<I extends ZodObject<ZodRawShape>, R>(config: {
|
|
120
|
-
run: (vars: z.infer<I>, context: RenderContext) => R;
|
|
121
|
-
schema: I;
|
|
122
|
-
}): Chain<z.infer<I>, R>;
|
|
123
|
-
|
|
124
|
-
declare class PromptParseVariablesError extends Error {
|
|
125
|
-
}
|
|
126
|
-
declare class ChainParseVariablesError extends Error {
|
|
127
|
-
}
|
|
128
|
-
declare class PromptInvalidOutputError extends Error {
|
|
129
|
-
}
|
|
130
|
-
|
|
131
133
|
export { AIComponent, AINode, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, Chain, ChainParseVariablesError, ContentTypeImage, Context, EvaluatorFn, LogImplementation, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, Prompt, PromptInvalidOutputError, PromptParseVariablesError, PromptParsed, RenderContext, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createChain, createPrompt, createRenderContext, defaultMaxTokens, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { R as RenderContext, L as LogImplementation, C as ContextValues,
|
|
2
|
-
export { y as AIElement, f as AIFragment, j as AssistantMessage, B as BoundLogger, m as ChatCompletionError, n as ChatCompletionRequestPayloads, i as ChatCompletionRole, t as CombinedLogger, s as ConsoleLogger, F as EvaluatorResult, u as Literal, o as LogChatCompletionRequest, p as LogChatCompletionResponse, q as LogLevel, r as Logger, g as LoggerContext, N as NoopLogImplementation, O as OutputParser, G as PromptRenderResult, D as PropsOfAIComponent, w as RenderResult, z as Renderable, v as RenderableStream, k as RenderedConversationMessage, S as SystemMessage, U as UserMessage, x as attachedContextSymbol, l as computeUsage, e as createAIElement, h as createContext } from './createElement-
|
|
1
|
+
import { R as RenderContext, L as LogImplementation, C as ContextValues, A as AIComponent, E as EvaluatorFn, P as PromptParsed, a as Prompt, b as Chain, c as Context, d as AINode } from './createElement-t8vKixcE.js';
|
|
2
|
+
export { y as AIElement, f as AIFragment, j as AssistantMessage, B as BoundLogger, m as ChatCompletionError, n as ChatCompletionRequestPayloads, i as ChatCompletionRole, t as CombinedLogger, s as ConsoleLogger, F as EvaluatorResult, u as Literal, o as LogChatCompletionRequest, p as LogChatCompletionResponse, q as LogLevel, r as Logger, g as LoggerContext, N as NoopLogImplementation, O as OutputParser, G as PromptRenderResult, D as PropsOfAIComponent, w as RenderResult, z as Renderable, v as RenderableStream, k as RenderedConversationMessage, S as SystemMessage, U as UserMessage, x as attachedContextSymbol, l as computeUsage, e as createAIElement, h as createContext } from './createElement-t8vKixcE.js';
|
|
3
|
+
import { ZodObject, ZodRawShape, ZodTypeAny, ZodString, z } from 'zod';
|
|
3
4
|
import { OpenAI } from 'openai';
|
|
4
5
|
export { OpenAI as OpenAIClient } from 'openai';
|
|
5
6
|
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam, ChatCompletionCreateParams } from 'openai/resources';
|
|
6
7
|
import AnthropicClient from '@anthropic-ai/sdk';
|
|
7
8
|
export { default as AnthropicClient } from '@anthropic-ai/sdk';
|
|
8
9
|
export { countTokens as countAnthropicTokens } from '@anthropic-ai/tokenizer';
|
|
9
|
-
import { ZodObject, ZodRawShape, ZodTypeAny, ZodString, z } from 'zod';
|
|
10
10
|
|
|
11
11
|
type CreateRenderContextOptions = {
|
|
12
12
|
logger?: LogImplementation;
|
|
@@ -15,6 +15,41 @@ type CreateRenderContextOptions = {
|
|
|
15
15
|
};
|
|
16
16
|
declare function createRenderContext({ logger, rootRenderId, contextValues, }?: CreateRenderContextOptions): RenderContext;
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* This is a helper function to create a JsxPrompt type
|
|
20
|
+
*/
|
|
21
|
+
declare function createPrompt<K extends string, I extends ZodObject<ZodRawShape>, O extends ZodTypeAny = ZodString>(config: {
|
|
22
|
+
key: K;
|
|
23
|
+
schema: I;
|
|
24
|
+
component: AIComponent<z.infer<I>>;
|
|
25
|
+
evaluators?: EvaluatorFn<z.infer<I>, z.infer<O>>[];
|
|
26
|
+
metadata?: Record<string, any>;
|
|
27
|
+
outputParser: {
|
|
28
|
+
schema: O;
|
|
29
|
+
parse: (result: string) => z.infer<O>;
|
|
30
|
+
};
|
|
31
|
+
}): PromptParsed<z.infer<I>, z.infer<O>>;
|
|
32
|
+
declare function createPrompt<K extends string, I extends ZodObject<ZodRawShape>>(config: {
|
|
33
|
+
key: K;
|
|
34
|
+
schema: I;
|
|
35
|
+
component: AIComponent<z.infer<I>>;
|
|
36
|
+
evaluators?: EvaluatorFn<z.infer<I>, string>[];
|
|
37
|
+
metadata?: Record<string, any>;
|
|
38
|
+
}): Prompt<z.infer<I>>;
|
|
39
|
+
|
|
40
|
+
declare function createChain<I extends ZodObject<ZodRawShape>, R>(chain: {
|
|
41
|
+
key: string;
|
|
42
|
+
run: (variables: z.infer<I>, context: RenderContext) => R;
|
|
43
|
+
schema: I;
|
|
44
|
+
}): Chain<z.infer<I>, R>;
|
|
45
|
+
|
|
46
|
+
declare class PromptParseVariablesError extends Error {
|
|
47
|
+
}
|
|
48
|
+
declare class ChainParseVariablesError extends Error {
|
|
49
|
+
}
|
|
50
|
+
declare class PromptInvalidOutputError extends Error {
|
|
51
|
+
}
|
|
52
|
+
|
|
18
53
|
type OpenAIChatCompletionRequest = OpenAI.Chat.Completions.ChatCompletionCreateParamsStreaming;
|
|
19
54
|
type OpenAIChatMessage = ChatCompletionSystemMessageParam | ChatCompletionUserMessageParam | ChatCompletionAssistantMessageParam;
|
|
20
55
|
declare module '@gammatech/aijsx' {
|
|
@@ -95,37 +130,4 @@ type AnthropicChatCompletionProps = {
|
|
|
95
130
|
*/
|
|
96
131
|
declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, { render, logger, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
|
|
97
132
|
|
|
98
|
-
/**
|
|
99
|
-
* This is a helper function to create a JsxPrompt type
|
|
100
|
-
*/
|
|
101
|
-
declare function createPrompt<K extends string, I extends ZodObject<ZodRawShape>, O extends ZodTypeAny = ZodString>(config: {
|
|
102
|
-
key: K;
|
|
103
|
-
schema: I;
|
|
104
|
-
component: AIComponent<z.infer<I>>;
|
|
105
|
-
evaluators?: EvaluatorFn<z.infer<I>, z.infer<O>>[];
|
|
106
|
-
metadata?: Record<string, any>;
|
|
107
|
-
outputParser: {
|
|
108
|
-
schema: O;
|
|
109
|
-
parse: (result: string) => z.infer<O>;
|
|
110
|
-
};
|
|
111
|
-
}): PromptParsed<z.infer<I>, z.infer<O>>;
|
|
112
|
-
declare function createPrompt<K extends string, I extends ZodObject<ZodRawShape>>(config: {
|
|
113
|
-
key: K;
|
|
114
|
-
schema: I;
|
|
115
|
-
component: AIComponent<z.infer<I>>;
|
|
116
|
-
evaluators?: EvaluatorFn<z.infer<I>, string>[];
|
|
117
|
-
metadata?: Record<string, any>;
|
|
118
|
-
}): Prompt<z.infer<I>>;
|
|
119
|
-
declare function createChain<I extends ZodObject<ZodRawShape>, R>(config: {
|
|
120
|
-
run: (vars: z.infer<I>, context: RenderContext) => R;
|
|
121
|
-
schema: I;
|
|
122
|
-
}): Chain<z.infer<I>, R>;
|
|
123
|
-
|
|
124
|
-
declare class PromptParseVariablesError extends Error {
|
|
125
|
-
}
|
|
126
|
-
declare class ChainParseVariablesError extends Error {
|
|
127
|
-
}
|
|
128
|
-
declare class PromptInvalidOutputError extends Error {
|
|
129
|
-
}
|
|
130
|
-
|
|
131
133
|
export { AIComponent, AINode, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, Chain, ChainParseVariablesError, ContentTypeImage, Context, EvaluatorFn, LogImplementation, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, Prompt, PromptInvalidOutputError, PromptParseVariablesError, PromptParsed, RenderContext, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createChain, createPrompt, createRenderContext, defaultMaxTokens, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer };
|
package/dist/index.js
CHANGED
|
@@ -781,6 +781,41 @@ function attachedContextValues(element) {
|
|
|
781
781
|
return element[attachedContextSymbol];
|
|
782
782
|
}
|
|
783
783
|
|
|
784
|
+
// src/prompt/createPrompt.tsx
|
|
785
|
+
function createPrompt(config) {
|
|
786
|
+
if (config.outputParser) {
|
|
787
|
+
const {
|
|
788
|
+
key: key2,
|
|
789
|
+
schema: schema2,
|
|
790
|
+
outputParser,
|
|
791
|
+
component: component2,
|
|
792
|
+
evaluators: evaluators2 = [],
|
|
793
|
+
metadata: metadata2 = {}
|
|
794
|
+
} = config;
|
|
795
|
+
return {
|
|
796
|
+
key: key2,
|
|
797
|
+
component: component2,
|
|
798
|
+
outputParser,
|
|
799
|
+
schema: schema2,
|
|
800
|
+
metadata: metadata2,
|
|
801
|
+
evaluators: evaluators2
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
const { key, schema, component, evaluators = [], metadata = {} } = config;
|
|
805
|
+
return {
|
|
806
|
+
key,
|
|
807
|
+
component,
|
|
808
|
+
schema,
|
|
809
|
+
metadata,
|
|
810
|
+
evaluators
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
// src/prompt/createChain.ts
|
|
815
|
+
function createChain(chain) {
|
|
816
|
+
return chain;
|
|
817
|
+
}
|
|
818
|
+
|
|
784
819
|
// src/lib/openai/OpenAI.tsx
|
|
785
820
|
var import_openai = require("openai");
|
|
786
821
|
|
|
@@ -1329,43 +1364,6 @@ async function* AnthropicChatCompletion(props, { render, logger, getContext }) {
|
|
|
1329
1364
|
// src/lib/anthropic/index.ts
|
|
1330
1365
|
var import_sdk2 = __toESM(require("@anthropic-ai/sdk"));
|
|
1331
1366
|
var import_tokenizer4 = require("@anthropic-ai/tokenizer");
|
|
1332
|
-
|
|
1333
|
-
// src/prompt/createPrompt.tsx
|
|
1334
|
-
function createPrompt(config) {
|
|
1335
|
-
if (config.outputParser) {
|
|
1336
|
-
const {
|
|
1337
|
-
key: key2,
|
|
1338
|
-
schema: schema2,
|
|
1339
|
-
outputParser,
|
|
1340
|
-
component: component2,
|
|
1341
|
-
evaluators: evaluators2 = [],
|
|
1342
|
-
metadata: metadata2 = {}
|
|
1343
|
-
} = config;
|
|
1344
|
-
return {
|
|
1345
|
-
key: key2,
|
|
1346
|
-
component: component2,
|
|
1347
|
-
outputParser,
|
|
1348
|
-
schema: schema2,
|
|
1349
|
-
metadata: metadata2,
|
|
1350
|
-
evaluators: evaluators2
|
|
1351
|
-
};
|
|
1352
|
-
}
|
|
1353
|
-
const { key, schema, component, evaluators = [], metadata = {} } = config;
|
|
1354
|
-
return {
|
|
1355
|
-
key,
|
|
1356
|
-
component,
|
|
1357
|
-
schema,
|
|
1358
|
-
metadata,
|
|
1359
|
-
evaluators
|
|
1360
|
-
};
|
|
1361
|
-
}
|
|
1362
|
-
function createChain(config) {
|
|
1363
|
-
const { run, schema } = config;
|
|
1364
|
-
return {
|
|
1365
|
-
run,
|
|
1366
|
-
schema
|
|
1367
|
-
};
|
|
1368
|
-
}
|
|
1369
1367
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1370
1368
|
0 && (module.exports = {
|
|
1371
1369
|
AIFragment,
|
package/dist/index.mjs
CHANGED
|
@@ -687,6 +687,41 @@ function attachedContextValues(element) {
|
|
|
687
687
|
return element[attachedContextSymbol];
|
|
688
688
|
}
|
|
689
689
|
|
|
690
|
+
// src/prompt/createPrompt.tsx
|
|
691
|
+
function createPrompt(config) {
|
|
692
|
+
if (config.outputParser) {
|
|
693
|
+
const {
|
|
694
|
+
key: key2,
|
|
695
|
+
schema: schema2,
|
|
696
|
+
outputParser,
|
|
697
|
+
component: component2,
|
|
698
|
+
evaluators: evaluators2 = [],
|
|
699
|
+
metadata: metadata2 = {}
|
|
700
|
+
} = config;
|
|
701
|
+
return {
|
|
702
|
+
key: key2,
|
|
703
|
+
component: component2,
|
|
704
|
+
outputParser,
|
|
705
|
+
schema: schema2,
|
|
706
|
+
metadata: metadata2,
|
|
707
|
+
evaluators: evaluators2
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
const { key, schema, component, evaluators = [], metadata = {} } = config;
|
|
711
|
+
return {
|
|
712
|
+
key,
|
|
713
|
+
component,
|
|
714
|
+
schema,
|
|
715
|
+
metadata,
|
|
716
|
+
evaluators
|
|
717
|
+
};
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
// src/prompt/createChain.ts
|
|
721
|
+
function createChain(chain) {
|
|
722
|
+
return chain;
|
|
723
|
+
}
|
|
724
|
+
|
|
690
725
|
// src/lib/openai/OpenAI.tsx
|
|
691
726
|
import { OpenAI as OpenAIClient } from "openai";
|
|
692
727
|
|
|
@@ -1235,43 +1270,6 @@ async function* AnthropicChatCompletion(props, { render, logger, getContext }) {
|
|
|
1235
1270
|
// src/lib/anthropic/index.ts
|
|
1236
1271
|
import AnthropicClient2 from "@anthropic-ai/sdk";
|
|
1237
1272
|
import { countTokens as countAnthropicTokens } from "@anthropic-ai/tokenizer";
|
|
1238
|
-
|
|
1239
|
-
// src/prompt/createPrompt.tsx
|
|
1240
|
-
function createPrompt(config) {
|
|
1241
|
-
if (config.outputParser) {
|
|
1242
|
-
const {
|
|
1243
|
-
key: key2,
|
|
1244
|
-
schema: schema2,
|
|
1245
|
-
outputParser,
|
|
1246
|
-
component: component2,
|
|
1247
|
-
evaluators: evaluators2 = [],
|
|
1248
|
-
metadata: metadata2 = {}
|
|
1249
|
-
} = config;
|
|
1250
|
-
return {
|
|
1251
|
-
key: key2,
|
|
1252
|
-
component: component2,
|
|
1253
|
-
outputParser,
|
|
1254
|
-
schema: schema2,
|
|
1255
|
-
metadata: metadata2,
|
|
1256
|
-
evaluators: evaluators2
|
|
1257
|
-
};
|
|
1258
|
-
}
|
|
1259
|
-
const { key, schema, component, evaluators = [], metadata = {} } = config;
|
|
1260
|
-
return {
|
|
1261
|
-
key,
|
|
1262
|
-
component,
|
|
1263
|
-
schema,
|
|
1264
|
-
metadata,
|
|
1265
|
-
evaluators
|
|
1266
|
-
};
|
|
1267
|
-
}
|
|
1268
|
-
function createChain(config) {
|
|
1269
|
-
const { run, schema } = config;
|
|
1270
|
-
return {
|
|
1271
|
-
run,
|
|
1272
|
-
schema
|
|
1273
|
-
};
|
|
1274
|
-
}
|
|
1275
1273
|
export {
|
|
1276
1274
|
AIFragment,
|
|
1277
1275
|
AnthropicChatCompletion,
|
package/dist/jsx-runtime.d.mts
CHANGED
package/dist/jsx-runtime.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gammatech/aijsx",
|
|
3
|
-
"version": "0.3.0-beta.
|
|
3
|
+
"version": "0.3.0-beta.7",
|
|
4
4
|
"description": "Rewrite of aijsx",
|
|
5
5
|
"author": "Jordan Garcia",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
"dev": "ts-node ./src/test.tsx",
|
|
12
12
|
"test": "jest --verbose",
|
|
13
13
|
"test:watch": "jest --watch --verbose --silent false",
|
|
14
|
-
"build": "yarn check-types &&
|
|
15
|
-
"clean-symlinks": "rm ./jsx-* || true",
|
|
14
|
+
"build": "yarn check-types && tsup",
|
|
16
15
|
"prepublishOnly": "yarn build",
|
|
17
16
|
"lint": "eslint \"{src,test}/**/*.ts\" && yarn check-types",
|
|
18
17
|
"check-types": "tsc --skipLibCheck --noEmit"
|