@gammatech/aijsx 0.16.0-dev.2024-11-05 → 0.16.1-dev.2024-11-05
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 +6 -16
- package/dist/index.d.ts +6 -16
- package/dist/index.js +5 -1
- package/dist/index.mjs +5 -1
- package/dist/{jsx-dev-runtime-yLtSq2UV.d.mts → jsx-dev-runtime-yyAW1PnA.d.mts} +1 -1
- package/dist/{jsx-dev-runtime-yLtSq2UV.d.ts → jsx-dev-runtime-yyAW1PnA.d.ts} +1 -1
- package/dist/jsx-dev-runtime.d.mts +1 -1
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-runtime.d.mts +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LogChatCompletionRequest, A as AINode, R as RenderContext, a as LogImplementation, S as SpanProcessor,
|
|
2
|
-
export { z as AIElement,
|
|
1
|
+
import { L as LogChatCompletionRequest, A as AINode, C as ChatCompletionUsage, R as RenderContext, a as LogImplementation, S as SpanProcessor, b as ContextValues, c as Context, T as Tracer, d as ReadableSpan, e as SpanAttributes, f as SpanExporter, g as AIComponent, P as Prompt, h as ChatCompletionRequestPayloads, D as DebugMessage, E as EvaluatorResult, i as EvaluatorFn, j as PromptParsed, J as JSX } from './jsx-dev-runtime-yyAW1PnA.mjs';
|
|
2
|
+
export { z as AIElement, l as AIFragment, B as BoundLogger, n as ChatMessage, o as ChatRole, v as CombinedLogger, u as ConsoleLogger, I as ImagePart, p as ImagePartProps, w as Literal, q as LogChatCompletionResponse, r as LogLevel, s as Logger, N as NoopLogImplementation, W as OutputParser, G as PropsOfAIComponent, x as RenderResult, F as Renderable, M as Span, H as SpanContext, O as SpanEvent, K as SpanStatus, U as TracingContext, Q as TracingContextKey, V as TracingContextManager, y as attachedContextSymbol, k as createAIElement, m as createContext, t as toDebugMessage } from './jsx-dev-runtime-yyAW1PnA.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';
|
|
@@ -35,12 +35,7 @@ type ChatCompletionClientAndProvider<K> = {
|
|
|
35
35
|
client: K;
|
|
36
36
|
provider?: string;
|
|
37
37
|
providerRegion?: string;
|
|
38
|
-
costFn?: (model: string, usage:
|
|
39
|
-
prompt: number;
|
|
40
|
-
completion: number;
|
|
41
|
-
cachedPromptTokensCreated: number;
|
|
42
|
-
cachedPromptTokensRead: number;
|
|
43
|
-
}) => number;
|
|
38
|
+
costFn?: (model: string, usage: Omit<ChatCompletionUsage, 'total'>) => number;
|
|
44
39
|
};
|
|
45
40
|
type GetChatCompletionClientAndProvider<Model, Client> = (model: Model, args: {
|
|
46
41
|
retryCount: number;
|
|
@@ -168,11 +163,6 @@ type TraceProps = {
|
|
|
168
163
|
declare const Trace: AIComponent<TraceProps>;
|
|
169
164
|
|
|
170
165
|
type Cost = number;
|
|
171
|
-
type Usage = {
|
|
172
|
-
prompt: number;
|
|
173
|
-
completion: number;
|
|
174
|
-
total: number;
|
|
175
|
-
};
|
|
176
166
|
declare namespace AISpanAttributes {
|
|
177
167
|
type Prompt = {
|
|
178
168
|
prompt: Prompt;
|
|
@@ -192,7 +182,7 @@ declare namespace AISpanAttributes {
|
|
|
192
182
|
inputMessages: DebugMessage[];
|
|
193
183
|
finishReason: string | null;
|
|
194
184
|
output: string;
|
|
195
|
-
tokensUsed:
|
|
185
|
+
tokensUsed: ChatCompletionUsage;
|
|
196
186
|
[key: string]: any;
|
|
197
187
|
};
|
|
198
188
|
}
|
|
@@ -201,7 +191,7 @@ declare namespace ProcessedAISpanAttributes {
|
|
|
201
191
|
prompt: never;
|
|
202
192
|
evaluatorResults: Record<string, EvaluatorResult>;
|
|
203
193
|
evaluatorError?: string;
|
|
204
|
-
totalUsage?:
|
|
194
|
+
totalUsage?: ChatCompletionUsage;
|
|
205
195
|
totalCost?: Cost;
|
|
206
196
|
parentPromptKey?: string;
|
|
207
197
|
rootPromptKey?: string;
|
|
@@ -330,4 +320,4 @@ type GoogleChatCompletionProps = {
|
|
|
330
320
|
};
|
|
331
321
|
declare function GoogleChatCompletion(props: GoogleChatCompletionProps, ctx: RenderContext): JSX.Element;
|
|
332
322
|
|
|
333
|
-
export { AIComponent, AINode, AISpanAttributes, AISpanProcessor, Accumulate, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, AssistantMessage, type ChatCompletionClientAndProvider, ChatCompletionError, type ChatCompletionRequestPayloads, Context, type CostFn, DebugMessage, DefaultMaxRetriesContext, EvaluatorFn, EvaluatorResult, Fallback, type GetChatCompletionClientAndProvider, GoogleChatCompletion, type GoogleChatCompletionRequest, GoogleClientContext, LogChatCompletionRequest, LogImplementation, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, ParseVariablesError, ProcessedAISpanAttributes, type Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, Retry, RetryCountContext, RetryLastErrorContext, SpanAttributes, SpanExporter, SpanProcessor, SystemMessage, Trace, Tracer, UserMessage, type ValidAnthropicChatModel, type ValidGoogleChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createPrompt, createRenderContext, evaluatePrompt, AnthropicPromptCacheDebugger as experimental__AnthropicPromptCacheDebugger, isPromptParsed, tracing };
|
|
323
|
+
export { AIComponent, AINode, AISpanAttributes, AISpanProcessor, Accumulate, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, AssistantMessage, type ChatCompletionClientAndProvider, ChatCompletionError, type ChatCompletionRequestPayloads, ChatCompletionUsage, Context, type CostFn, DebugMessage, DefaultMaxRetriesContext, EvaluatorFn, EvaluatorResult, Fallback, type GetChatCompletionClientAndProvider, GoogleChatCompletion, type GoogleChatCompletionRequest, GoogleClientContext, LogChatCompletionRequest, LogImplementation, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, ParseVariablesError, ProcessedAISpanAttributes, type Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, Retry, RetryCountContext, RetryLastErrorContext, SpanAttributes, SpanExporter, SpanProcessor, SystemMessage, Trace, Tracer, UserMessage, type ValidAnthropicChatModel, type ValidGoogleChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createPrompt, createRenderContext, evaluatePrompt, AnthropicPromptCacheDebugger as experimental__AnthropicPromptCacheDebugger, isPromptParsed, tracing };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { L as LogChatCompletionRequest, A as AINode, R as RenderContext, a as LogImplementation, S as SpanProcessor,
|
|
2
|
-
export { z as AIElement,
|
|
1
|
+
import { L as LogChatCompletionRequest, A as AINode, C as ChatCompletionUsage, R as RenderContext, a as LogImplementation, S as SpanProcessor, b as ContextValues, c as Context, T as Tracer, d as ReadableSpan, e as SpanAttributes, f as SpanExporter, g as AIComponent, P as Prompt, h as ChatCompletionRequestPayloads, D as DebugMessage, E as EvaluatorResult, i as EvaluatorFn, j as PromptParsed, J as JSX } from './jsx-dev-runtime-yyAW1PnA.js';
|
|
2
|
+
export { z as AIElement, l as AIFragment, B as BoundLogger, n as ChatMessage, o as ChatRole, v as CombinedLogger, u as ConsoleLogger, I as ImagePart, p as ImagePartProps, w as Literal, q as LogChatCompletionResponse, r as LogLevel, s as Logger, N as NoopLogImplementation, W as OutputParser, G as PropsOfAIComponent, x as RenderResult, F as Renderable, M as Span, H as SpanContext, O as SpanEvent, K as SpanStatus, U as TracingContext, Q as TracingContextKey, V as TracingContextManager, y as attachedContextSymbol, k as createAIElement, m as createContext, t as toDebugMessage } from './jsx-dev-runtime-yyAW1PnA.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';
|
|
@@ -35,12 +35,7 @@ type ChatCompletionClientAndProvider<K> = {
|
|
|
35
35
|
client: K;
|
|
36
36
|
provider?: string;
|
|
37
37
|
providerRegion?: string;
|
|
38
|
-
costFn?: (model: string, usage:
|
|
39
|
-
prompt: number;
|
|
40
|
-
completion: number;
|
|
41
|
-
cachedPromptTokensCreated: number;
|
|
42
|
-
cachedPromptTokensRead: number;
|
|
43
|
-
}) => number;
|
|
38
|
+
costFn?: (model: string, usage: Omit<ChatCompletionUsage, 'total'>) => number;
|
|
44
39
|
};
|
|
45
40
|
type GetChatCompletionClientAndProvider<Model, Client> = (model: Model, args: {
|
|
46
41
|
retryCount: number;
|
|
@@ -168,11 +163,6 @@ type TraceProps = {
|
|
|
168
163
|
declare const Trace: AIComponent<TraceProps>;
|
|
169
164
|
|
|
170
165
|
type Cost = number;
|
|
171
|
-
type Usage = {
|
|
172
|
-
prompt: number;
|
|
173
|
-
completion: number;
|
|
174
|
-
total: number;
|
|
175
|
-
};
|
|
176
166
|
declare namespace AISpanAttributes {
|
|
177
167
|
type Prompt = {
|
|
178
168
|
prompt: Prompt;
|
|
@@ -192,7 +182,7 @@ declare namespace AISpanAttributes {
|
|
|
192
182
|
inputMessages: DebugMessage[];
|
|
193
183
|
finishReason: string | null;
|
|
194
184
|
output: string;
|
|
195
|
-
tokensUsed:
|
|
185
|
+
tokensUsed: ChatCompletionUsage;
|
|
196
186
|
[key: string]: any;
|
|
197
187
|
};
|
|
198
188
|
}
|
|
@@ -201,7 +191,7 @@ declare namespace ProcessedAISpanAttributes {
|
|
|
201
191
|
prompt: never;
|
|
202
192
|
evaluatorResults: Record<string, EvaluatorResult>;
|
|
203
193
|
evaluatorError?: string;
|
|
204
|
-
totalUsage?:
|
|
194
|
+
totalUsage?: ChatCompletionUsage;
|
|
205
195
|
totalCost?: Cost;
|
|
206
196
|
parentPromptKey?: string;
|
|
207
197
|
rootPromptKey?: string;
|
|
@@ -330,4 +320,4 @@ type GoogleChatCompletionProps = {
|
|
|
330
320
|
};
|
|
331
321
|
declare function GoogleChatCompletion(props: GoogleChatCompletionProps, ctx: RenderContext): JSX.Element;
|
|
332
322
|
|
|
333
|
-
export { AIComponent, AINode, AISpanAttributes, AISpanProcessor, Accumulate, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, AssistantMessage, type ChatCompletionClientAndProvider, ChatCompletionError, type ChatCompletionRequestPayloads, Context, type CostFn, DebugMessage, DefaultMaxRetriesContext, EvaluatorFn, EvaluatorResult, Fallback, type GetChatCompletionClientAndProvider, GoogleChatCompletion, type GoogleChatCompletionRequest, GoogleClientContext, LogChatCompletionRequest, LogImplementation, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, ParseVariablesError, ProcessedAISpanAttributes, type Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, Retry, RetryCountContext, RetryLastErrorContext, SpanAttributes, SpanExporter, SpanProcessor, SystemMessage, Trace, Tracer, UserMessage, type ValidAnthropicChatModel, type ValidGoogleChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createPrompt, createRenderContext, evaluatePrompt, AnthropicPromptCacheDebugger as experimental__AnthropicPromptCacheDebugger, isPromptParsed, tracing };
|
|
323
|
+
export { AIComponent, AINode, AISpanAttributes, AISpanProcessor, Accumulate, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, AssistantMessage, type ChatCompletionClientAndProvider, ChatCompletionError, type ChatCompletionRequestPayloads, ChatCompletionUsage, Context, type CostFn, DebugMessage, DefaultMaxRetriesContext, EvaluatorFn, EvaluatorResult, Fallback, type GetChatCompletionClientAndProvider, GoogleChatCompletion, type GoogleChatCompletionRequest, GoogleClientContext, LogChatCompletionRequest, LogImplementation, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, ParseVariablesError, ProcessedAISpanAttributes, type Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, Retry, RetryCountContext, RetryLastErrorContext, SpanAttributes, SpanExporter, SpanProcessor, SystemMessage, Trace, Tracer, UserMessage, type ValidAnthropicChatModel, type ValidGoogleChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createPrompt, createRenderContext, evaluatePrompt, AnthropicPromptCacheDebugger as experimental__AnthropicPromptCacheDebugger, isPromptParsed, tracing };
|
package/dist/index.js
CHANGED
|
@@ -1854,7 +1854,9 @@ var AISpanProcessor = class {
|
|
|
1854
1854
|
const totalUsage = {
|
|
1855
1855
|
prompt: 0,
|
|
1856
1856
|
completion: 0,
|
|
1857
|
-
total: 0
|
|
1857
|
+
total: 0,
|
|
1858
|
+
cachedPromptTokensCreated: 0,
|
|
1859
|
+
cachedPromptTokensRead: 0
|
|
1858
1860
|
};
|
|
1859
1861
|
const root = this.spanTree.findNode(rootSpan.spanContext.spanId);
|
|
1860
1862
|
root?.descendents(({ span }) => {
|
|
@@ -1871,6 +1873,8 @@ var AISpanProcessor = class {
|
|
|
1871
1873
|
totalUsage.prompt += tokensUsed.prompt;
|
|
1872
1874
|
totalUsage.completion += tokensUsed.completion;
|
|
1873
1875
|
totalUsage.total += tokensUsed.total;
|
|
1876
|
+
totalUsage.cachedPromptTokensCreated += tokensUsed.cachedPromptTokensCreated;
|
|
1877
|
+
totalUsage.cachedPromptTokensRead += tokensUsed.cachedPromptTokensRead;
|
|
1874
1878
|
});
|
|
1875
1879
|
rootSpan.attributes.totalCost = totalCost;
|
|
1876
1880
|
rootSpan.attributes.totalUsage = totalUsage;
|
package/dist/index.mjs
CHANGED
|
@@ -1753,7 +1753,9 @@ var AISpanProcessor = class {
|
|
|
1753
1753
|
const totalUsage = {
|
|
1754
1754
|
prompt: 0,
|
|
1755
1755
|
completion: 0,
|
|
1756
|
-
total: 0
|
|
1756
|
+
total: 0,
|
|
1757
|
+
cachedPromptTokensCreated: 0,
|
|
1758
|
+
cachedPromptTokensRead: 0
|
|
1757
1759
|
};
|
|
1758
1760
|
const root = this.spanTree.findNode(rootSpan.spanContext.spanId);
|
|
1759
1761
|
root?.descendents(({ span }) => {
|
|
@@ -1770,6 +1772,8 @@ var AISpanProcessor = class {
|
|
|
1770
1772
|
totalUsage.prompt += tokensUsed.prompt;
|
|
1771
1773
|
totalUsage.completion += tokensUsed.completion;
|
|
1772
1774
|
totalUsage.total += tokensUsed.total;
|
|
1775
|
+
totalUsage.cachedPromptTokensCreated += tokensUsed.cachedPromptTokensCreated;
|
|
1776
|
+
totalUsage.cachedPromptTokensRead += tokensUsed.cachedPromptTokensRead;
|
|
1773
1777
|
});
|
|
1774
1778
|
rootSpan.attributes.totalCost = totalCost;
|
|
1775
1779
|
rootSpan.attributes.totalUsage = totalUsage;
|
|
@@ -362,4 +362,4 @@ declare const jsxs: typeof jsx;
|
|
|
362
362
|
/** @hidden */
|
|
363
363
|
declare const Fragment: typeof AIFragment;
|
|
364
364
|
|
|
365
|
-
export { type AINode as A, BoundLogger as B, type
|
|
365
|
+
export { type AINode as A, BoundLogger as B, type ChatCompletionUsage as C, type DebugMessage as D, type EvaluatorResult as E, type Renderable as F, type PropsOfAIComponent as G, type SpanContext as H, ImagePart as I, JSX as J, type SpanStatus as K, type LogChatCompletionRequest as L, type Span as M, NoopLogImplementation as N, type SpanEvent as O, type Prompt as P, type TracingContextKey as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, type TracingContext as U, type TracingContextManager as V, type OutputParser as W, jsx as X, jsxDEV as Y, jsxs as Z, Fragment as _, LogImplementation as a, type ContextValues as b, type Context as c, type ReadableSpan as d, type SpanAttributes as e, type SpanExporter as f, type AIComponent as g, type ChatCompletionRequestPayloads as h, type EvaluatorFn as i, type PromptParsed as j, createAIElement as k, AIFragment as l, createContext as m, type ChatMessage as n, type ChatRole as o, type ImagePartProps as p, type LogChatCompletionResponse as q, type LogLevel as r, type Logger as s, toDebugMessage as t, ConsoleLogger as u, CombinedLogger as v, type Literal as w, type RenderResult as x, attachedContextSymbol as y, type AIElement as z };
|
|
@@ -362,4 +362,4 @@ declare const jsxs: typeof jsx;
|
|
|
362
362
|
/** @hidden */
|
|
363
363
|
declare const Fragment: typeof AIFragment;
|
|
364
364
|
|
|
365
|
-
export { type AINode as A, BoundLogger as B, type
|
|
365
|
+
export { type AINode as A, BoundLogger as B, type ChatCompletionUsage as C, type DebugMessage as D, type EvaluatorResult as E, type Renderable as F, type PropsOfAIComponent as G, type SpanContext as H, ImagePart as I, JSX as J, type SpanStatus as K, type LogChatCompletionRequest as L, type Span as M, NoopLogImplementation as N, type SpanEvent as O, type Prompt as P, type TracingContextKey as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, type TracingContext as U, type TracingContextManager as V, type OutputParser as W, jsx as X, jsxDEV as Y, jsxs as Z, Fragment as _, LogImplementation as a, type ContextValues as b, type Context as c, type ReadableSpan as d, type SpanAttributes as e, type SpanExporter as f, type AIComponent as g, type ChatCompletionRequestPayloads as h, type EvaluatorFn as i, type PromptParsed as j, createAIElement as k, AIFragment as l, createContext as m, type ChatMessage as n, type ChatRole as o, type ImagePartProps as p, type LogChatCompletionResponse as q, type LogLevel as r, type Logger as s, toDebugMessage as t, ConsoleLogger as u, CombinedLogger as v, type Literal as w, type RenderResult as x, attachedContextSymbol as y, type AIElement as z };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { _ as Fragment, J as JSX, X as jsx, Y as jsxDEV, Z as jsxs } from './jsx-dev-runtime-
|
|
1
|
+
export { _ as Fragment, J as JSX, X as jsx, Y as jsxDEV, Z as jsxs } from './jsx-dev-runtime-yyAW1PnA.mjs';
|
|
2
2
|
import 'zod';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { _ as Fragment, J as JSX, X as jsx, Y as jsxDEV, Z as jsxs } from './jsx-dev-runtime-
|
|
1
|
+
export { _ as Fragment, J as JSX, X as jsx, Y as jsxDEV, Z as jsxs } from './jsx-dev-runtime-yyAW1PnA.js';
|
|
2
2
|
import 'zod';
|
package/dist/jsx-runtime.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { _ as Fragment, J as JSX, X as jsx, Y as jsxDEV, Z as jsxs } from './jsx-dev-runtime-
|
|
1
|
+
export { _ as Fragment, J as JSX, X as jsx, Y as jsxDEV, Z as jsxs } from './jsx-dev-runtime-yyAW1PnA.mjs';
|
|
2
2
|
import 'zod';
|
package/dist/jsx-runtime.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { _ as Fragment, J as JSX, X as jsx, Y as jsxDEV, Z as jsxs } from './jsx-dev-runtime-
|
|
1
|
+
export { _ as Fragment, J as JSX, X as jsx, Y as jsxDEV, Z as jsxs } from './jsx-dev-runtime-yyAW1PnA.js';
|
|
2
2
|
import 'zod';
|