@gammatech/aijsx 0.7.2-dev.2024-05-22 → 0.7.2-dev.2024-05-22.2

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, a as Context, A as AINode, T as Tracer, b as ReadableSpan, c as SpanExporter, d as AIComponent, e as SpanAttributes, E as EvaluatorFn, P as PromptParsed, f as Prompt, N as NotAsyncGenerator, F as FunctionChain, g as StreamChain, h as EvaluatorResult, i as ChatCompletionClientAndProvider, J as JSX } from './jsx-dev-runtime-6M25UAsb.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-6M25UAsb.mjs';
1
+ import { R as RenderContext, L as LogImplementation, S as SpanProcessor, C as ContextValues, a as Context, A as AINode, T as Tracer, b as ReadableSpan, c as SpanExporter, d as AIComponent, e as SpanAttributes, P as Prompt, f as ChatCompletionRequestPayloads, E as EvaluatorResult, g as EvaluatorFn, h as PromptParsed, N as NotAsyncGenerator, F as FunctionChain, i as StreamChain, j as ChatCompletionClientAndProvider, J as JSX } from './jsx-dev-runtime-QmuBZKaT.mjs';
2
+ export { I as AIElement, l as AIFragment, p as AssistantMessage, B as BoundLogger, s as ChatCompletionError, n 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, q as RenderedConversationMessage, V as Span, O as SpanContext, W as SpanEvent, Q as SpanStatus, o as SystemMessage, Y as TracingContext, X as TracingContextKey, Z as TracingContextManager, U as UserMessage, H as attachedContextSymbol, r as computeUsage, k as createAIElement, m as createContext } from './jsx-dev-runtime-QmuBZKaT.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';
@@ -102,6 +102,54 @@ type TraceProps = {
102
102
  };
103
103
  declare const Trace: AIComponent<TraceProps>;
104
104
 
105
+ type Cost = number;
106
+ type Usage = {
107
+ prompt: number;
108
+ completion: number;
109
+ total: number;
110
+ };
111
+ declare namespace AISpanAttributes {
112
+ type Prompt = {
113
+ prompt: Prompt;
114
+ promptKey: string;
115
+ variables: Record<string, any>;
116
+ output: string;
117
+ parsedOutput?: any;
118
+ };
119
+ type Chain = {
120
+ chainKey: string;
121
+ chainType: string;
122
+ variables: Record<string, any>;
123
+ };
124
+ type ChatCompletion<K extends keyof ChatCompletionRequestPayloads = keyof ChatCompletionRequestPayloads> = {
125
+ model: string;
126
+ cost?: number;
127
+ provider?: string;
128
+ providerRegion?: string;
129
+ retryCount?: number;
130
+ requestType: K;
131
+ chatCompletionRequest: ChatCompletionRequestPayloads[K];
132
+ finishReason: string | null;
133
+ output: string;
134
+ tokensUsed: Usage;
135
+ };
136
+ }
137
+ declare namespace ProcessedAISpanAttributes {
138
+ type Prompt = AISpanAttributes.Prompt & {
139
+ prompt: never;
140
+ evaluators: EvaluatorResult[];
141
+ evaluatorResults: Record<string, EvaluatorResult>;
142
+ evaluatorError?: string;
143
+ totalUsage?: Usage;
144
+ totalCost?: Cost;
145
+ };
146
+ type Chain = AISpanAttributes.Chain & {
147
+ totalUsage?: Usage;
148
+ totalCost?: Cost;
149
+ };
150
+ type ChatCompletion<K extends keyof ChatCompletionRequestPayloads = keyof ChatCompletionRequestPayloads> = AISpanAttributes.ChatCompletion<K>;
151
+ }
152
+
105
153
  /**
106
154
  * This is a helper function to create a JsxPrompt type
107
155
  */
@@ -233,4 +281,4 @@ type ClaudeImageBlockUrl = {
233
281
  type ClaudeImageBlockProps = ClaudeImageBlockBase64 | ClaudeImageBlockUrl;
234
282
  declare const ClaudeImageBlock: (props: ClaudeImageBlockProps) => Promise<JSX.Element>;
235
283
 
236
- export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, AnthropicChatCompletionInner, type AnthropicChatCompletionRequest, AnthropicClientContext, ChatCompletionClientAndProvider, ClaudeImageBlock, ContentTypeImage, Context, type CostFn, DefaultMaxRetriesContext, EnrichingSpanProcessor, EvaluatorFn, EvaluatorResult, Fallback, FunctionChain, LogImplementation, NotAsyncGenerator, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, OpenAIVisionChatCompletionInner, ParseVariablesError, Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, Retry, RetryCountContext, SpanAttributes, SpanExporter, SpanProcessor, StreamChain, Trace, Tracer, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createFunctionChain, createPrompt, createRenderContext, createStreamChain, evaluatePrompt, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer, tracing };
284
+ export { AIComponent, AINode, AISpanAttributes, AISpanProcessor, AnthropicChatCompletion, AnthropicChatCompletionInner, type AnthropicChatCompletionRequest, AnthropicClientContext, ChatCompletionClientAndProvider, type ChatCompletionRequestPayloads, ClaudeImageBlock, ContentTypeImage, Context, type CostFn, DefaultMaxRetriesContext, EnrichingSpanProcessor, EvaluatorFn, EvaluatorResult, Fallback, FunctionChain, LogImplementation, NotAsyncGenerator, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, OpenAIVisionChatCompletionInner, ParseVariablesError, ProcessedAISpanAttributes, type Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, Retry, RetryCountContext, 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, a as Context, A as AINode, T as Tracer, b as ReadableSpan, c as SpanExporter, d as AIComponent, e as SpanAttributes, E as EvaluatorFn, P as PromptParsed, f as Prompt, N as NotAsyncGenerator, F as FunctionChain, g as StreamChain, h as EvaluatorResult, i as ChatCompletionClientAndProvider, J as JSX } from './jsx-dev-runtime-6M25UAsb.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-6M25UAsb.js';
1
+ import { R as RenderContext, L as LogImplementation, S as SpanProcessor, C as ContextValues, a as Context, A as AINode, T as Tracer, b as ReadableSpan, c as SpanExporter, d as AIComponent, e as SpanAttributes, P as Prompt, f as ChatCompletionRequestPayloads, E as EvaluatorResult, g as EvaluatorFn, h as PromptParsed, N as NotAsyncGenerator, F as FunctionChain, i as StreamChain, j as ChatCompletionClientAndProvider, J as JSX } from './jsx-dev-runtime-QmuBZKaT.js';
2
+ export { I as AIElement, l as AIFragment, p as AssistantMessage, B as BoundLogger, s as ChatCompletionError, n 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, q as RenderedConversationMessage, V as Span, O as SpanContext, W as SpanEvent, Q as SpanStatus, o as SystemMessage, Y as TracingContext, X as TracingContextKey, Z as TracingContextManager, U as UserMessage, H as attachedContextSymbol, r as computeUsage, k as createAIElement, m as createContext } from './jsx-dev-runtime-QmuBZKaT.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';
@@ -102,6 +102,54 @@ type TraceProps = {
102
102
  };
103
103
  declare const Trace: AIComponent<TraceProps>;
104
104
 
105
+ type Cost = number;
106
+ type Usage = {
107
+ prompt: number;
108
+ completion: number;
109
+ total: number;
110
+ };
111
+ declare namespace AISpanAttributes {
112
+ type Prompt = {
113
+ prompt: Prompt;
114
+ promptKey: string;
115
+ variables: Record<string, any>;
116
+ output: string;
117
+ parsedOutput?: any;
118
+ };
119
+ type Chain = {
120
+ chainKey: string;
121
+ chainType: string;
122
+ variables: Record<string, any>;
123
+ };
124
+ type ChatCompletion<K extends keyof ChatCompletionRequestPayloads = keyof ChatCompletionRequestPayloads> = {
125
+ model: string;
126
+ cost?: number;
127
+ provider?: string;
128
+ providerRegion?: string;
129
+ retryCount?: number;
130
+ requestType: K;
131
+ chatCompletionRequest: ChatCompletionRequestPayloads[K];
132
+ finishReason: string | null;
133
+ output: string;
134
+ tokensUsed: Usage;
135
+ };
136
+ }
137
+ declare namespace ProcessedAISpanAttributes {
138
+ type Prompt = AISpanAttributes.Prompt & {
139
+ prompt: never;
140
+ evaluators: EvaluatorResult[];
141
+ evaluatorResults: Record<string, EvaluatorResult>;
142
+ evaluatorError?: string;
143
+ totalUsage?: Usage;
144
+ totalCost?: Cost;
145
+ };
146
+ type Chain = AISpanAttributes.Chain & {
147
+ totalUsage?: Usage;
148
+ totalCost?: Cost;
149
+ };
150
+ type ChatCompletion<K extends keyof ChatCompletionRequestPayloads = keyof ChatCompletionRequestPayloads> = AISpanAttributes.ChatCompletion<K>;
151
+ }
152
+
105
153
  /**
106
154
  * This is a helper function to create a JsxPrompt type
107
155
  */
@@ -233,4 +281,4 @@ type ClaudeImageBlockUrl = {
233
281
  type ClaudeImageBlockProps = ClaudeImageBlockBase64 | ClaudeImageBlockUrl;
234
282
  declare const ClaudeImageBlock: (props: ClaudeImageBlockProps) => Promise<JSX.Element>;
235
283
 
236
- export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, AnthropicChatCompletionInner, type AnthropicChatCompletionRequest, AnthropicClientContext, ChatCompletionClientAndProvider, ClaudeImageBlock, ContentTypeImage, Context, type CostFn, DefaultMaxRetriesContext, EnrichingSpanProcessor, EvaluatorFn, EvaluatorResult, Fallback, FunctionChain, LogImplementation, NotAsyncGenerator, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, OpenAIVisionChatCompletionInner, ParseVariablesError, Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, Retry, RetryCountContext, SpanAttributes, SpanExporter, SpanProcessor, StreamChain, Trace, Tracer, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createFunctionChain, createPrompt, createRenderContext, createStreamChain, evaluatePrompt, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer, tracing };
284
+ export { AIComponent, AINode, AISpanAttributes, AISpanProcessor, AnthropicChatCompletion, AnthropicChatCompletionInner, type AnthropicChatCompletionRequest, AnthropicClientContext, ChatCompletionClientAndProvider, type ChatCompletionRequestPayloads, ClaudeImageBlock, ContentTypeImage, Context, type CostFn, DefaultMaxRetriesContext, EnrichingSpanProcessor, EvaluatorFn, EvaluatorResult, Fallback, FunctionChain, LogImplementation, NotAsyncGenerator, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, OpenAIVisionChatCompletionInner, ParseVariablesError, ProcessedAISpanAttributes, type Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, Retry, RetryCountContext, SpanAttributes, SpanExporter, SpanProcessor, StreamChain, Trace, Tracer, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createFunctionChain, createPrompt, createRenderContext, createStreamChain, evaluatePrompt, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer, tracing };
@@ -356,4 +356,4 @@ declare const jsxs: typeof jsx;
356
356
  /** @hidden */
357
357
  declare const Fragment: typeof AIFragment;
358
358
 
359
- export { jsx as $, type AINode 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 Context as a, jsxDEV as a0, jsxs as a1, Fragment as a2, type ReadableSpan as b, type SpanExporter as c, type AIComponent as d, type SpanAttributes as e, type Prompt as f, type StreamChain as g, type EvaluatorResult 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 };
359
+ export { jsx as $, type AINode as A, BoundLogger as B, type ContextValues as C, type Literal as D, type EvaluatorResult 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 Prompt 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 Context as a, jsxDEV as a0, jsxs as a1, Fragment as a2, type ReadableSpan as b, type SpanExporter as c, type AIComponent as d, type SpanAttributes as e, type ChatCompletionRequestPayloads as f, type EvaluatorFn as g, type PromptParsed as h, type StreamChain as i, type ChatCompletionClientAndProvider as j, createAIElement as k, AIFragment as l, createContext as m, type ChatCompletionRole as n, SystemMessage as o, AssistantMessage as p, type RenderedConversationMessage as q, computeUsage as r, ChatCompletionError 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 };
@@ -356,4 +356,4 @@ declare const jsxs: typeof jsx;
356
356
  /** @hidden */
357
357
  declare const Fragment: typeof AIFragment;
358
358
 
359
- export { jsx as $, type AINode 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 Context as a, jsxDEV as a0, jsxs as a1, Fragment as a2, type ReadableSpan as b, type SpanExporter as c, type AIComponent as d, type SpanAttributes as e, type Prompt as f, type StreamChain as g, type EvaluatorResult 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 };
359
+ export { jsx as $, type AINode as A, BoundLogger as B, type ContextValues as C, type Literal as D, type EvaluatorResult 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 Prompt 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 Context as a, jsxDEV as a0, jsxs as a1, Fragment as a2, type ReadableSpan as b, type SpanExporter as c, type AIComponent as d, type SpanAttributes as e, type ChatCompletionRequestPayloads as f, type EvaluatorFn as g, type PromptParsed as h, type StreamChain as i, type ChatCompletionClientAndProvider as j, createAIElement as k, AIFragment as l, createContext as m, type ChatCompletionRole as n, SystemMessage as o, AssistantMessage as p, type RenderedConversationMessage as q, computeUsage as r, ChatCompletionError 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 { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-6M25UAsb.mjs';
1
+ export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-QmuBZKaT.mjs';
2
2
  import 'zod';
@@ -1,2 +1,2 @@
1
- export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-6M25UAsb.js';
1
+ export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-QmuBZKaT.js';
2
2
  import 'zod';
@@ -1,2 +1,2 @@
1
- export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-6M25UAsb.mjs';
1
+ export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-QmuBZKaT.mjs';
2
2
  import 'zod';
@@ -1,2 +1,2 @@
1
- export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-6M25UAsb.js';
1
+ export { a2 as Fragment, J as JSX, $ as jsx, a0 as jsxDEV, a1 as jsxs } from './jsx-dev-runtime-QmuBZKaT.js';
2
2
  import 'zod';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gammatech/aijsx",
3
- "version": "0.7.2-dev.2024-05-22",
3
+ "version": "0.7.2-dev.2024-05-22.2",
4
4
  "description": "Rewrite of aijsx",
5
5
  "author": "Jordan Garcia",
6
6
  "license": "MIT",