@gammatech/aijsx 0.4.1-beta.3 → 0.4.1-beta.4

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.
@@ -318,4 +318,4 @@ declare function AIFragment({ children }: {
318
318
  children: AINode;
319
319
  }): Renderable;
320
320
 
321
- export { type AIComponent as A, BoundLogger as B, type ContextValues as C, attachedContextSymbol as D, type EvaluatorFn as E, type FunctionChain as F, type AIElement as G, type Renderable as H, type PropsOfAIComponent as I, type SpanContext as J, type SpanAttributes as K, LogImplementation as L, type SpanStatus as M, type NotAsyncGenerator as N, type Span as O, type PromptParsed as P, type SpanEvent as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, UserMessage as U, type TracingContextKey as V, type TracingContext as W, type TracingContextManager as X, type OutputParser as Y, type ReadableSpan as a, type SpanExporter as b, type Prompt as c, type StreamChain as d, type EvaluatorResult as e, type Context as f, type AINode as g, createAIElement as h, AIFragment as i, createContext as j, type ChatCompletionRole as k, SystemMessage as l, AssistantMessage as m, type RenderedConversationMessage as n, computeUsage as o, ChatCompletionError as p, type ChatCompletionRequestPayloads as q, type LogChatCompletionRequest as r, type LogChatCompletionResponse as s, type LogLevel as t, type Logger as u, NoopLogImplementation as v, ConsoleLogger as w, CombinedLogger as x, type Literal as y, type RenderResult as z };
321
+ export { 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, type PropsOfAIComponent as J, type SpanContext as K, LogImplementation as L, type SpanStatus as M, type NotAsyncGenerator as N, type Span as O, type PromptParsed as P, type SpanEvent as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, UserMessage as U, type TracingContextKey as V, type TracingContext as W, type TracingContextManager as X, type OutputParser as Y, type ReadableSpan as a, 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 };
@@ -318,4 +318,4 @@ declare function AIFragment({ children }: {
318
318
  children: AINode;
319
319
  }): Renderable;
320
320
 
321
- export { type AIComponent as A, BoundLogger as B, type ContextValues as C, attachedContextSymbol as D, type EvaluatorFn as E, type FunctionChain as F, type AIElement as G, type Renderable as H, type PropsOfAIComponent as I, type SpanContext as J, type SpanAttributes as K, LogImplementation as L, type SpanStatus as M, type NotAsyncGenerator as N, type Span as O, type PromptParsed as P, type SpanEvent as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, UserMessage as U, type TracingContextKey as V, type TracingContext as W, type TracingContextManager as X, type OutputParser as Y, type ReadableSpan as a, type SpanExporter as b, type Prompt as c, type StreamChain as d, type EvaluatorResult as e, type Context as f, type AINode as g, createAIElement as h, AIFragment as i, createContext as j, type ChatCompletionRole as k, SystemMessage as l, AssistantMessage as m, type RenderedConversationMessage as n, computeUsage as o, ChatCompletionError as p, type ChatCompletionRequestPayloads as q, type LogChatCompletionRequest as r, type LogChatCompletionResponse as s, type LogLevel as t, type Logger as u, NoopLogImplementation as v, ConsoleLogger as w, CombinedLogger as x, type Literal as y, type RenderResult as z };
321
+ export { 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, type PropsOfAIComponent as J, type SpanContext as K, LogImplementation as L, type SpanStatus as M, type NotAsyncGenerator as N, type Span as O, type PromptParsed as P, type SpanEvent as Q, type RenderContext as R, type SpanProcessor as S, type Tracer as T, UserMessage as U, type TracingContextKey as V, type TracingContext as W, type TracingContextManager as X, type OutputParser as Y, type ReadableSpan as a, type SpanExporter as b, type AINode as c, type SpanAttributes as d, type Prompt as e, type StreamChain as f, type EvaluatorResult as g, type Context as h, createAIElement as i, AIFragment as j, createContext as k, type ChatCompletionRole as l, SystemMessage as m, AssistantMessage as n, type RenderedConversationMessage as o, computeUsage as p, ChatCompletionError as q, type ChatCompletionRequestPayloads as r, type LogChatCompletionRequest as s, type LogChatCompletionResponse as t, type LogLevel as u, type Logger as v, NoopLogImplementation as w, ConsoleLogger as x, CombinedLogger as y, type Literal as z };
package/dist/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, E as EvaluatorFn, P as PromptParsed, c as Prompt, N as NotAsyncGenerator, F as FunctionChain, d as StreamChain, e as EvaluatorResult, f as Context, g as AINode } from './createElement-elCDOGhR.mjs';
2
- export { G as AIElement, i as AIFragment, m as AssistantMessage, B as BoundLogger, p as ChatCompletionError, q as ChatCompletionRequestPayloads, k as ChatCompletionRole, x as CombinedLogger, w as ConsoleLogger, y as Literal, r as LogChatCompletionRequest, s as LogChatCompletionResponse, t as LogLevel, u as Logger, v as NoopLogImplementation, Y as OutputParser, I as PropsOfAIComponent, z as RenderResult, H as Renderable, n as RenderedConversationMessage, O as Span, K as SpanAttributes, J as SpanContext, Q as SpanEvent, M as SpanStatus, l as SystemMessage, W as TracingContext, V as TracingContextKey, X as TracingContextManager, U as UserMessage, D as attachedContextSymbol, o as computeUsage, h as createAIElement, j as createContext } from './createElement-elCDOGhR.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 } from './createElement-x4FT7ZgG.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, Y as OutputParser, J as PropsOfAIComponent, D as RenderResult, I as Renderable, o as RenderedConversationMessage, O as Span, K as SpanContext, Q as SpanEvent, M as SpanStatus, m as SystemMessage, W as TracingContext, V as TracingContextKey, X as TracingContextManager, U as UserMessage, G as attachedContextSymbol, p as computeUsage, i as createAIElement, k as createContext } from './createElement-x4FT7ZgG.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';
@@ -81,6 +81,13 @@ declare class AISpanProcessor extends EnrichingSpanProcessor {
81
81
  protected evaluatePrompt(span: ReadableSpan): Promise<ReadableSpan>;
82
82
  }
83
83
 
84
+ type TraceProps = {
85
+ children: AINode;
86
+ name: string;
87
+ attributes?: SpanAttributes;
88
+ };
89
+ declare const Trace: AIComponent<TraceProps>;
90
+
84
91
  /**
85
92
  * This is a helper function to create a JsxPrompt type
86
93
  */
@@ -200,4 +207,4 @@ type AnthropicChatCompletionProps = {
200
207
  */
201
208
  declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, { render, logger, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
202
209
 
203
- export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, ContentTypeImage, Context, type CostFn, EnrichingSpanProcessor, EvaluatorFn, EvaluatorResult, FunctionChain, LogImplementation, NotAsyncGenerator, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, ParseVariablesError, Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, SpanExporter, SpanProcessor, StreamChain, Tracer, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createFunctionChain, createPrompt, createRenderContext, createStreamChain, evaluatePrompt, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer, tracing };
210
+ export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, 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, E as EvaluatorFn, P as PromptParsed, c as Prompt, N as NotAsyncGenerator, F as FunctionChain, d as StreamChain, e as EvaluatorResult, f as Context, g as AINode } from './createElement-elCDOGhR.js';
2
- export { G as AIElement, i as AIFragment, m as AssistantMessage, B as BoundLogger, p as ChatCompletionError, q as ChatCompletionRequestPayloads, k as ChatCompletionRole, x as CombinedLogger, w as ConsoleLogger, y as Literal, r as LogChatCompletionRequest, s as LogChatCompletionResponse, t as LogLevel, u as Logger, v as NoopLogImplementation, Y as OutputParser, I as PropsOfAIComponent, z as RenderResult, H as Renderable, n as RenderedConversationMessage, O as Span, K as SpanAttributes, J as SpanContext, Q as SpanEvent, M as SpanStatus, l as SystemMessage, W as TracingContext, V as TracingContextKey, X as TracingContextManager, U as UserMessage, D as attachedContextSymbol, o as computeUsage, h as createAIElement, j as createContext } from './createElement-elCDOGhR.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 } from './createElement-x4FT7ZgG.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, Y as OutputParser, J as PropsOfAIComponent, D as RenderResult, I as Renderable, o as RenderedConversationMessage, O as Span, K as SpanContext, Q as SpanEvent, M as SpanStatus, m as SystemMessage, W as TracingContext, V as TracingContextKey, X as TracingContextManager, U as UserMessage, G as attachedContextSymbol, p as computeUsage, i as createAIElement, k as createContext } from './createElement-x4FT7ZgG.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';
@@ -81,6 +81,13 @@ declare class AISpanProcessor extends EnrichingSpanProcessor {
81
81
  protected evaluatePrompt(span: ReadableSpan): Promise<ReadableSpan>;
82
82
  }
83
83
 
84
+ type TraceProps = {
85
+ children: AINode;
86
+ name: string;
87
+ attributes?: SpanAttributes;
88
+ };
89
+ declare const Trace: AIComponent<TraceProps>;
90
+
84
91
  /**
85
92
  * This is a helper function to create a JsxPrompt type
86
93
  */
@@ -200,4 +207,4 @@ type AnthropicChatCompletionProps = {
200
207
  */
201
208
  declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, { render, logger, tracer, getContext }: RenderContext): AsyncGenerator<string, void, unknown>;
202
209
 
203
- export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, ContentTypeImage, Context, type CostFn, EnrichingSpanProcessor, EvaluatorFn, EvaluatorResult, FunctionChain, LogImplementation, NotAsyncGenerator, OpenAIChatCompletion, type OpenAIChatCompletionRequest, type OpenAIChatMessage, OpenAIClientContext, OpenAIVisionChatCompletion, ParseVariablesError, Prompt, PromptInvalidOutputError, PromptParsed, ReadableSpan, RenderContext, SpanExporter, SpanProcessor, StreamChain, Tracer, type ValidAnthropicChatModel, type ValidOpenAIChatModel, type ValidOpenAIVisionModel, createFunctionChain, createPrompt, createRenderContext, createStreamChain, evaluatePrompt, tokenCountForOpenAIMessage, tokenCountForOpenAIVisionMessage, tokenLimitForChatModel, tokenizer, tracing };
210
+ export { AIComponent, AINode, AISpanProcessor, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, 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
@@ -50,6 +50,7 @@ __export(src_exports, {
50
50
  ParseVariablesError: () => ParseVariablesError,
51
51
  PromptInvalidOutputError: () => PromptInvalidOutputError,
52
52
  SystemMessage: () => SystemMessage,
53
+ Trace: () => Trace,
53
54
  UserMessage: () => UserMessage,
54
55
  attachedContextSymbol: () => attachedContextSymbol,
55
56
  computeUsage: () => computeUsage,
@@ -1567,6 +1568,14 @@ var isPrompt2 = (value) => {
1567
1568
  );
1568
1569
  };
1569
1570
 
1571
+ // src/tracing/Trace.tsx
1572
+ var Trace = ({ name, attributes, children }, { tracer, render }) => {
1573
+ const result = tracer.trace(name, attributes || {}, () => {
1574
+ return render(children);
1575
+ });
1576
+ return result;
1577
+ };
1578
+
1570
1579
  // src/prompt/createPrompt.tsx
1571
1580
  var import_zod = require("zod");
1572
1581
  function createPrompt(config) {
@@ -2277,6 +2286,7 @@ var import_tokenizer4 = require("@anthropic-ai/tokenizer");
2277
2286
  ParseVariablesError,
2278
2287
  PromptInvalidOutputError,
2279
2288
  SystemMessage,
2289
+ Trace,
2280
2290
  UserMessage,
2281
2291
  attachedContextSymbol,
2282
2292
  computeUsage,
package/dist/index.mjs CHANGED
@@ -1471,6 +1471,14 @@ var isPrompt2 = (value) => {
1471
1471
  );
1472
1472
  };
1473
1473
 
1474
+ // src/tracing/Trace.tsx
1475
+ var Trace = ({ name, attributes, children }, { tracer, render }) => {
1476
+ const result = tracer.trace(name, attributes || {}, () => {
1477
+ return render(children);
1478
+ });
1479
+ return result;
1480
+ };
1481
+
1474
1482
  // src/prompt/createPrompt.tsx
1475
1483
  import { z } from "zod";
1476
1484
  function createPrompt(config) {
@@ -2180,6 +2188,7 @@ export {
2180
2188
  ParseVariablesError,
2181
2189
  PromptInvalidOutputError,
2182
2190
  SystemMessage,
2191
+ Trace,
2183
2192
  UserMessage,
2184
2193
  attachedContextSymbol,
2185
2194
  computeUsage,
@@ -1,3 +1,3 @@
1
1
  export { Fragment, JSX, jsx, jsxDEV, jsxs } from './jsx-runtime.mjs';
2
- import './createElement-elCDOGhR.mjs';
2
+ import './createElement-x4FT7ZgG.mjs';
3
3
  import 'zod';
@@ -1,3 +1,3 @@
1
1
  export { Fragment, JSX, jsx, jsxDEV, jsxs } from './jsx-runtime.js';
2
- import './createElement-elCDOGhR.js';
2
+ import './createElement-x4FT7ZgG.js';
3
3
  import 'zod';
@@ -1,4 +1,4 @@
1
- import { A as AIComponent, G as AIElement, i as AIFragment } from './createElement-elCDOGhR.mjs';
1
+ import { A as AIComponent, H as AIElement, j as AIFragment } from './createElement-x4FT7ZgG.mjs';
2
2
  import 'zod';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { A as AIComponent, G as AIElement, i as AIFragment } from './createElement-elCDOGhR.js';
1
+ import { A as AIComponent, H as AIElement, j as AIFragment } from './createElement-x4FT7ZgG.js';
2
2
  import 'zod';
3
3
 
4
4
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gammatech/aijsx",
3
- "version": "0.4.1-beta.3",
3
+ "version": "0.4.1-beta.4",
4
4
  "description": "Rewrite of aijsx",
5
5
  "author": "Jordan Garcia",
6
6
  "license": "MIT",