@gammatech/aijsx 0.5.0-dev.2024-03-11 → 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.mts CHANGED
@@ -1,5 +1,5 @@
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, J as JSX } from './jsx-dev-runtime-zWb34twz.mjs';
2
- export { H as AIElement, j as AIFragment, n as AssistantMessage, B as BoundLogger, q as ChatCompletionError, r as ChatCompletionRequestPayloads, l as ChatCompletionRole, y as CombinedLogger, x as ConsoleLogger, z as Literal, s as LogChatCompletionRequest, t as LogChatCompletionResponse, u as LogLevel, v as Logger, w as NoopLogImplementation, Z as OutputParser, K as PropsOfAIComponent, D as RenderResult, I as Renderable, o as RenderedConversationMessage, Q as Span, M as SpanContext, V as SpanEvent, O as SpanStatus, m as SystemMessage, X as TracingContext, W as TracingContextKey, Y as TracingContextManager, U as UserMessage, G as attachedContextSymbol, p as computeUsage, i as createAIElement, k as createContext } from './jsx-dev-runtime-zWb34twz.mjs';
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.mjs';
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.mjs';
3
3
  import { ZodObject, ZodRawShape, ZodTypeAny, ZodString, z } from 'zod';
4
4
  import { OpenAI } from 'openai';
5
5
  export { OpenAI as OpenAIClient } from 'openai';
@@ -65,19 +65,15 @@ declare abstract class EnrichingSpanProcessor implements SpanProcessor {
65
65
  shutdown(): Promise<void> | undefined;
66
66
  }
67
67
  declare class AISpanProcessor extends EnrichingSpanProcessor {
68
- private readonly opts;
69
68
  protected totalCost: number;
70
69
  protected totalUsage: {
71
70
  prompt: number;
72
71
  completion: number;
73
72
  total: number;
74
73
  };
75
- constructor(exporter: SpanExporter, opts?: {
76
- costFn?: CostFn;
77
- });
78
74
  onTraceComplete(rootSpan: ReadableSpan): Promise<void>;
79
75
  enrichSpan(span: ReadableSpan): Promise<ReadableSpan>;
80
- protected computeCost(span: ReadableSpan): Promise<ReadableSpan>;
76
+ protected updateCost(span: ReadableSpan): Promise<ReadableSpan>;
81
77
  protected updateUsage(span: ReadableSpan): Promise<ReadableSpan>;
82
78
  protected evaluatePrompt(span: ReadableSpan): Promise<ReadableSpan>;
83
79
  }
@@ -140,15 +136,13 @@ declare module '@gammatech/aijsx' {
140
136
  }
141
137
  }
142
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';
143
- declare const OpenAIClientContext: Context<() => OpenAI>;
139
+ declare const OpenAIClientContext: Context<() => ChatCompletionClientAndProvider<OpenAI>>;
144
140
  type OpenAIChatCompletionProps = {
145
141
  model: ValidOpenAIChatModel;
146
142
  maxTokens?: number;
147
143
  temperature?: number;
148
144
  responseFormat?: ChatCompletionCreateParams.ResponseFormat['type'];
149
145
  children: AINode;
150
- provider?: string;
151
- providerRegion?: string;
152
146
  };
153
147
  declare function OpenAIChatCompletion(props: OpenAIChatCompletionProps, { logger, render, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
154
148
 
@@ -166,8 +160,6 @@ type OpenAIVisionChatCompletionProps = {
166
160
  maxTokens?: number;
167
161
  temperature?: number;
168
162
  children: AINode;
169
- provider?: string;
170
- providerRegion?: string;
171
163
  };
172
164
  declare function OpenAIVisionChatCompletion(props: OpenAIVisionChatCompletionProps, { logger, render, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
173
165
 
@@ -190,14 +182,12 @@ declare module '@gammatech/aijsx' {
190
182
  * @see https://docs.anthropic.com/claude/reference/selecting-a-model
191
183
  */
192
184
  type ValidAnthropicChatModel = 'claude-instant-1.2' | 'claude-2.1' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229';
193
- declare const AnthropicClientContext: Context<() => AnthropicClient>;
185
+ declare const AnthropicClientContext: Context<() => ChatCompletionClientAndProvider<AnthropicClient>>;
194
186
  type AnthropicChatCompletionProps = {
195
187
  model: ValidAnthropicChatModel;
196
188
  maxTokens?: number;
197
189
  temperature?: number;
198
190
  children: AINode;
199
- provider?: string;
200
- providerRegion?: string;
201
191
  };
202
192
  /**
203
193
  * An AI.JSX component that invokes an Anthropic Large Language Model.
@@ -210,20 +200,12 @@ declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, {
210
200
 
211
201
  type ClaudeImageBlockBase64 = {
212
202
  data: string;
213
- dimensions?: {
214
- width: number;
215
- height: number;
216
- };
217
203
  mediaType: ImageBlockParam.Source['media_type'];
218
204
  };
219
205
  type ClaudeImageBlockUrl = {
220
206
  url: string;
221
- dimensions?: {
222
- width: number;
223
- height: number;
224
- };
225
207
  };
226
208
  type ClaudeImageBlockProps = ClaudeImageBlockBase64 | ClaudeImageBlockUrl;
227
209
  declare const ClaudeImageBlock: (props: ClaudeImageBlockProps) => Promise<JSX.Element>;
228
210
 
229
- export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, 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 };
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 };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
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, J as JSX } from './jsx-dev-runtime-zWb34twz.js';
2
- export { H as AIElement, j as AIFragment, n as AssistantMessage, B as BoundLogger, q as ChatCompletionError, r as ChatCompletionRequestPayloads, l as ChatCompletionRole, y as CombinedLogger, x as ConsoleLogger, z as Literal, s as LogChatCompletionRequest, t as LogChatCompletionResponse, u as LogLevel, v as Logger, w as NoopLogImplementation, Z as OutputParser, K as PropsOfAIComponent, D as RenderResult, I as Renderable, o as RenderedConversationMessage, Q as Span, M as SpanContext, V as SpanEvent, O as SpanStatus, m as SystemMessage, X as TracingContext, W as TracingContextKey, Y as TracingContextManager, U as UserMessage, G as attachedContextSymbol, p as computeUsage, i as createAIElement, k as createContext } from './jsx-dev-runtime-zWb34twz.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';
@@ -65,19 +65,15 @@ declare abstract class EnrichingSpanProcessor implements SpanProcessor {
65
65
  shutdown(): Promise<void> | undefined;
66
66
  }
67
67
  declare class AISpanProcessor extends EnrichingSpanProcessor {
68
- private readonly opts;
69
68
  protected totalCost: number;
70
69
  protected totalUsage: {
71
70
  prompt: number;
72
71
  completion: number;
73
72
  total: number;
74
73
  };
75
- constructor(exporter: SpanExporter, opts?: {
76
- costFn?: CostFn;
77
- });
78
74
  onTraceComplete(rootSpan: ReadableSpan): Promise<void>;
79
75
  enrichSpan(span: ReadableSpan): Promise<ReadableSpan>;
80
- protected computeCost(span: ReadableSpan): Promise<ReadableSpan>;
76
+ protected updateCost(span: ReadableSpan): Promise<ReadableSpan>;
81
77
  protected updateUsage(span: ReadableSpan): Promise<ReadableSpan>;
82
78
  protected evaluatePrompt(span: ReadableSpan): Promise<ReadableSpan>;
83
79
  }
@@ -140,15 +136,13 @@ declare module '@gammatech/aijsx' {
140
136
  }
141
137
  }
142
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';
143
- declare const OpenAIClientContext: Context<() => OpenAI>;
139
+ declare const OpenAIClientContext: Context<() => ChatCompletionClientAndProvider<OpenAI>>;
144
140
  type OpenAIChatCompletionProps = {
145
141
  model: ValidOpenAIChatModel;
146
142
  maxTokens?: number;
147
143
  temperature?: number;
148
144
  responseFormat?: ChatCompletionCreateParams.ResponseFormat['type'];
149
145
  children: AINode;
150
- provider?: string;
151
- providerRegion?: string;
152
146
  };
153
147
  declare function OpenAIChatCompletion(props: OpenAIChatCompletionProps, { logger, render, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
154
148
 
@@ -166,8 +160,6 @@ type OpenAIVisionChatCompletionProps = {
166
160
  maxTokens?: number;
167
161
  temperature?: number;
168
162
  children: AINode;
169
- provider?: string;
170
- providerRegion?: string;
171
163
  };
172
164
  declare function OpenAIVisionChatCompletion(props: OpenAIVisionChatCompletionProps, { logger, render, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
173
165
 
@@ -190,14 +182,12 @@ declare module '@gammatech/aijsx' {
190
182
  * @see https://docs.anthropic.com/claude/reference/selecting-a-model
191
183
  */
192
184
  type ValidAnthropicChatModel = 'claude-instant-1.2' | 'claude-2.1' | 'claude-3-opus-20240229' | 'claude-3-sonnet-20240229';
193
- declare const AnthropicClientContext: Context<() => AnthropicClient>;
185
+ declare const AnthropicClientContext: Context<() => ChatCompletionClientAndProvider<AnthropicClient>>;
194
186
  type AnthropicChatCompletionProps = {
195
187
  model: ValidAnthropicChatModel;
196
188
  maxTokens?: number;
197
189
  temperature?: number;
198
190
  children: AINode;
199
- provider?: string;
200
- providerRegion?: string;
201
191
  };
202
192
  /**
203
193
  * An AI.JSX component that invokes an Anthropic Large Language Model.
@@ -210,20 +200,12 @@ declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, {
210
200
 
211
201
  type ClaudeImageBlockBase64 = {
212
202
  data: string;
213
- dimensions?: {
214
- width: number;
215
- height: number;
216
- };
217
203
  mediaType: ImageBlockParam.Source['media_type'];
218
204
  };
219
205
  type ClaudeImageBlockUrl = {
220
206
  url: string;
221
- dimensions?: {
222
- width: number;
223
- height: number;
224
- };
225
207
  };
226
208
  type ClaudeImageBlockProps = ClaudeImageBlockBase64 | ClaudeImageBlockUrl;
227
209
  declare const ClaudeImageBlock: (props: ClaudeImageBlockProps) => Promise<JSX.Element>;
228
210
 
229
- export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, 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 };
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 };
package/dist/index.js CHANGED
@@ -1469,10 +1469,6 @@ var EnrichingSpanProcessor = class {
1469
1469
  }
1470
1470
  };
1471
1471
  var AISpanProcessor = class extends EnrichingSpanProcessor {
1472
- constructor(exporter, opts = {}) {
1473
- super(exporter);
1474
- this.opts = opts;
1475
- }
1476
1472
  totalCost = 0;
1477
1473
  totalUsage = {
1478
1474
  prompt: 0,
@@ -1485,32 +1481,19 @@ var AISpanProcessor = class extends EnrichingSpanProcessor {
1485
1481
  }
1486
1482
  async enrichSpan(span) {
1487
1483
  const result1 = await this.evaluatePrompt(span);
1488
- const result2 = await this.computeCost(result1);
1484
+ const result2 = await this.updateCost(result1);
1489
1485
  const result3 = await this.updateUsage(result2);
1490
1486
  return result3;
1491
1487
  }
1492
- async computeCost(span) {
1493
- if (!this.opts.costFn) {
1494
- return span;
1495
- }
1488
+ async updateCost(span) {
1496
1489
  if (!isChatCompletionSpan(span)) {
1497
1490
  return span;
1498
1491
  }
1499
- const cost = this.opts.costFn(span.attributes.tokensUsed, {
1500
- model: span.attributes.model,
1501
- provider: span.attributes.provider,
1502
- providerRegion: span.attributes.providerRegion
1503
- });
1492
+ const { cost } = span.attributes;
1504
1493
  if (typeof cost === "number") {
1505
1494
  this.totalCost += cost;
1506
1495
  }
1507
- return {
1508
- ...span,
1509
- attributes: {
1510
- ...span.attributes,
1511
- cost
1512
- }
1513
- };
1496
+ return span;
1514
1497
  }
1515
1498
  async updateUsage(span) {
1516
1499
  if (!isChatCompletionSpan(span)) {
@@ -1762,7 +1745,11 @@ var OpenAIClientContext = createContext(() => {
1762
1745
  return defaultClient;
1763
1746
  }
1764
1747
  const apiKey = getEnvVar("OPENAI_API_KEY", true);
1765
- defaultClient = new import_openai.OpenAI({ apiKey });
1748
+ const client = new import_openai.OpenAI({ apiKey });
1749
+ defaultClient = {
1750
+ client,
1751
+ provider: "openai"
1752
+ };
1766
1753
  return defaultClient;
1767
1754
  });
1768
1755
  function buildOpenAIMessages(childrenXml) {
@@ -1801,7 +1788,7 @@ function OpenAIChatCompletion(props, { logger, render, tracer, getContext }) {
1801
1788
  "ai.chatCompletion",
1802
1789
  {},
1803
1790
  async function* OpenAIChatCompletionInner(span) {
1804
- const client = getContext(OpenAIClientContext)();
1791
+ const { client, provider, providerRegion, costFn } = getContext(OpenAIClientContext)();
1805
1792
  if (!client) {
1806
1793
  throw new Error("[OpenAI] must supply OpenAI model via context");
1807
1794
  }
@@ -1830,16 +1817,16 @@ function OpenAIChatCompletion(props, { logger, render, tracer, getContext }) {
1830
1817
  const logRequestData = {
1831
1818
  startTime,
1832
1819
  model: props.model,
1833
- provider: props.provider,
1834
- providerRegion: props.providerRegion,
1820
+ provider,
1821
+ providerRegion,
1835
1822
  inputMessages: renderedMessages,
1836
1823
  request: chatCompletionRequest
1837
1824
  };
1838
1825
  logger.chatCompletionRequest("openai", logRequestData);
1839
1826
  span.setAttributes({
1840
1827
  model: props.model,
1841
- provider: props.provider,
1842
- providerRegion: props.providerRegion,
1828
+ provider,
1829
+ providerRegion,
1843
1830
  requestType: "openai",
1844
1831
  chatCompletionRequest
1845
1832
  });
@@ -1883,6 +1870,7 @@ function OpenAIChatCompletion(props, { logger, render, tracer, getContext }) {
1883
1870
  })
1884
1871
  };
1885
1872
  const tokensUsed = computeUsage([...renderedMessages, outputMessage]);
1873
+ const cost = costFn?.(tokensUsed) ?? void 0;
1886
1874
  const responseData = {
1887
1875
  ...logRequestData,
1888
1876
  finishReason,
@@ -1894,7 +1882,8 @@ function OpenAIChatCompletion(props, { logger, render, tracer, getContext }) {
1894
1882
  span.setAttributes({
1895
1883
  tokensUsed,
1896
1884
  output: content,
1897
- finishReason
1885
+ finishReason,
1886
+ cost
1898
1887
  });
1899
1888
  }
1900
1889
  );
@@ -1970,7 +1959,7 @@ function OpenAIVisionChatCompletion(props, { logger, render, tracer, getContext
1970
1959
  "ai.chatCompletion",
1971
1960
  {},
1972
1961
  async function* OpenAIVIsionChatCompletionInner(span) {
1973
- const client = getContext(OpenAIClientContext)();
1962
+ const { client, provider, providerRegion, costFn } = getContext(OpenAIClientContext)();
1974
1963
  if (!client) {
1975
1964
  throw new Error("[OpenAI] must supply OpenAI model via context");
1976
1965
  }
@@ -2041,16 +2030,16 @@ function OpenAIVisionChatCompletion(props, { logger, render, tracer, getContext
2041
2030
  const logRequestData = {
2042
2031
  startTime,
2043
2032
  model,
2044
- provider: props.provider,
2045
- providerRegion: props.providerRegion,
2033
+ provider,
2034
+ providerRegion,
2046
2035
  inputMessages: renderedMessages,
2047
2036
  request: chatCompletionRequest
2048
2037
  };
2049
2038
  logger.chatCompletionRequest("openai", logRequestData);
2050
2039
  span.setAttributes({
2051
2040
  model: props.model,
2052
- provider: props.provider,
2053
- providerRegion: props.providerRegion,
2041
+ provider,
2042
+ providerRegion,
2054
2043
  requestType: "openai",
2055
2044
  chatCompletionRequest
2056
2045
  });
@@ -2094,6 +2083,7 @@ function OpenAIVisionChatCompletion(props, { logger, render, tracer, getContext
2094
2083
  })
2095
2084
  };
2096
2085
  const tokensUsed = computeUsage([...renderedMessages, outputMessage]);
2086
+ const cost = costFn?.(tokensUsed) ?? void 0;
2097
2087
  const responseData = {
2098
2088
  ...logRequestData,
2099
2089
  finishReason,
@@ -2105,6 +2095,7 @@ function OpenAIVisionChatCompletion(props, { logger, render, tracer, getContext
2105
2095
  span.setAttributes({
2106
2096
  tokensUsed,
2107
2097
  output: content,
2098
+ cost,
2108
2099
  finishReason
2109
2100
  });
2110
2101
  }
@@ -2118,17 +2109,19 @@ var import_openai3 = require("openai");
2118
2109
  var import_sdk = __toESM(require("@anthropic-ai/sdk"));
2119
2110
  var import_tokenizer3 = require("@anthropic-ai/tokenizer");
2120
2111
  var defaultClient2 = null;
2121
- var AnthropicClientContext = createContext(
2122
- () => {
2123
- if (defaultClient2) {
2124
- return defaultClient2;
2125
- }
2126
- defaultClient2 = new import_sdk.default({
2127
- apiKey: getEnvVar("ANTHROPIC_API_KEY", false)
2128
- });
2112
+ var AnthropicClientContext = createContext(() => {
2113
+ if (defaultClient2) {
2129
2114
  return defaultClient2;
2130
2115
  }
2131
- );
2116
+ const client = new import_sdk.default({
2117
+ apiKey: getEnvVar("ANTHROPIC_API_KEY", false)
2118
+ });
2119
+ defaultClient2 = {
2120
+ client,
2121
+ provider: "anthropic"
2122
+ };
2123
+ return defaultClient2;
2124
+ });
2132
2125
  var defaultMaxTokens = 4096;
2133
2126
  function buildAnthropicMessages(childrenXml) {
2134
2127
  let system = "";
@@ -2146,7 +2139,6 @@ function buildAnthropicMessages(childrenXml) {
2146
2139
  if (!topLevelValid) {
2147
2140
  throw new Error("Invalid top level chat message tags");
2148
2141
  }
2149
- const dimensions = /* @__PURE__ */ new WeakMap();
2150
2142
  for (const node of parsed.childNodes) {
2151
2143
  if (node.nodeName === "UserMessage") {
2152
2144
  if (node.childNodes?.length === 1 && node.childNodes[0].nodeName === "#text") {
@@ -2171,7 +2163,6 @@ function buildAnthropicMessages(childrenXml) {
2171
2163
  data: n.attributes.data
2172
2164
  }
2173
2165
  };
2174
- dimensions.set(imagePart, n.attributes.dimensions);
2175
2166
  return imagePart;
2176
2167
  }
2177
2168
  throw new Error(
@@ -2191,7 +2182,7 @@ function buildAnthropicMessages(childrenXml) {
2191
2182
  system = node.textContent;
2192
2183
  }
2193
2184
  }
2194
- return { messages, system, dimensions };
2185
+ return { messages, system };
2195
2186
  }
2196
2187
  function AnthropicChatCompletion(props, { render, logger, tracer, getContext }) {
2197
2188
  const startTime = performance.now();
@@ -2199,7 +2190,9 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2199
2190
  "ai.chatCompletion",
2200
2191
  {},
2201
2192
  async function* AnthropicChatCompletionInner(span) {
2202
- const client = getContext(AnthropicClientContext)();
2193
+ const { client, provider, providerRegion, costFn } = getContext(
2194
+ AnthropicClientContext
2195
+ )();
2203
2196
  if (!client) {
2204
2197
  throw new Error(
2205
2198
  "[AnthropicChatCompletion] must supply AnthropicClient via context"
@@ -2211,7 +2204,6 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2211
2204
  renderedProps: {
2212
2205
  ClaudeImageBlockParam: {
2213
2206
  data: true,
2214
- dimensions: true,
2215
2207
  mediaType: true
2216
2208
  }
2217
2209
  }
@@ -2228,16 +2220,16 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2228
2220
  const logRequestData = {
2229
2221
  startTime,
2230
2222
  model: props.model,
2231
- provider: props.provider,
2232
- providerRegion: props.providerRegion,
2223
+ provider,
2224
+ providerRegion,
2233
2225
  inputMessages,
2234
2226
  request: anthropicCompletionRequest
2235
2227
  };
2236
2228
  logger.chatCompletionRequest("anthropic", logRequestData);
2237
2229
  span.setAttributes({
2238
2230
  model: props.model,
2239
- provider: props.provider,
2240
- providerRegion: props.providerRegion,
2231
+ provider,
2232
+ providerRegion,
2241
2233
  requestType: "anthropic",
2242
2234
  chatCompletionRequest: anthropicCompletionRequest
2243
2235
  });
@@ -2292,6 +2284,7 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2292
2284
  userMessage.tokens = inputUsage - restMessagesTokens;
2293
2285
  }
2294
2286
  const tokensUsed = computeUsage([...inputMessages, outputMessage]);
2287
+ const cost = costFn?.(tokensUsed) ?? void 0;
2295
2288
  const responseData = {
2296
2289
  ...logRequestData,
2297
2290
  finishReason,
@@ -2307,6 +2300,7 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2307
2300
  span.setAttributes({
2308
2301
  tokensUsed,
2309
2302
  output: content,
2303
+ cost,
2310
2304
  finishReason
2311
2305
  });
2312
2306
  }
@@ -2377,16 +2371,9 @@ var ClaudeImageBlock = async (props) => {
2377
2371
  if ("data" in props) {
2378
2372
  return /* @__PURE__ */ jsx(ClaudeImageBlockParam, { ...props });
2379
2373
  }
2380
- const { dimensions, url } = props;
2374
+ const { url } = props;
2381
2375
  const { base64, mediaType } = await fetchImageAndConvertToBase64(url);
2382
- return /* @__PURE__ */ jsx(
2383
- ClaudeImageBlockParam,
2384
- {
2385
- dimensions,
2386
- mediaType,
2387
- data: base64
2388
- }
2389
- );
2376
+ return /* @__PURE__ */ jsx(ClaudeImageBlockParam, { mediaType, data: base64 });
2390
2377
  };
2391
2378
 
2392
2379
  // src/lib/anthropic/index.ts
package/dist/index.mjs CHANGED
@@ -1371,10 +1371,6 @@ var EnrichingSpanProcessor = class {
1371
1371
  }
1372
1372
  };
1373
1373
  var AISpanProcessor = class extends EnrichingSpanProcessor {
1374
- constructor(exporter, opts = {}) {
1375
- super(exporter);
1376
- this.opts = opts;
1377
- }
1378
1374
  totalCost = 0;
1379
1375
  totalUsage = {
1380
1376
  prompt: 0,
@@ -1387,32 +1383,19 @@ var AISpanProcessor = class extends EnrichingSpanProcessor {
1387
1383
  }
1388
1384
  async enrichSpan(span) {
1389
1385
  const result1 = await this.evaluatePrompt(span);
1390
- const result2 = await this.computeCost(result1);
1386
+ const result2 = await this.updateCost(result1);
1391
1387
  const result3 = await this.updateUsage(result2);
1392
1388
  return result3;
1393
1389
  }
1394
- async computeCost(span) {
1395
- if (!this.opts.costFn) {
1396
- return span;
1397
- }
1390
+ async updateCost(span) {
1398
1391
  if (!isChatCompletionSpan(span)) {
1399
1392
  return span;
1400
1393
  }
1401
- const cost = this.opts.costFn(span.attributes.tokensUsed, {
1402
- model: span.attributes.model,
1403
- provider: span.attributes.provider,
1404
- providerRegion: span.attributes.providerRegion
1405
- });
1394
+ const { cost } = span.attributes;
1406
1395
  if (typeof cost === "number") {
1407
1396
  this.totalCost += cost;
1408
1397
  }
1409
- return {
1410
- ...span,
1411
- attributes: {
1412
- ...span.attributes,
1413
- cost
1414
- }
1415
- };
1398
+ return span;
1416
1399
  }
1417
1400
  async updateUsage(span) {
1418
1401
  if (!isChatCompletionSpan(span)) {
@@ -1664,7 +1647,11 @@ var OpenAIClientContext = createContext(() => {
1664
1647
  return defaultClient;
1665
1648
  }
1666
1649
  const apiKey = getEnvVar("OPENAI_API_KEY", true);
1667
- defaultClient = new OpenAIClient({ apiKey });
1650
+ const client = new OpenAIClient({ apiKey });
1651
+ defaultClient = {
1652
+ client,
1653
+ provider: "openai"
1654
+ };
1668
1655
  return defaultClient;
1669
1656
  });
1670
1657
  function buildOpenAIMessages(childrenXml) {
@@ -1703,7 +1690,7 @@ function OpenAIChatCompletion(props, { logger, render, tracer, getContext }) {
1703
1690
  "ai.chatCompletion",
1704
1691
  {},
1705
1692
  async function* OpenAIChatCompletionInner(span) {
1706
- const client = getContext(OpenAIClientContext)();
1693
+ const { client, provider, providerRegion, costFn } = getContext(OpenAIClientContext)();
1707
1694
  if (!client) {
1708
1695
  throw new Error("[OpenAI] must supply OpenAI model via context");
1709
1696
  }
@@ -1732,16 +1719,16 @@ function OpenAIChatCompletion(props, { logger, render, tracer, getContext }) {
1732
1719
  const logRequestData = {
1733
1720
  startTime,
1734
1721
  model: props.model,
1735
- provider: props.provider,
1736
- providerRegion: props.providerRegion,
1722
+ provider,
1723
+ providerRegion,
1737
1724
  inputMessages: renderedMessages,
1738
1725
  request: chatCompletionRequest
1739
1726
  };
1740
1727
  logger.chatCompletionRequest("openai", logRequestData);
1741
1728
  span.setAttributes({
1742
1729
  model: props.model,
1743
- provider: props.provider,
1744
- providerRegion: props.providerRegion,
1730
+ provider,
1731
+ providerRegion,
1745
1732
  requestType: "openai",
1746
1733
  chatCompletionRequest
1747
1734
  });
@@ -1785,6 +1772,7 @@ function OpenAIChatCompletion(props, { logger, render, tracer, getContext }) {
1785
1772
  })
1786
1773
  };
1787
1774
  const tokensUsed = computeUsage([...renderedMessages, outputMessage]);
1775
+ const cost = costFn?.(tokensUsed) ?? void 0;
1788
1776
  const responseData = {
1789
1777
  ...logRequestData,
1790
1778
  finishReason,
@@ -1796,7 +1784,8 @@ function OpenAIChatCompletion(props, { logger, render, tracer, getContext }) {
1796
1784
  span.setAttributes({
1797
1785
  tokensUsed,
1798
1786
  output: content,
1799
- finishReason
1787
+ finishReason,
1788
+ cost
1800
1789
  });
1801
1790
  }
1802
1791
  );
@@ -1872,7 +1861,7 @@ function OpenAIVisionChatCompletion(props, { logger, render, tracer, getContext
1872
1861
  "ai.chatCompletion",
1873
1862
  {},
1874
1863
  async function* OpenAIVIsionChatCompletionInner(span) {
1875
- const client = getContext(OpenAIClientContext)();
1864
+ const { client, provider, providerRegion, costFn } = getContext(OpenAIClientContext)();
1876
1865
  if (!client) {
1877
1866
  throw new Error("[OpenAI] must supply OpenAI model via context");
1878
1867
  }
@@ -1943,16 +1932,16 @@ function OpenAIVisionChatCompletion(props, { logger, render, tracer, getContext
1943
1932
  const logRequestData = {
1944
1933
  startTime,
1945
1934
  model,
1946
- provider: props.provider,
1947
- providerRegion: props.providerRegion,
1935
+ provider,
1936
+ providerRegion,
1948
1937
  inputMessages: renderedMessages,
1949
1938
  request: chatCompletionRequest
1950
1939
  };
1951
1940
  logger.chatCompletionRequest("openai", logRequestData);
1952
1941
  span.setAttributes({
1953
1942
  model: props.model,
1954
- provider: props.provider,
1955
- providerRegion: props.providerRegion,
1943
+ provider,
1944
+ providerRegion,
1956
1945
  requestType: "openai",
1957
1946
  chatCompletionRequest
1958
1947
  });
@@ -1996,6 +1985,7 @@ function OpenAIVisionChatCompletion(props, { logger, render, tracer, getContext
1996
1985
  })
1997
1986
  };
1998
1987
  const tokensUsed = computeUsage([...renderedMessages, outputMessage]);
1988
+ const cost = costFn?.(tokensUsed) ?? void 0;
1999
1989
  const responseData = {
2000
1990
  ...logRequestData,
2001
1991
  finishReason,
@@ -2007,6 +1997,7 @@ function OpenAIVisionChatCompletion(props, { logger, render, tracer, getContext
2007
1997
  span.setAttributes({
2008
1998
  tokensUsed,
2009
1999
  output: content,
2000
+ cost,
2010
2001
  finishReason
2011
2002
  });
2012
2003
  }
@@ -2020,17 +2011,19 @@ import { OpenAI as OpenAIClient3 } from "openai";
2020
2011
  import AnthropicClient from "@anthropic-ai/sdk";
2021
2012
  import { countTokens } from "@anthropic-ai/tokenizer";
2022
2013
  var defaultClient2 = null;
2023
- var AnthropicClientContext = createContext(
2024
- () => {
2025
- if (defaultClient2) {
2026
- return defaultClient2;
2027
- }
2028
- defaultClient2 = new AnthropicClient({
2029
- apiKey: getEnvVar("ANTHROPIC_API_KEY", false)
2030
- });
2014
+ var AnthropicClientContext = createContext(() => {
2015
+ if (defaultClient2) {
2031
2016
  return defaultClient2;
2032
2017
  }
2033
- );
2018
+ const client = new AnthropicClient({
2019
+ apiKey: getEnvVar("ANTHROPIC_API_KEY", false)
2020
+ });
2021
+ defaultClient2 = {
2022
+ client,
2023
+ provider: "anthropic"
2024
+ };
2025
+ return defaultClient2;
2026
+ });
2034
2027
  var defaultMaxTokens = 4096;
2035
2028
  function buildAnthropicMessages(childrenXml) {
2036
2029
  let system = "";
@@ -2048,7 +2041,6 @@ function buildAnthropicMessages(childrenXml) {
2048
2041
  if (!topLevelValid) {
2049
2042
  throw new Error("Invalid top level chat message tags");
2050
2043
  }
2051
- const dimensions = /* @__PURE__ */ new WeakMap();
2052
2044
  for (const node of parsed.childNodes) {
2053
2045
  if (node.nodeName === "UserMessage") {
2054
2046
  if (node.childNodes?.length === 1 && node.childNodes[0].nodeName === "#text") {
@@ -2073,7 +2065,6 @@ function buildAnthropicMessages(childrenXml) {
2073
2065
  data: n.attributes.data
2074
2066
  }
2075
2067
  };
2076
- dimensions.set(imagePart, n.attributes.dimensions);
2077
2068
  return imagePart;
2078
2069
  }
2079
2070
  throw new Error(
@@ -2093,7 +2084,7 @@ function buildAnthropicMessages(childrenXml) {
2093
2084
  system = node.textContent;
2094
2085
  }
2095
2086
  }
2096
- return { messages, system, dimensions };
2087
+ return { messages, system };
2097
2088
  }
2098
2089
  function AnthropicChatCompletion(props, { render, logger, tracer, getContext }) {
2099
2090
  const startTime = performance.now();
@@ -2101,7 +2092,9 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2101
2092
  "ai.chatCompletion",
2102
2093
  {},
2103
2094
  async function* AnthropicChatCompletionInner(span) {
2104
- const client = getContext(AnthropicClientContext)();
2095
+ const { client, provider, providerRegion, costFn } = getContext(
2096
+ AnthropicClientContext
2097
+ )();
2105
2098
  if (!client) {
2106
2099
  throw new Error(
2107
2100
  "[AnthropicChatCompletion] must supply AnthropicClient via context"
@@ -2113,7 +2106,6 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2113
2106
  renderedProps: {
2114
2107
  ClaudeImageBlockParam: {
2115
2108
  data: true,
2116
- dimensions: true,
2117
2109
  mediaType: true
2118
2110
  }
2119
2111
  }
@@ -2130,16 +2122,16 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2130
2122
  const logRequestData = {
2131
2123
  startTime,
2132
2124
  model: props.model,
2133
- provider: props.provider,
2134
- providerRegion: props.providerRegion,
2125
+ provider,
2126
+ providerRegion,
2135
2127
  inputMessages,
2136
2128
  request: anthropicCompletionRequest
2137
2129
  };
2138
2130
  logger.chatCompletionRequest("anthropic", logRequestData);
2139
2131
  span.setAttributes({
2140
2132
  model: props.model,
2141
- provider: props.provider,
2142
- providerRegion: props.providerRegion,
2133
+ provider,
2134
+ providerRegion,
2143
2135
  requestType: "anthropic",
2144
2136
  chatCompletionRequest: anthropicCompletionRequest
2145
2137
  });
@@ -2194,6 +2186,7 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2194
2186
  userMessage.tokens = inputUsage - restMessagesTokens;
2195
2187
  }
2196
2188
  const tokensUsed = computeUsage([...inputMessages, outputMessage]);
2189
+ const cost = costFn?.(tokensUsed) ?? void 0;
2197
2190
  const responseData = {
2198
2191
  ...logRequestData,
2199
2192
  finishReason,
@@ -2209,6 +2202,7 @@ function AnthropicChatCompletion(props, { render, logger, tracer, getContext })
2209
2202
  span.setAttributes({
2210
2203
  tokensUsed,
2211
2204
  output: content,
2205
+ cost,
2212
2206
  finishReason
2213
2207
  });
2214
2208
  }
@@ -2279,16 +2273,9 @@ var ClaudeImageBlock = async (props) => {
2279
2273
  if ("data" in props) {
2280
2274
  return /* @__PURE__ */ jsx(ClaudeImageBlockParam, { ...props });
2281
2275
  }
2282
- const { dimensions, url } = props;
2276
+ const { url } = props;
2283
2277
  const { base64, mediaType } = await fetchImageAndConvertToBase64(url);
2284
- return /* @__PURE__ */ jsx(
2285
- ClaudeImageBlockParam,
2286
- {
2287
- dimensions,
2288
- mediaType,
2289
- data: base64
2290
- }
2291
- );
2278
+ return /* @__PURE__ */ jsx(ClaudeImageBlockParam, { mediaType, data: base64 });
2292
2279
  };
2293
2280
 
2294
2281
  // src/lib/anthropic/index.ts
@@ -283,6 +283,15 @@ declare class CombinedLogger extends LogImplementation {
283
283
  chatCompletionResponse<_K extends keyof ChatCompletionRequestPayloads>(...args: Parameters<LogImplementation['chatCompletionResponse']>): void;
284
284
  }
285
285
 
286
+ type ChatCompletionClientAndProvider<K> = {
287
+ client: K;
288
+ provider?: string;
289
+ providerRegion?: string;
290
+ costFn?: (usage: {
291
+ prompt: number;
292
+ completion: number;
293
+ }) => number;
294
+ };
286
295
  type ChatCompletionRole = 'user' | 'system' | 'assistant';
287
296
  declare const SystemMessage: (props: {
288
297
  children: AINode;
@@ -344,4 +353,4 @@ declare const jsxs: typeof jsx;
344
353
  /** @hidden */
345
354
  declare const Fragment: typeof AIFragment;
346
355
 
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 };
356
+ export { jsx as $, type AIComponent as A, BoundLogger as B, type ContextValues as C, type Literal as D, type EvaluatorFn as E, type FunctionChain as F, type RenderResult as G, attachedContextSymbol as H, type AIElement as I, JSX as J, type Renderable as K, LogImplementation as L, type PropsOfAIComponent as M, type NotAsyncGenerator as N, type SpanContext as O, type PromptParsed as P, type SpanStatus as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, UserMessage as U, type Span as V, type SpanEvent as W, type TracingContextKey as X, type TracingContext as Y, type TracingContextManager as Z, type OutputParser as _, type ReadableSpan as a, jsxDEV as a0, jsxs as a1, Fragment as a2, 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, type ChatCompletionClientAndProvider as i, createAIElement as j, AIFragment as k, createContext as l, type ChatCompletionRole as m, SystemMessage as n, AssistantMessage as o, type RenderedConversationMessage as p, computeUsage as q, ChatCompletionError as r, type ChatCompletionRequestPayloads as s, type LogChatCompletionRequest as t, type LogChatCompletionResponse as u, type LogLevel as v, type Logger as w, NoopLogImplementation as x, ConsoleLogger as y, CombinedLogger as z };
@@ -283,6 +283,15 @@ declare class CombinedLogger extends LogImplementation {
283
283
  chatCompletionResponse<_K extends keyof ChatCompletionRequestPayloads>(...args: Parameters<LogImplementation['chatCompletionResponse']>): void;
284
284
  }
285
285
 
286
+ type ChatCompletionClientAndProvider<K> = {
287
+ client: K;
288
+ provider?: string;
289
+ providerRegion?: string;
290
+ costFn?: (usage: {
291
+ prompt: number;
292
+ completion: number;
293
+ }) => number;
294
+ };
286
295
  type ChatCompletionRole = 'user' | 'system' | 'assistant';
287
296
  declare const SystemMessage: (props: {
288
297
  children: AINode;
@@ -344,4 +353,4 @@ declare const jsxs: typeof jsx;
344
353
  /** @hidden */
345
354
  declare const Fragment: typeof AIFragment;
346
355
 
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 };
356
+ export { jsx as $, type AIComponent as A, BoundLogger as B, type ContextValues as C, type Literal as D, type EvaluatorFn as E, type FunctionChain as F, type RenderResult as G, attachedContextSymbol as H, type AIElement as I, JSX as J, type Renderable as K, LogImplementation as L, type PropsOfAIComponent as M, type NotAsyncGenerator as N, type SpanContext as O, type PromptParsed as P, type SpanStatus as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, UserMessage as U, type Span as V, type SpanEvent as W, type TracingContextKey as X, type TracingContext as Y, type TracingContextManager as Z, type OutputParser as _, type ReadableSpan as a, jsxDEV as a0, jsxs as a1, Fragment as a2, 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, type ChatCompletionClientAndProvider as i, createAIElement as j, AIFragment as k, createContext as l, type ChatCompletionRole as m, SystemMessage as n, AssistantMessage as o, type RenderedConversationMessage as p, computeUsage as q, ChatCompletionError as r, type ChatCompletionRequestPayloads as s, type LogChatCompletionRequest as t, type LogChatCompletionResponse as u, type LogLevel as v, type Logger as w, NoopLogImplementation as x, ConsoleLogger as y, CombinedLogger as z };
@@ -1,2 +1,2 @@
1
- export { a1 as Fragment, J as JSX, _ as jsx, $ as jsxDEV, a0 as jsxs } from './jsx-dev-runtime-zWb34twz.mjs';
1
+ export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-LS-DZfkv.mjs';
2
2
  import 'zod';
@@ -1,2 +1,2 @@
1
- export { a1 as Fragment, J as JSX, _ as jsx, $ as jsxDEV, a0 as jsxs } from './jsx-dev-runtime-zWb34twz.js';
1
+ export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-LS-DZfkv.js';
2
2
  import 'zod';
@@ -1,2 +1,2 @@
1
- export { a1 as Fragment, J as JSX, _ as jsx, $ as jsxDEV, a0 as jsxs } from './jsx-dev-runtime-zWb34twz.mjs';
1
+ export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-LS-DZfkv.mjs';
2
2
  import 'zod';
@@ -1,2 +1,2 @@
1
- export { a1 as Fragment, J as JSX, _ as jsx, $ as jsxDEV, a0 as jsxs } from './jsx-dev-runtime-zWb34twz.js';
1
+ export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-LS-DZfkv.js';
2
2
  import 'zod';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gammatech/aijsx",
3
- "version": "0.5.0-dev.2024-03-11",
3
+ "version": "0.5.0-dev.2024-03-12",
4
4
  "description": "Rewrite of aijsx",
5
5
  "author": "Jordan Garcia",
6
6
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  "devDependencies": {
30
30
  "@tsconfig/node18": "^18.2.2",
31
31
  "@types/jest": "^29.0.0",
32
- "@types/node": "^16.0.0",
32
+ "@types/node": "^18.18.2",
33
33
  "@typescript-eslint/eslint-plugin": "^6.9.1",
34
34
  "@typescript-eslint/parser": "^6.9.1",
35
35
  "eslint": "^8.41.0",