@gammatech/aijsx 0.5.0-beta.1 → 0.5.0-dev.2024-03-11
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 +2 -0
- package/dist/index.d.mts +91 -390
- package/dist/index.d.ts +91 -390
- package/dist/index.js +1131 -1040
- package/dist/index.mjs +1125 -1035
- package/dist/{createElement--C_Hwi_c.d.mts → jsx-dev-runtime-zWb34twz.d.mts} +234 -109
- package/dist/{createElement--C_Hwi_c.d.ts → jsx-dev-runtime-zWb34twz.d.ts} +234 -109
- package/dist/jsx-dev-runtime.d.mts +1 -2
- package/dist/jsx-dev-runtime.d.ts +1 -2
- package/dist/jsx-runtime.d.mts +1 -29
- package/dist/jsx-runtime.d.ts +1 -29
- package/package.json +3 -2
|
@@ -1,83 +1,32 @@
|
|
|
1
1
|
import { ZodTypeAny, ZodObject, ZodRawShape } from 'zod';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
requestId: string;
|
|
7
|
-
startTime: string;
|
|
8
|
-
model: string;
|
|
9
|
-
providerRegion?: string;
|
|
10
|
-
provider?: string;
|
|
11
|
-
inputMessages: RenderedConversationMessage[];
|
|
12
|
-
request: R;
|
|
13
|
-
}
|
|
14
|
-
interface LogChatCompletionResponse<R extends Record<string, any> = ChatCompletionRequestPayloads[keyof ChatCompletionRequestPayloads]> extends LogChatCompletionRequest<R> {
|
|
15
|
-
endTime: string;
|
|
16
|
-
latency: number;
|
|
17
|
-
outputMessage: RenderedConversationMessage;
|
|
18
|
-
finishReason: string;
|
|
19
|
-
tokensUsed: {
|
|
20
|
-
prompt: number;
|
|
21
|
-
completion: number;
|
|
22
|
-
total: number;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* This can be extended using declare module to add additional providers.
|
|
28
|
-
*/
|
|
29
|
-
type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
30
|
-
type Loggable = string | number | boolean | undefined | null | object;
|
|
31
|
-
type Logger = {
|
|
32
|
-
error: (...msg: Loggable[]) => void;
|
|
33
|
-
warn: (...msg: Loggable[]) => void;
|
|
34
|
-
info: (...msg: Loggable[]) => void;
|
|
35
|
-
debug: (...msg: Loggable[]) => void;
|
|
36
|
-
logException(exception: string | Error): void;
|
|
37
|
-
chatCompletionRequest<K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionRequest<ChatCompletionRequestPayloads[K]>): void;
|
|
38
|
-
chatCompletionResponse<K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionResponse<ChatCompletionRequestPayloads[K]>): void;
|
|
39
|
-
};
|
|
40
|
-
declare abstract class LogImplementation {
|
|
41
|
-
private readonly loggedExceptions;
|
|
42
|
-
/**
|
|
43
|
-
* @param ctx The current RenderContext
|
|
44
|
-
* @param level The log level, e.g. 'error', 'warn', 'info', 'debug'
|
|
45
|
-
* @param message
|
|
46
|
-
*/
|
|
47
|
-
abstract log(level: LogLevel, message: string): void;
|
|
48
|
-
chatCompletionRequest<K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionRequest<ChatCompletionRequestPayloads[K]>): void;
|
|
49
|
-
chatCompletionResponse<K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionResponse<ChatCompletionRequestPayloads[K]>): void;
|
|
50
|
-
/**
|
|
51
|
-
* Logs exceptions thrown during an element's render.
|
|
52
|
-
*/
|
|
53
|
-
logException(exception: unknown): void;
|
|
54
|
-
}
|
|
55
|
-
declare class BoundLogger implements Logger {
|
|
56
|
-
private readonly impl;
|
|
57
|
-
constructor(impl: LogImplementation);
|
|
58
|
-
private formatMessage;
|
|
59
|
-
error: (...msgs: Loggable[]) => void;
|
|
60
|
-
warn: (...msgs: Loggable[]) => void;
|
|
61
|
-
info: (...msgs: Loggable[]) => void;
|
|
62
|
-
debug: (...msgs: Loggable[]) => void;
|
|
63
|
-
logException: (exception: string | Error) => void;
|
|
64
|
-
chatCompletionRequest: <K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionRequest<ChatCompletionRequestPayloads[K]>) => void;
|
|
65
|
-
chatCompletionResponse: <K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionResponse<ChatCompletionRequestPayloads[K]>) => void;
|
|
66
|
-
}
|
|
67
|
-
declare class NoopLogImplementation extends LogImplementation {
|
|
68
|
-
log(level: LogLevel, message: string): void;
|
|
3
|
+
type Literal = string | number | null | undefined | boolean;
|
|
4
|
+
interface RenderResult extends AsyncGenerator<string, void> {
|
|
5
|
+
then(onFulfilled: (value: string) => string | PromiseLike<string>, onRejected?: (reason: any) => string | PromiseLike<string>): PromiseLike<string>;
|
|
69
6
|
}
|
|
70
|
-
|
|
71
|
-
|
|
7
|
+
interface Context<T> {
|
|
8
|
+
Provider: AIComponent<{
|
|
9
|
+
children: AINode;
|
|
10
|
+
value: T;
|
|
11
|
+
}>;
|
|
12
|
+
defaultValue: T;
|
|
13
|
+
key: symbol;
|
|
72
14
|
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
15
|
+
type AIComponent<P> = (props: P, context: RenderContext) => Renderable;
|
|
16
|
+
declare const attachedContextSymbol: unique symbol;
|
|
17
|
+
interface AIElement<P> {
|
|
18
|
+
/** The tag associated with this {@link AIElement}. */
|
|
19
|
+
tag: AIComponent<P>;
|
|
20
|
+
/** The component properties. */
|
|
21
|
+
props: P;
|
|
22
|
+
/** A function that renders this {@link AIElement} to a {@link Renderable}. */
|
|
23
|
+
render: (ctx: RenderContext) => Renderable;
|
|
24
|
+
/** The {@link RenderContext} associated with this {@link Element}. */
|
|
25
|
+
[attachedContextSymbol]?: Record<symbol, any>;
|
|
80
26
|
}
|
|
27
|
+
type AINode = Literal | AIElement<any> | AINode[];
|
|
28
|
+
type Renderable = AINode | PromiseLike<Renderable> | AsyncGenerator<string, void>;
|
|
29
|
+
type PropsOfAIComponent<T extends AIComponent<any>> = T extends AIComponent<infer P> ? P : never;
|
|
81
30
|
|
|
82
31
|
type EvaluatorPrimitive = string | number | boolean;
|
|
83
32
|
type EvaluatorResult = {
|
|
@@ -92,9 +41,6 @@ type OutputParser<O> = {
|
|
|
92
41
|
schema: ZodTypeAny;
|
|
93
42
|
parse: (result: string) => O;
|
|
94
43
|
};
|
|
95
|
-
interface PromptRenderResult<O> extends RenderableStream {
|
|
96
|
-
then: (onResolved: (value: O) => void, onRejected?: (reason?: any) => void) => void;
|
|
97
|
-
}
|
|
98
44
|
interface Prompt<V extends Record<string, any> = Record<string, any>> {
|
|
99
45
|
key: string;
|
|
100
46
|
component: AIComponent<V>;
|
|
@@ -128,6 +74,115 @@ interface StreamChain<V extends Record<string, any> = Record<string, any>, R ext
|
|
|
128
74
|
type IsAsyncGenerator<T> = T extends AsyncGenerator<any, any, any> ? true : false;
|
|
129
75
|
type NotAsyncGenerator<T> = IsAsyncGenerator<T> extends true ? never : T;
|
|
130
76
|
|
|
77
|
+
type SpanContext = {
|
|
78
|
+
traceId: string;
|
|
79
|
+
spanId: string;
|
|
80
|
+
};
|
|
81
|
+
type SpanAttributes = Record<string, any>;
|
|
82
|
+
type SpanStatus = 'unset' | 'ok' | 'error';
|
|
83
|
+
interface ReadableSpan<Attrs extends SpanAttributes = SpanAttributes> {
|
|
84
|
+
name: string;
|
|
85
|
+
status: SpanStatus;
|
|
86
|
+
spanContext: SpanContext;
|
|
87
|
+
parentSpanId: string | null;
|
|
88
|
+
attributes: Attrs;
|
|
89
|
+
events: SpanEvent[];
|
|
90
|
+
startTime: string;
|
|
91
|
+
endTime: string | null;
|
|
92
|
+
ended: boolean;
|
|
93
|
+
duration: number;
|
|
94
|
+
}
|
|
95
|
+
interface Span<Attrs extends SpanAttributes = SpanAttributes> extends ReadableSpan<Attrs> {
|
|
96
|
+
setAttributes(attributes: Partial<Attrs>): this;
|
|
97
|
+
end(endTime?: [number, number]): void;
|
|
98
|
+
addEvent(name: string, attributes: SpanAttributes, startTime?: [number, number]): this;
|
|
99
|
+
recordException(exception: Error | string, time?: [number, number]): this;
|
|
100
|
+
}
|
|
101
|
+
interface SpanEvent {
|
|
102
|
+
name: string;
|
|
103
|
+
timestamp: string;
|
|
104
|
+
time: [number, number];
|
|
105
|
+
attributes: SpanAttributes;
|
|
106
|
+
}
|
|
107
|
+
interface TracingContextKey<_T> {
|
|
108
|
+
key: symbol;
|
|
109
|
+
}
|
|
110
|
+
interface TracingContext {
|
|
111
|
+
/**
|
|
112
|
+
* Get a value from the context.
|
|
113
|
+
*
|
|
114
|
+
* @param key key which identifies a context value
|
|
115
|
+
*/
|
|
116
|
+
getValue<T>(key: TracingContextKey<T>): T | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Create a new context which inherits from this context and has
|
|
119
|
+
* the given key set to the given value.
|
|
120
|
+
*
|
|
121
|
+
* @param key context key for which to set the value
|
|
122
|
+
* @param value value to set for the given key
|
|
123
|
+
*/
|
|
124
|
+
setValue<T>(key: TracingContextKey<T>, value: T): TracingContext;
|
|
125
|
+
/**
|
|
126
|
+
* Return a new context which inherits from this context but does
|
|
127
|
+
* not contain a value for the given key.
|
|
128
|
+
*
|
|
129
|
+
* @param key context key for which to clear a value
|
|
130
|
+
*/
|
|
131
|
+
deleteValue<T>(key: TracingContextKey<T>): TracingContext;
|
|
132
|
+
}
|
|
133
|
+
interface TracingContextManager {
|
|
134
|
+
/**
|
|
135
|
+
* Get the current active context
|
|
136
|
+
*/
|
|
137
|
+
active(): TracingContext;
|
|
138
|
+
/**
|
|
139
|
+
* Run the fn callback with object set as the current active context
|
|
140
|
+
* @param context Any object to set as the current active context
|
|
141
|
+
* @param fn A callback to be immediately run within a specific context
|
|
142
|
+
* @param thisArg optional receiver to be used for calling fn
|
|
143
|
+
* @param args optional arguments forwarded to fn
|
|
144
|
+
*/
|
|
145
|
+
with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: TracingContext, fn: F, ...args: A): ReturnType<F>;
|
|
146
|
+
/**
|
|
147
|
+
* Bind an object as the current context (or a specific one)
|
|
148
|
+
* @param [context] Optionally specify the context which you want to assign
|
|
149
|
+
* @param target Any object to which a context need to be set
|
|
150
|
+
*/
|
|
151
|
+
bind<T>(context: TracingContext, target: T): T;
|
|
152
|
+
/**
|
|
153
|
+
* Enable context management
|
|
154
|
+
*/
|
|
155
|
+
enable(): this;
|
|
156
|
+
/**
|
|
157
|
+
* Disable context management
|
|
158
|
+
*/
|
|
159
|
+
disable(): this;
|
|
160
|
+
}
|
|
161
|
+
interface SpanProcessor {
|
|
162
|
+
/**
|
|
163
|
+
* Called when a {@link Span} is started, if the `span.isRecording()`
|
|
164
|
+
* returns true.
|
|
165
|
+
* @param span the Span that just started.
|
|
166
|
+
*/
|
|
167
|
+
onStart?(span: ReadableSpan): void;
|
|
168
|
+
onSpanEvent?(event: SpanEvent, span: ReadableSpan): void;
|
|
169
|
+
onSpanException?(exceptionEvent: SpanEvent, span: ReadableSpan): void;
|
|
170
|
+
/**
|
|
171
|
+
* Called when a {@link ReadableSpan} is ended, if the `span.isRecording()`
|
|
172
|
+
* returns true.
|
|
173
|
+
* @param span the Span that just ended.
|
|
174
|
+
*/
|
|
175
|
+
onEnd(span: ReadableSpan): void;
|
|
176
|
+
}
|
|
177
|
+
interface Tracer {
|
|
178
|
+
getActiveSpan(): Span | null;
|
|
179
|
+
trace<F extends (span: Span) => ReturnType<F>>(name: string, attributes: SpanAttributes, fn: F): ReturnType<F>;
|
|
180
|
+
}
|
|
181
|
+
interface SpanExporter {
|
|
182
|
+
export(spans: ReadableSpan[]): Promise<void>;
|
|
183
|
+
shutdown?(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
|
|
131
186
|
type ContextValues = Record<symbol, any>;
|
|
132
187
|
type RenderOptions = {
|
|
133
188
|
preserveTags?: boolean;
|
|
@@ -138,6 +193,7 @@ type RenderOptions = {
|
|
|
138
193
|
};
|
|
139
194
|
};
|
|
140
195
|
interface RenderContext {
|
|
196
|
+
tracer: Tracer;
|
|
141
197
|
logger: Logger;
|
|
142
198
|
getContext<T>(context: Context<T>): T;
|
|
143
199
|
render(renderable: Renderable, opts?: RenderOptions): RenderResult;
|
|
@@ -145,44 +201,87 @@ interface RenderContext {
|
|
|
145
201
|
render<V extends Record<string, any>>(prompt: Prompt<V>, variables: V): RenderResult;
|
|
146
202
|
render<V extends Record<string, any>, O extends AsyncGenerator<any>>(chain: StreamChain<V, O>, variables: V): AsyncGenerator<O, void>;
|
|
147
203
|
render<V extends Record<string, any>, O>(chain: FunctionChain<V, O>, variables: V): O;
|
|
148
|
-
runChain<V extends Record<string, any>, R>(chain: FunctionChain<V, R>, variables: V): R;
|
|
149
|
-
runChain<V extends Record<string, any>, R extends AsyncGenerator<any>>(chain: StreamChain<V, R>, variables: V): R;
|
|
150
204
|
}
|
|
151
205
|
type RenderPromptOptions = {
|
|
152
206
|
validateOutput?: boolean;
|
|
153
207
|
};
|
|
154
208
|
declare function createContext<T>(defaultValue: T): Context<T>;
|
|
155
209
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
210
|
+
/**
|
|
211
|
+
* This can be extended using declare module to add additional providers.
|
|
212
|
+
*/
|
|
213
|
+
interface ChatCompletionRequestPayloads {
|
|
159
214
|
}
|
|
160
|
-
interface
|
|
161
|
-
|
|
215
|
+
interface LogChatCompletionRequest<R extends Record<string, any> = ChatCompletionRequestPayloads[keyof ChatCompletionRequestPayloads]> {
|
|
216
|
+
startTime: number;
|
|
217
|
+
model: string;
|
|
218
|
+
providerRegion?: string;
|
|
219
|
+
provider?: string;
|
|
220
|
+
inputMessages: RenderedConversationMessage[];
|
|
221
|
+
request: R;
|
|
162
222
|
}
|
|
163
|
-
interface
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
223
|
+
interface LogChatCompletionResponse<R extends Record<string, any> = ChatCompletionRequestPayloads[keyof ChatCompletionRequestPayloads]> extends LogChatCompletionRequest<R> {
|
|
224
|
+
latency: number;
|
|
225
|
+
outputMessage: RenderedConversationMessage;
|
|
226
|
+
finishReason: string | null;
|
|
227
|
+
tokensUsed: {
|
|
228
|
+
prompt: number;
|
|
229
|
+
completion: number;
|
|
230
|
+
total: number;
|
|
231
|
+
};
|
|
170
232
|
}
|
|
171
|
-
type
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
233
|
+
type LogLevel = 'error' | 'warn' | 'info' | 'debug';
|
|
234
|
+
type Loggable = string | number | boolean | undefined | null | object;
|
|
235
|
+
type Logger = {
|
|
236
|
+
error: (...msg: Loggable[]) => void;
|
|
237
|
+
warn: (...msg: Loggable[]) => void;
|
|
238
|
+
info: (...msg: Loggable[]) => void;
|
|
239
|
+
debug: (...msg: Loggable[]) => void;
|
|
240
|
+
logException: (exception: unknown) => void;
|
|
241
|
+
chatCompletionRequest: <K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionRequest<ChatCompletionRequestPayloads[K]>) => void;
|
|
242
|
+
chatCompletionResponse: <K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionResponse<ChatCompletionRequestPayloads[K]>) => void;
|
|
243
|
+
};
|
|
244
|
+
declare abstract class LogImplementation {
|
|
245
|
+
protected readonly loggedExceptions: WeakMap<object, boolean>;
|
|
246
|
+
/**
|
|
247
|
+
* @param ctx The current RenderContext
|
|
248
|
+
* @param level The log level, e.g. 'error', 'warn', 'info', 'debug'
|
|
249
|
+
* @param message
|
|
250
|
+
*/
|
|
251
|
+
abstract log(ctx: RenderContext, level: LogLevel, message: string): void;
|
|
252
|
+
/**
|
|
253
|
+
* Logs exceptions thrown during an element's render.
|
|
254
|
+
*/
|
|
255
|
+
logException(ctx: RenderContext, exception: unknown): void;
|
|
256
|
+
chatCompletionRequest<K extends keyof ChatCompletionRequestPayloads>(_ctx: RenderContext, _provider: K, _payload: LogChatCompletionRequest<ChatCompletionRequestPayloads[K]>): void;
|
|
257
|
+
chatCompletionResponse<K extends keyof ChatCompletionRequestPayloads>(_ctx: RenderContext, _provider: K, _payload: LogChatCompletionResponse<ChatCompletionRequestPayloads[K]>): void;
|
|
258
|
+
}
|
|
259
|
+
declare class BoundLogger implements Logger {
|
|
260
|
+
private readonly impl;
|
|
261
|
+
private readonly ctx;
|
|
262
|
+
constructor(impl: LogImplementation, ctx: RenderContext);
|
|
263
|
+
private formatMessage;
|
|
264
|
+
error: (...msgs: Loggable[]) => void;
|
|
265
|
+
warn: (...msgs: Loggable[]) => void;
|
|
266
|
+
info: (...msgs: Loggable[]) => void;
|
|
267
|
+
debug: (...msgs: Loggable[]) => void;
|
|
268
|
+
logException: (exception: unknown) => void;
|
|
269
|
+
chatCompletionRequest: <K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionRequest<ChatCompletionRequestPayloads[K]>) => void;
|
|
270
|
+
chatCompletionResponse: <K extends keyof ChatCompletionRequestPayloads>(provider: K, payload: LogChatCompletionResponse<ChatCompletionRequestPayloads[K]>) => void;
|
|
271
|
+
}
|
|
272
|
+
declare class NoopLogImplementation extends LogImplementation {
|
|
273
|
+
log(_ctx: RenderContext, _level: LogLevel, _message: string): void;
|
|
274
|
+
}
|
|
275
|
+
declare class ConsoleLogger extends LogImplementation {
|
|
276
|
+
log(ctx: RenderContext, level: LogLevel, message: string): void;
|
|
277
|
+
}
|
|
278
|
+
declare class CombinedLogger extends LogImplementation {
|
|
279
|
+
private readonly loggers;
|
|
280
|
+
constructor(loggers: LogImplementation[]);
|
|
281
|
+
log(...args: Parameters<LogImplementation['log']>): void;
|
|
282
|
+
chatCompletionRequest<_K extends keyof ChatCompletionRequestPayloads>(...args: Parameters<LogImplementation['chatCompletionRequest']>): void;
|
|
283
|
+
chatCompletionResponse<_K extends keyof ChatCompletionRequestPayloads>(...args: Parameters<LogImplementation['chatCompletionResponse']>): void;
|
|
182
284
|
}
|
|
183
|
-
type AINode = Literal | AIElement<any> | AINode[];
|
|
184
|
-
type Renderable = AINode | PromiseLike<Renderable> | RenderableStream;
|
|
185
|
-
type PropsOfAIComponent<T extends AIComponent<any>> = T extends AIComponent<infer P> ? P : never;
|
|
186
285
|
|
|
187
286
|
type ChatCompletionRole = 'user' | 'system' | 'assistant';
|
|
188
287
|
declare const SystemMessage: (props: {
|
|
@@ -205,8 +304,8 @@ declare const computeUsage: (messages: RenderedConversationMessage[]) => {
|
|
|
205
304
|
total: number;
|
|
206
305
|
};
|
|
207
306
|
declare class ChatCompletionError extends Error {
|
|
208
|
-
readonly chatCompletionRequest:
|
|
209
|
-
constructor(message: string, chatCompletionRequest:
|
|
307
|
+
readonly chatCompletionRequest: LogChatCompletionRequest;
|
|
308
|
+
constructor(message: string, chatCompletionRequest: LogChatCompletionRequest);
|
|
210
309
|
}
|
|
211
310
|
|
|
212
311
|
declare function createAIElement<P extends {
|
|
@@ -219,4 +318,30 @@ declare function AIFragment({ children }: {
|
|
|
219
318
|
children: AINode;
|
|
220
319
|
}): Renderable;
|
|
221
320
|
|
|
222
|
-
|
|
321
|
+
/**
|
|
322
|
+
* The is used as an import source for ts/js files as the JSX transpile functinos
|
|
323
|
+
*/
|
|
324
|
+
|
|
325
|
+
/** @hidden */
|
|
326
|
+
declare namespace JSX {
|
|
327
|
+
type ElementType = AIComponent<any>;
|
|
328
|
+
interface Element extends AIElement<any> {
|
|
329
|
+
}
|
|
330
|
+
interface IntrinsicElements {
|
|
331
|
+
}
|
|
332
|
+
interface ElementChildrenAttribute {
|
|
333
|
+
children: {};
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
/** @hidden */
|
|
337
|
+
declare function jsx(type: any, config: any, maybeKey?: any): AIElement<{
|
|
338
|
+
children: any[];
|
|
339
|
+
}>;
|
|
340
|
+
/** @hidden */
|
|
341
|
+
declare const jsxDEV: typeof jsx;
|
|
342
|
+
/** @hidden */
|
|
343
|
+
declare const jsxs: typeof jsx;
|
|
344
|
+
/** @hidden */
|
|
345
|
+
declare const Fragment: typeof AIFragment;
|
|
346
|
+
|
|
347
|
+
export { jsxDEV as $, type AIComponent as A, BoundLogger as B, type ContextValues as C, type RenderResult as D, type EvaluatorFn as E, type FunctionChain as F, attachedContextSymbol as G, type AIElement as H, type Renderable as I, JSX as J, type PropsOfAIComponent as K, LogImplementation as L, type SpanContext as M, type NotAsyncGenerator as N, type SpanStatus as O, type PromptParsed as P, type Span as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, UserMessage as U, type SpanEvent as V, type TracingContextKey as W, type TracingContext as X, type TracingContextManager as Y, type OutputParser as Z, jsx as _, type ReadableSpan as a, jsxs as a0, Fragment as a1, type SpanExporter as b, type AINode as c, type SpanAttributes as d, type Prompt as e, type StreamChain as f, type EvaluatorResult as g, type Context as h, createAIElement as i, AIFragment as j, createContext as k, type ChatCompletionRole as l, SystemMessage as m, AssistantMessage as n, type RenderedConversationMessage as o, computeUsage as p, ChatCompletionError as q, type ChatCompletionRequestPayloads as r, type LogChatCompletionRequest as s, type LogChatCompletionResponse as t, type LogLevel as u, type Logger as v, NoopLogImplementation as w, ConsoleLogger as x, CombinedLogger as y, type Literal as z };
|
package/dist/jsx-runtime.d.mts
CHANGED
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { a1 as Fragment, J as JSX, _ as jsx, $ as jsxDEV, a0 as jsxs } from './jsx-dev-runtime-zWb34twz.mjs';
|
|
2
2
|
import 'zod';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The is used as an import source for ts/js files as the JSX transpile functinos
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** @hidden */
|
|
9
|
-
declare namespace JSX {
|
|
10
|
-
type ElementType = AIComponent<any>;
|
|
11
|
-
interface Element extends AIElement<any> {
|
|
12
|
-
}
|
|
13
|
-
interface IntrinsicElements {
|
|
14
|
-
}
|
|
15
|
-
interface ElementChildrenAttribute {
|
|
16
|
-
children: {};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/** @hidden */
|
|
20
|
-
declare function jsx(type: any, config: any, maybeKey?: any): AIElement<{
|
|
21
|
-
children: any[];
|
|
22
|
-
}>;
|
|
23
|
-
/** @hidden */
|
|
24
|
-
declare const jsxDEV: typeof jsx;
|
|
25
|
-
/** @hidden */
|
|
26
|
-
declare const jsxs: typeof jsx;
|
|
27
|
-
/** @hidden */
|
|
28
|
-
declare const Fragment: typeof AIFragment;
|
|
29
|
-
|
|
30
|
-
export { Fragment, JSX, jsx, jsxDEV, jsxs };
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,30 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { a1 as Fragment, J as JSX, _ as jsx, $ as jsxDEV, a0 as jsxs } from './jsx-dev-runtime-zWb34twz.js';
|
|
2
2
|
import 'zod';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* The is used as an import source for ts/js files as the JSX transpile functinos
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
/** @hidden */
|
|
9
|
-
declare namespace JSX {
|
|
10
|
-
type ElementType = AIComponent<any>;
|
|
11
|
-
interface Element extends AIElement<any> {
|
|
12
|
-
}
|
|
13
|
-
interface IntrinsicElements {
|
|
14
|
-
}
|
|
15
|
-
interface ElementChildrenAttribute {
|
|
16
|
-
children: {};
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
/** @hidden */
|
|
20
|
-
declare function jsx(type: any, config: any, maybeKey?: any): AIElement<{
|
|
21
|
-
children: any[];
|
|
22
|
-
}>;
|
|
23
|
-
/** @hidden */
|
|
24
|
-
declare const jsxDEV: typeof jsx;
|
|
25
|
-
/** @hidden */
|
|
26
|
-
declare const jsxs: typeof jsx;
|
|
27
|
-
/** @hidden */
|
|
28
|
-
declare const Fragment: typeof AIFragment;
|
|
29
|
-
|
|
30
|
-
export { Fragment, JSX, jsx, jsxDEV, jsxs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gammatech/aijsx",
|
|
3
|
-
"version": "0.5.0-
|
|
3
|
+
"version": "0.5.0-dev.2024-03-11",
|
|
4
4
|
"description": "Rewrite of aijsx",
|
|
5
5
|
"author": "Jordan Garcia",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"dev": "ts-node ./src/test.tsx",
|
|
12
|
+
"bench": "npx tsx ./benchmark/bench.tsx",
|
|
12
13
|
"test": "jest --verbose",
|
|
13
14
|
"test:watch": "jest --watch --verbose --silent false",
|
|
14
15
|
"build": "yarn check-types && tsup",
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
"check-types": "tsc --skipLibCheck --noEmit"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@anthropic-ai/sdk": "
|
|
21
|
+
"@anthropic-ai/sdk": "0.17.1",
|
|
21
22
|
"@anthropic-ai/tokenizer": "^0.0.4",
|
|
22
23
|
"fast-xml-parser": "^4.3.4",
|
|
23
24
|
"js-tiktoken": "^1.0.8",
|