@gammatech/aijsx 0.5.0-beta.1 → 0.5.0-dev.2024-03-12

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/index.d.ts CHANGED
@@ -1,402 +1,89 @@
1
- import { R as RenderContext, C as ContextValues, L as LogImplementation, A as AIComponent, E as EvaluatorFn, P as PromptParsed, a as Prompt, N as NotAsyncGenerator, F as FunctionChain, S as StreamChain, b as EvaluatorResult, c as Context, d as AINode } from './createElement--C_Hwi_c.js';
2
- export { z as AIElement, f as AIFragment, j as AssistantMessage, B as BoundLogger, m as ChatCompletionError, s as ChatCompletionRequestPayloads, h as ChatCompletionRole, r as CombinedLogger, q as ConsoleLogger, v as Literal, t as LogChatCompletionRequest, u as LogChatCompletionResponse, n as LogLevel, o as Logger, p as NoopLogImplementation, O as OutputParser, H as PromptRenderResult, G as PropsOfAIComponent, x as RenderResult, D as Renderable, w as RenderableStream, k as RenderedConversationMessage, i as SystemMessage, U as UserMessage, y as attachedContextSymbol, l as computeUsage, e as createAIElement, g as createContext } from './createElement--C_Hwi_c.js';
1
+ import { R as RenderContext, L as LogImplementation, S as SpanProcessor, C as ContextValues, T as Tracer, a as ReadableSpan, b as SpanExporter, A as AIComponent, c as AINode, d as SpanAttributes, E as EvaluatorFn, P as PromptParsed, e as Prompt, N as NotAsyncGenerator, F as FunctionChain, f as StreamChain, g as EvaluatorResult, h as Context, i as ChatCompletionClientAndProvider, J as JSX } from './jsx-dev-runtime-LS-DZfkv.js';
2
+ export { I as AIElement, k as AIFragment, o as AssistantMessage, B as BoundLogger, r as ChatCompletionError, s as ChatCompletionRequestPayloads, m as ChatCompletionRole, z as CombinedLogger, y as ConsoleLogger, D as Literal, t as LogChatCompletionRequest, u as LogChatCompletionResponse, v as LogLevel, w as Logger, x as NoopLogImplementation, _ as OutputParser, M as PropsOfAIComponent, G as RenderResult, K as Renderable, p as RenderedConversationMessage, V as Span, O as SpanContext, W as SpanEvent, Q as SpanStatus, n as SystemMessage, Y as TracingContext, X as TracingContextKey, Z as TracingContextManager, U as UserMessage, H as attachedContextSymbol, q as computeUsage, j as createAIElement, l as createContext } from './jsx-dev-runtime-LS-DZfkv.js';
3
3
  import { ZodObject, ZodRawShape, ZodTypeAny, ZodString, z } from 'zod';
4
4
  import { OpenAI } from 'openai';
5
5
  export { OpenAI as OpenAIClient } from 'openai';
6
6
  import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam, ChatCompletionCreateParams } from 'openai/resources';
7
7
  import AnthropicClient from '@anthropic-ai/sdk';
8
8
  export { default as AnthropicClient } from '@anthropic-ai/sdk';
9
+ import { ImageBlockParam } from '@anthropic-ai/sdk/resources';
9
10
  export { countTokens as countAnthropicTokens } from '@anthropic-ai/tokenizer';
10
11
 
11
- interface ExceptionWithCode {
12
- code: string | number;
13
- name?: string;
14
- message?: string;
15
- stack?: string;
16
- }
17
- interface ExceptionWithMessage {
18
- code?: string | number;
19
- message: string;
20
- name?: string;
21
- stack?: string;
22
- }
23
- interface ExceptionWithName {
24
- code?: string | number;
25
- message?: string;
26
- name: string;
27
- stack?: string;
28
- }
29
- /**
30
- * Defines Exception.
31
- *
32
- * string or an object with one of (message or name or code) and optional stack
33
- */
34
- type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
35
-
36
- declare class HrTime {
37
- readonly time: [number, number];
38
- constructor(time: [number, number]);
39
- static now(): HrTime;
40
- toISOString(): string;
41
- minus(other: HrTime): number;
42
- }
43
-
44
- type SpanAttributes = Record<string, any>;
45
- interface SpanStatus {
46
- /** The status code of this message. */
47
- code: SpanStatusCode;
48
- /** A developer-facing error message. */
49
- message?: string;
50
- }
51
- interface SpanEvent {
52
- timestamp: string;
53
- time: [number, number];
54
- name: string;
55
- attributes: Record<string, any>;
56
- }
57
- /**
58
- * An enumeration of status codes.
59
- */
60
- declare enum SpanStatusCode {
61
- /**
62
- * The default status.
63
- */
64
- UNSET = 0,
65
- /**
66
- * The operation has been validated by an Application developer or
67
- * Operator to have completed successfully.
68
- */
69
- OK = 1,
70
- /**
71
- * The operation contains an error.
72
- */
73
- ERROR = 2
74
- }
75
- /**
76
- * A SpanContext represents the portion of a {@link Span} which must be
77
- * serialized and propagated along side of a {@link Baggage}.
78
- */
79
- interface SpanContext {
80
- /**
81
- * The ID of the trace that this span belongs to. It is worldwide unique
82
- * with practically sufficient probability by being made as 16 randomly
83
- * generated bytes, encoded as a 32 lowercase hex characters corresponding to
84
- * 128 bits.
85
- */
86
- traceId: string;
87
- /**
88
- * The ID of the Span. It is globally unique with practically sufficient
89
- * probability by being made as 8 randomly generated bytes, encoded as a 16
90
- * lowercase hex characters corresponding to 64 bits.
91
- */
92
- spanId: string;
93
- }
94
- interface Span {
95
- name: string;
96
- parentSpanId: string | null;
97
- startTime: string;
98
- endTime: string | null;
99
- duration: number;
100
- events: SpanEvent[];
101
- /**
102
- * Returns the {@link SpanContext} object associated with this Span.
103
- *
104
- * Get an immutable, serializable identifier for this span that can be used
105
- * to create new child spans. Returned SpanContext is usable even after the
106
- * span ends.
107
- *
108
- * @returns the SpanContext object associated with this Span.
109
- */
110
- spanContext(): SpanContext;
111
- attributes: SpanAttributes;
112
- /**
113
- * Sets an attribute to the span.
114
- *
115
- * Sets a single Attribute with the key and value passed as arguments.
116
- *
117
- * @param key the key for this attribute.
118
- * @param value the value for this attribute. Setting a value null or
119
- * undefined is invalid and will result in undefined behavior.
120
- */
121
- setAttribute(key: string, value: any): this;
122
- /**
123
- * Sets attributes to the span.
124
- *
125
- * @param attributes the attributes that will be added.
126
- * null or undefined attribute values
127
- * are invalid and will result in undefined behavior.
128
- */
129
- setAttributes(attributes: Record<string, any>): this;
130
- /**
131
- * Adds an event to the Span.
132
- *
133
- * @param name the name of the event.
134
- * @param [attributesOrStartTime] the attributes that will be added; these are
135
- * associated with this event. Can be also a start time
136
- * if type is {@type TimeInput} and 3rd param is undefined
137
- * @param [startTime] start time of the event.
138
- */
139
- addEvent(name: string, attributes: SpanAttributes, startTime?: HrTime): this;
140
- setData(key: string, value: any): this;
141
- getData<K = unknown>(key: string): K | undefined;
142
- /**
143
- * Sets a status to the span. If used, this will override the default Span
144
- * status. Default is {@link SpanStatusCode.UNSET}. SetStatus overrides the value
145
- * of previous calls to SetStatus on the Span.
146
- *
147
- * @param status the SpanStatus to set.
148
- */
149
- setStatus(status: SpanStatus): this;
150
- /**
151
- * Updates the Span name.
152
- *
153
- * This will override the name provided via {@link Tracer.startSpan}.
154
- *
155
- * Upon this update, any sampling behavior based on Span name will depend on
156
- * the implementation.
157
- *
158
- * @param name the Span name.
159
- */
160
- updateName(name: string): this;
161
- /**
162
- * Marks the end of Span execution.
163
- *
164
- * Call to End of a Span MUST not have any effects on child spans. Those may
165
- * still be running and can be ended later.
166
- *
167
- * Do not return `this`. The Span generally should not be used after it
168
- * is ended so chaining is not desired in this context.
169
- *
170
- * @param [endTime] the time to set as Span's end time. If not provided,
171
- * use the current time as the span's end time.
172
- */
173
- end(endTime?: HrTime): void;
174
- /**
175
- * Returns the flag whether this span will be recorded.
176
- *
177
- * @returns true if this Span is active and recording information like events
178
- * with the `AddEvent` operation and attributes using `setAttributes`.
179
- */
180
- isRecording(): boolean;
181
- /**
182
- * Sets exception as a span event
183
- * @param exception the exception the only accepted values are string or Error
184
- * @param [time] the time to set as Span's event time. If not provided,
185
- * use the current time.
186
- */
187
- recordException(exception: Exception, time?: HrTime): this;
188
- }
189
-
190
- interface TracingContextKey<_T> {
191
- key: symbol;
192
- }
193
- interface TracingContext {
194
- /**
195
- * Get a value from the context.
196
- *
197
- * @param key key which identifies a context value
198
- */
199
- getValue<T>(key: TracingContextKey<T>): T | undefined;
200
- /**
201
- * Create a new context which inherits from this context and has
202
- * the given key set to the given value.
203
- *
204
- * @param key context key for which to set the value
205
- * @param value value to set for the given key
206
- */
207
- setValue<T>(key: TracingContextKey<T>, value: T): TracingContext;
208
- /**
209
- * Return a new context which inherits from this context but does
210
- * not contain a value for the given key.
211
- *
212
- * @param key context key for which to clear a value
213
- */
214
- deleteValue<T>(key: TracingContextKey<T>): TracingContext;
215
- }
216
-
217
- interface SpanOptions {
218
- /** A span's attributes */
219
- attributes?: SpanAttributes;
220
- /** A manually specified start time for the created `Span` object. */
221
- startTime?: number;
222
- /** The new span should be a root span. (Ignore parent from context). */
223
- root?: boolean;
224
- }
225
- interface Tracer {
226
- /**
227
- * Starts a new {@link Span}. Start the span without setting it on context.
228
- *
229
- * This method do NOT modify the current Context.
230
- *
231
- * @param name The name of the span
232
- * @param [options] SpanOptions used for span creation
233
- * @param [context] Context to use to extract parent
234
- * @returns Span The newly created span
235
- * @example
236
- * const span = tracer.startSpan('op');
237
- * span.setAttribute('key', 'value');
238
- * span.end();
239
- */
240
- startSpan(name: string, options?: SpanOptions, context?: TracingContext): Span;
241
- /**
242
- * Starts a new {@link Span} and calls the given function passing it the
243
- * created span as first argument.
244
- * Additionally the new span gets set in context and this context is activated
245
- * for the duration of the function call.
246
- *
247
- * @param name The name of the span
248
- * @param [options] SpanOptions used for span creation
249
- * @param [context] Context to use to extract parent
250
- * @param fn function called in the context of the span and receives the newly created span as an argument
251
- * @returns return value of fn
252
- * @example
253
- * const something = tracer.startActiveSpan('op', span => {
254
- * try {
255
- * do some work
256
- * span.setStatus({code: SpanStatusCode.OK});
257
- * return something;
258
- * } catch (err) {
259
- * span.setStatus({
260
- * code: SpanStatusCode.ERROR,
261
- * message: err.message,
262
- * });
263
- * throw err;
264
- * } finally {
265
- * span.end();
266
- * }
267
- * });
268
- *
269
- * @example
270
- * const span = tracer.startActiveSpan('op', span => {
271
- * try {
272
- * do some work
273
- * return span;
274
- * } catch (err) {
275
- * span.setStatus({
276
- * code: SpanStatusCode.ERROR,
277
- * message: err.message,
278
- * });
279
- * throw err;
280
- * }
281
- * });
282
- * do some more work
283
- * span.end();
284
- */
285
- startActiveSpan<F extends (span: Span) => unknown>(name: string, fn: F): ReturnType<F>;
286
- startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
287
- startActiveSpan<F extends (span: Span) => unknown>(name: string, options: SpanOptions, context: TracingContext, fn: F): ReturnType<F>;
288
- getActiveSpan(): Span | undefined;
289
- setSpanContext(spanContext: SpanContext): TracingContext;
290
- }
291
-
292
12
  type CreateRenderContextOptions = {
293
- parentSpanId?: string | null;
294
- traceId?: string | null;
295
- contextValues?: ContextValues;
296
13
  logger?: LogImplementation;
14
+ traceId?: string;
15
+ processor?: SpanProcessor;
16
+ contextValues?: ContextValues;
297
17
  };
298
- declare function createRenderContext({ parentSpanId, logger, traceId, contextValues, }?: CreateRenderContextOptions): RenderContext;
18
+ declare function createRenderContext({ logger, traceId, processor, contextValues, }?: CreateRenderContextOptions): RenderContext;
299
19
 
300
- interface TracingContextManager {
301
- /**
302
- * Get the current active context
303
- */
304
- active(): TracingContext;
305
- /**
306
- * Run the fn callback with object set as the current active context
307
- * @param context Any object to set as the current active context
308
- * @param fn A callback to be immediately run within a specific context
309
- * @param thisArg optional receiver to be used for calling fn
310
- * @param args optional arguments forwarded to fn
311
- */
312
- with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: TracingContext, fn: F, ...args: A): ReturnType<F>;
313
- /**
314
- * Bind an object as the current context (or a specific one)
315
- * @param [context] Optionally specify the context which you want to assign
316
- * @param target Any object to which a context need to be set
317
- */
318
- bind<T>(context: TracingContext, target: T): T;
319
- /**
320
- * Enable context management
321
- */
322
- enable(): this;
323
- /**
324
- * Disable context management
325
- */
326
- disable(): this;
327
- }
328
-
329
- interface SpanProcessor {
330
- /**
331
- * Forces to export all finished spans
332
- */
333
- forceFlush(): Promise<void>;
334
- /**
335
- * Called when a {@link Span} is started, if the `span.isRecording()`
336
- * returns true.
337
- * @param span the Span that just started.
338
- */
339
- onStart(span: Span, parentContext: TracingContext): void;
340
- /**
341
- * Called when a {@link ReadableSpan} is ended, if the `span.isRecording()`
342
- * returns true.
343
- * @param span the Span that just ended.
344
- */
345
- onEnd(span: Span): void;
346
- /**
347
- * Shuts down the processor. Called when SDK is shut down. This is an
348
- * opportunity for processor to do any cleanup required.
349
- */
350
- shutdown(): Promise<void>;
351
- }
352
-
353
- /**
354
- * Root public API
355
- */
356
- type AITraceInitOptions = {
357
- spanProcessors?: SpanProcessor[];
358
- contextManager?: TracingContextManager;
359
- };
360
20
  declare class AITraceAPI {
361
21
  private static _instance?;
362
- private initialized;
22
+ private enabled;
363
23
  /** Empty private constructor prevents end users from constructing a new instance of the API */
364
24
  private constructor();
365
25
  /** Get the singleton instance of the Trace API */
366
26
  static getInstance(): AITraceAPI;
367
- init(options: AITraceInitOptions): Tracer;
368
- getTracer(): Tracer;
369
- getActiveContext(): TracingContext;
370
- reset(): void;
27
+ createTracer(opts?: {
28
+ traceId?: string;
29
+ processor?: SpanProcessor;
30
+ }): Tracer;
31
+ enable(): void;
371
32
  disable(): void;
372
- bind<T>(target: T): T;
373
33
  }
34
+ declare const tracing: AITraceAPI;
374
35
 
375
- declare class AsyncLocalStorageContextManager implements TracingContextManager {
376
- private asyncLocalStorage;
377
- constructor();
378
- active(): TracingContext;
379
- with<A extends unknown[], F extends (...args: A) => ReturnType<F>>(context: TracingContext, fn: F, ...args: A): ReturnType<F>;
380
- enable(): this;
381
- disable(): this;
382
- /**
383
- * Binds a the certain context or the active one to the target function and then returns the target
384
- * @param context A context (span) to be bind to target
385
- * @param target a function or event emitter. When target or one of its callbacks is called,
386
- * the provided context will be used as the active context for the duration of the call.
387
- */
388
- bind<T>(context: TracingContext, target: T): T;
389
- protected bindFunction<T extends Function>(context: TracingContext, target: T): T;
390
- protected bindAsyncGenerator<T = unknown, TReturn = any, TNext = unknown>(generator: AsyncGenerator<T, TReturn, TNext>): AsyncGenerator<T, TReturn, TNext>;
36
+ type CostFn = (tokensUsed: {
37
+ prompt: number;
38
+ completion: number;
39
+ total: number;
40
+ }, opts: {
41
+ provider?: string;
42
+ providerRegion?: string;
43
+ model: string;
44
+ }) => number;
45
+ /**
46
+ * Handles the following transformation / enrichment
47
+ * 1. deletes references to prompt (used for evaluation)
48
+ * 2. evaluatorResults
49
+ * 3. sum totalCost on the root span
50
+ * 4. sum totalUsage on the root span
51
+ */
52
+ declare abstract class EnrichingSpanProcessor implements SpanProcessor {
53
+ private readonly exporter;
54
+ protected finalSpans: {
55
+ status: 'running' | 'processing' | 'done';
56
+ span: ReadableSpan;
57
+ }[];
58
+ protected onAllDonePromise: Promise<void> | null;
59
+ protected onAllDonePromiseResolve: (() => void) | null;
60
+ constructor(exporter: SpanExporter);
61
+ onStart(span: ReadableSpan): Promise<void>;
62
+ onEnd(span: ReadableSpan): Promise<void>;
63
+ abstract onTraceComplete(rootSpan: ReadableSpan): Promise<void>;
64
+ abstract enrichSpan(span: ReadableSpan): Promise<ReadableSpan>;
65
+ shutdown(): Promise<void> | undefined;
66
+ }
67
+ declare class AISpanProcessor extends EnrichingSpanProcessor {
68
+ protected totalCost: number;
69
+ protected totalUsage: {
70
+ prompt: number;
71
+ completion: number;
72
+ total: number;
73
+ };
74
+ onTraceComplete(rootSpan: ReadableSpan): Promise<void>;
75
+ enrichSpan(span: ReadableSpan): Promise<ReadableSpan>;
76
+ protected updateCost(span: ReadableSpan): Promise<ReadableSpan>;
77
+ protected updateUsage(span: ReadableSpan): Promise<ReadableSpan>;
78
+ protected evaluatePrompt(span: ReadableSpan): Promise<ReadableSpan>;
391
79
  }
392
80
 
393
- declare namespace aijsxTracing {
394
- const api: AITraceAPI;
395
- const AsyncLocalStorageContextManager: typeof AsyncLocalStorageContextManager;
396
- type Span = Span;
397
- type Tracer = Tracer;
398
- type SpanProcessor = SpanProcessor;
399
- }
81
+ type TraceProps = {
82
+ children: AINode;
83
+ name: string;
84
+ attributes?: SpanAttributes;
85
+ };
86
+ declare const Trace: AIComponent<TraceProps>;
400
87
 
401
88
  /**
402
89
  * This is a helper function to create a JsxPrompt type
@@ -433,10 +120,6 @@ declare function createStreamChain<I extends ZodObject<ZodRawShape>, M extends Z
433
120
  messageSchema?: M;
434
121
  }): StreamChain<z.infer<I>, R>;
435
122
 
436
- declare class PromptParseVariablesError extends Error {
437
- }
438
- declare class ChainParseVariablesError extends Error {
439
- }
440
123
  declare class ParseVariablesError extends Error {
441
124
  }
442
125
  declare class PromptInvalidOutputError extends Error {
@@ -453,17 +136,15 @@ declare module '@gammatech/aijsx' {
453
136
  }
454
137
  }
455
138
  type ValidOpenAIChatModel = 'gpt-4' | 'gpt-4-0314' | 'gpt-4-0613' | 'gpt-4-32k' | 'gpt-4-32k-0314' | 'gpt-4-32k-0613' | 'gpt-4-1106-preview' | 'gpt-3.5-turbo' | 'gpt-3.5-turbo-0301' | 'gpt-3.5-turbo-0613' | 'gpt-3.5-turbo-16k' | 'gpt-3.5-turbo-16k-0613' | 'gpt-3.5-turbo-1106';
456
- declare const OpenAIClientContext: Context<() => OpenAI>;
139
+ declare const OpenAIClientContext: Context<() => ChatCompletionClientAndProvider<OpenAI>>;
457
140
  type OpenAIChatCompletionProps = {
458
141
  model: ValidOpenAIChatModel;
459
142
  maxTokens?: number;
460
143
  temperature?: number;
461
144
  responseFormat?: ChatCompletionCreateParams.ResponseFormat['type'];
462
145
  children: AINode;
463
- provider?: string;
464
- providerRegion?: string;
465
146
  };
466
- declare function OpenAIChatCompletion(props: OpenAIChatCompletionProps, { render, logger, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
147
+ declare function OpenAIChatCompletion(props: OpenAIChatCompletionProps, { logger, render, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
467
148
 
468
149
  type ValidOpenAIVisionModel = 'gpt-4-vision-preview';
469
150
  declare const ContentTypeImage: (_props: {
@@ -479,10 +160,8 @@ type OpenAIVisionChatCompletionProps = {
479
160
  maxTokens?: number;
480
161
  temperature?: number;
481
162
  children: AINode;
482
- provider?: string;
483
- providerRegion?: string;
484
163
  };
485
- declare function OpenAIVisionChatCompletion(props: OpenAIVisionChatCompletionProps, { render, getContext, logger }: RenderContext): AsyncGenerator<string, void, unknown>;
164
+ declare function OpenAIVisionChatCompletion(props: OpenAIVisionChatCompletionProps, { logger, render, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
486
165
 
487
166
  declare const tokenizer: {
488
167
  encode: (text: string) => number[];
@@ -492,7 +171,7 @@ declare function tokenLimitForChatModel(model: ValidOpenAIChatModel): number | u
492
171
  declare function tokenCountForOpenAIMessage(message: OpenAIChatMessage): number;
493
172
  declare function tokenCountForOpenAIVisionMessage(message: OpenAIChatMessage): number;
494
173
 
495
- type AnthropicChatCompletionRequest = AnthropicClient.CompletionCreateParams;
174
+ type AnthropicChatCompletionRequest = AnthropicClient.Messages.MessageStreamParams;
496
175
  declare module '@gammatech/aijsx' {
497
176
  interface ChatCompletionRequestPayloads {
498
177
  anthropic: AnthropicChatCompletionRequest;
@@ -502,19 +181,13 @@ declare module '@gammatech/aijsx' {
502
181
  * The set of valid Claude models.
503
182
  * @see https://docs.anthropic.com/claude/reference/selecting-a-model
504
183
  */
505
- type ValidAnthropicChatModel = 'claude-instant-1.2' | 'claude-2.1';
506
- declare const AnthropicClientContext: Context<() => AnthropicClient>;
507
- /**
508
- * If you use an Anthropic model without specifying the max tokens for the completion, this value will be used as the default.
509
- */
510
- declare const defaultMaxTokens = 4096;
184
+ type ValidAnthropicChatModel = 'claude-instant-1.2' | 'claude-2.1' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229';
185
+ declare const AnthropicClientContext: Context<() => ChatCompletionClientAndProvider<AnthropicClient>>;
511
186
  type AnthropicChatCompletionProps = {
512
187
  model: ValidAnthropicChatModel;
513
188
  maxTokens?: number;
514
189
  temperature?: number;
515
190
  children: AINode;
516
- provider?: string;
517
- providerRegion?: string;
518
191
  };
519
192
  /**
520
193
  * An AI.JSX component that invokes an Anthropic Large Language Model.
@@ -523,6 +196,16 @@ type AnthropicChatCompletionProps = {
523
196
  * @param completionModel The completion model to use.
524
197
  * @param client The Anthropic client.
525
198
  */
526
- declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, { render, getContext, logger }: RenderContext): AsyncGenerator<string, void, unknown>;
199
+ declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, { render, logger, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
200
+
201
+ type ClaudeImageBlockBase64 = {
202
+ data: string;
203
+ mediaType: ImageBlockParam.Source['media_type'];
204
+ };
205
+ type ClaudeImageBlockUrl = {
206
+ url: string;
207
+ };
208
+ type ClaudeImageBlockProps = ClaudeImageBlockBase64 | ClaudeImageBlockUrl;
209
+ declare const ClaudeImageBlock: (props: ClaudeImageBlockProps) => Promise<JSX.Element>;
527
210
 
528
- export { AIComponent, AINode, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, ChainParseVariablesError, ContentTypeImage, Context, EvaluatorFn, EvaluatorResult, FunctionChain, LogImplementation, NotAsyncGenerator, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, ParseVariablesError, Prompt, PromptInvalidOutputError, PromptParseVariablesError, PromptParsed, RenderContext, StreamChain, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, aijsxTracing, createFunctionChain, createPrompt, createRenderContext, createStreamChain, defaultMaxTokens, evaluatePrompt, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer };
211
+ export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, ChatCompletionClientAndProvider, ClaudeImageBlock, ContentTypeImage, Context, type CostFn, EnrichingSpanProcessor, EvaluatorFn, EvaluatorResult, FunctionChain, LogImplementation, NotAsyncGenerator, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, ParseVariablesError, Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, SpanAttributes, SpanExporter, SpanProcessor, StreamChain, Trace, Tracer, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createFunctionChain, createPrompt, createRenderContext, createStreamChain, evaluatePrompt, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer, tracing };