@gammatech/aijsx 0.15.3-dev.2024-10-21 → 0.16.0-dev.2024-10-28
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 +20 -15
- package/dist/index.d.ts +20 -15
- package/dist/index.js +268 -154
- package/dist/index.mjs +264 -148
- package/dist/{jsx-dev-runtime-lYsmphqH.d.mts → jsx-dev-runtime-yLtSq2UV.d.mts} +13 -6
- package/dist/{jsx-dev-runtime-lYsmphqH.d.ts → jsx-dev-runtime-yLtSq2UV.d.ts} +13 -6
- 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 +4 -6
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { L as LogChatCompletionRequest, A as AINode,
|
|
2
|
-
export {
|
|
1
|
+
import { L as LogChatCompletionRequest, A as AINode, R as RenderContext, a as LogImplementation, S as SpanProcessor, C as ContextValues, b as Context, T as Tracer, c as ReadableSpan, d as SpanAttributes, e as SpanExporter, f as AIComponent, P as Prompt, g as ChatCompletionRequestPayloads, D as DebugMessage, E as EvaluatorResult, h as EvaluatorFn, i as PromptParsed, J as JSX } from './jsx-dev-runtime-yLtSq2UV.mjs';
|
|
2
|
+
export { z as AIElement, k as AIFragment, B as BoundLogger, p as ChatCompletionUsage, m as ChatMessage, n as ChatRole, v as CombinedLogger, u as ConsoleLogger, I as ImagePart, o 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, j as createAIElement, l as createContext, t as toDebugMessage } from './jsx-dev-runtime-yLtSq2UV.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';
|
|
6
|
-
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam
|
|
6
|
+
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam } from 'openai/resources';
|
|
7
7
|
import AnthropicClient from '@anthropic-ai/sdk';
|
|
8
8
|
export { default as AnthropicClient } from '@anthropic-ai/sdk';
|
|
9
9
|
import { PromptFeedback, GenerateContentRequest, VertexAI, HarmCategory, HarmBlockThreshold } from '@google-cloud/vertexai';
|
|
@@ -20,21 +20,17 @@ declare class ChatCompletionError extends Error {
|
|
|
20
20
|
|
|
21
21
|
declare const SystemMessage: (props: {
|
|
22
22
|
children: AINode;
|
|
23
|
+
cachePrompt?: boolean;
|
|
23
24
|
}) => AINode;
|
|
24
25
|
declare const UserMessage: (props: {
|
|
25
26
|
children: AINode;
|
|
27
|
+
cachePrompt?: boolean;
|
|
26
28
|
}) => AINode;
|
|
27
29
|
declare const AssistantMessage: (props: {
|
|
28
30
|
children: AINode;
|
|
31
|
+
cachePrompt?: boolean;
|
|
29
32
|
}) => AINode;
|
|
30
33
|
|
|
31
|
-
type TokenizerFn = (message: ChatMessage) => number;
|
|
32
|
-
declare const computeUsage: (messages: ChatMessage[], tokenizer: TokenizerFn) => {
|
|
33
|
-
prompt: number;
|
|
34
|
-
completion: number;
|
|
35
|
-
total: number;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
34
|
type ChatCompletionClientAndProvider<K> = {
|
|
39
35
|
client: K;
|
|
40
36
|
provider?: string;
|
|
@@ -42,6 +38,8 @@ type ChatCompletionClientAndProvider<K> = {
|
|
|
42
38
|
costFn?: (model: string, usage: {
|
|
43
39
|
prompt: number;
|
|
44
40
|
completion: number;
|
|
41
|
+
cachedPromptTokensCreated: number;
|
|
42
|
+
cachedPromptTokensRead: number;
|
|
45
43
|
}) => number;
|
|
46
44
|
};
|
|
47
45
|
type GetChatCompletionClientAndProvider<Model, Client> = (model: Model, args: {
|
|
@@ -260,15 +258,13 @@ type OpenAIChatCompletionProps = {
|
|
|
260
258
|
maxTokens?: number;
|
|
261
259
|
temperature?: number;
|
|
262
260
|
stop?: string | string[];
|
|
263
|
-
responseFormat?:
|
|
261
|
+
responseFormat?: 'json_object' | 'text';
|
|
264
262
|
maxRetries?: number;
|
|
265
263
|
stream?: boolean;
|
|
266
264
|
children: AINode;
|
|
267
265
|
};
|
|
268
266
|
declare function OpenAIChatCompletion(props: OpenAIChatCompletionProps, ctx: RenderContext): AINode;
|
|
269
267
|
|
|
270
|
-
declare const openaiTokenizer: TokenizerFn;
|
|
271
|
-
|
|
272
268
|
type AnthropicChatCompletionRequest = AnthropicClient.Messages.MessageStreamParams & {
|
|
273
269
|
extraHeaders?: Record<string, string>;
|
|
274
270
|
};
|
|
@@ -295,7 +291,16 @@ type AnthropicChatCompletionProps = {
|
|
|
295
291
|
};
|
|
296
292
|
declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, ctx: RenderContext): JSX.Element;
|
|
297
293
|
|
|
298
|
-
|
|
294
|
+
/**
|
|
295
|
+
* This component aids in debugging prompt caching breakpoints by showing the content
|
|
296
|
+
* between breakpoints and the hash of the content.
|
|
297
|
+
*/
|
|
298
|
+
type AnthropicPromptCacheDebuggerProps = {
|
|
299
|
+
children: AINode;
|
|
300
|
+
sliceSize?: number;
|
|
301
|
+
hashContent?: boolean;
|
|
302
|
+
};
|
|
303
|
+
declare const AnthropicPromptCacheDebugger: (props: AnthropicPromptCacheDebuggerProps, ctx: RenderContext) => Promise<string>;
|
|
299
304
|
|
|
300
305
|
type GoogleChatCompletionRequest = GenerateContentRequest;
|
|
301
306
|
declare module '@gammatech/aijsx' {
|
|
@@ -325,4 +330,4 @@ type GoogleChatCompletionProps = {
|
|
|
325
330
|
};
|
|
326
331
|
declare function GoogleChatCompletion(props: GoogleChatCompletionProps, ctx: RenderContext): JSX.Element;
|
|
327
332
|
|
|
328
|
-
export { AIComponent, AINode, AISpanAttributes, AISpanProcessor, Accumulate, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, AssistantMessage, type ChatCompletionClientAndProvider, ChatCompletionError, type ChatCompletionRequestPayloads,
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { L as LogChatCompletionRequest, A as AINode,
|
|
2
|
-
export {
|
|
1
|
+
import { L as LogChatCompletionRequest, A as AINode, R as RenderContext, a as LogImplementation, S as SpanProcessor, C as ContextValues, b as Context, T as Tracer, c as ReadableSpan, d as SpanAttributes, e as SpanExporter, f as AIComponent, P as Prompt, g as ChatCompletionRequestPayloads, D as DebugMessage, E as EvaluatorResult, h as EvaluatorFn, i as PromptParsed, J as JSX } from './jsx-dev-runtime-yLtSq2UV.js';
|
|
2
|
+
export { z as AIElement, k as AIFragment, B as BoundLogger, p as ChatCompletionUsage, m as ChatMessage, n as ChatRole, v as CombinedLogger, u as ConsoleLogger, I as ImagePart, o 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, j as createAIElement, l as createContext, t as toDebugMessage } from './jsx-dev-runtime-yLtSq2UV.js';
|
|
3
3
|
import { ZodObject, ZodRawShape, ZodTypeAny, ZodString, z } from 'zod';
|
|
4
4
|
import { OpenAI } from 'openai';
|
|
5
5
|
export { OpenAI as OpenAIClient } from 'openai';
|
|
6
|
-
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam
|
|
6
|
+
import { ChatCompletionSystemMessageParam, ChatCompletionUserMessageParam, ChatCompletionAssistantMessageParam } from 'openai/resources';
|
|
7
7
|
import AnthropicClient from '@anthropic-ai/sdk';
|
|
8
8
|
export { default as AnthropicClient } from '@anthropic-ai/sdk';
|
|
9
9
|
import { PromptFeedback, GenerateContentRequest, VertexAI, HarmCategory, HarmBlockThreshold } from '@google-cloud/vertexai';
|
|
@@ -20,21 +20,17 @@ declare class ChatCompletionError extends Error {
|
|
|
20
20
|
|
|
21
21
|
declare const SystemMessage: (props: {
|
|
22
22
|
children: AINode;
|
|
23
|
+
cachePrompt?: boolean;
|
|
23
24
|
}) => AINode;
|
|
24
25
|
declare const UserMessage: (props: {
|
|
25
26
|
children: AINode;
|
|
27
|
+
cachePrompt?: boolean;
|
|
26
28
|
}) => AINode;
|
|
27
29
|
declare const AssistantMessage: (props: {
|
|
28
30
|
children: AINode;
|
|
31
|
+
cachePrompt?: boolean;
|
|
29
32
|
}) => AINode;
|
|
30
33
|
|
|
31
|
-
type TokenizerFn = (message: ChatMessage) => number;
|
|
32
|
-
declare const computeUsage: (messages: ChatMessage[], tokenizer: TokenizerFn) => {
|
|
33
|
-
prompt: number;
|
|
34
|
-
completion: number;
|
|
35
|
-
total: number;
|
|
36
|
-
};
|
|
37
|
-
|
|
38
34
|
type ChatCompletionClientAndProvider<K> = {
|
|
39
35
|
client: K;
|
|
40
36
|
provider?: string;
|
|
@@ -42,6 +38,8 @@ type ChatCompletionClientAndProvider<K> = {
|
|
|
42
38
|
costFn?: (model: string, usage: {
|
|
43
39
|
prompt: number;
|
|
44
40
|
completion: number;
|
|
41
|
+
cachedPromptTokensCreated: number;
|
|
42
|
+
cachedPromptTokensRead: number;
|
|
45
43
|
}) => number;
|
|
46
44
|
};
|
|
47
45
|
type GetChatCompletionClientAndProvider<Model, Client> = (model: Model, args: {
|
|
@@ -260,15 +258,13 @@ type OpenAIChatCompletionProps = {
|
|
|
260
258
|
maxTokens?: number;
|
|
261
259
|
temperature?: number;
|
|
262
260
|
stop?: string | string[];
|
|
263
|
-
responseFormat?:
|
|
261
|
+
responseFormat?: 'json_object' | 'text';
|
|
264
262
|
maxRetries?: number;
|
|
265
263
|
stream?: boolean;
|
|
266
264
|
children: AINode;
|
|
267
265
|
};
|
|
268
266
|
declare function OpenAIChatCompletion(props: OpenAIChatCompletionProps, ctx: RenderContext): AINode;
|
|
269
267
|
|
|
270
|
-
declare const openaiTokenizer: TokenizerFn;
|
|
271
|
-
|
|
272
268
|
type AnthropicChatCompletionRequest = AnthropicClient.Messages.MessageStreamParams & {
|
|
273
269
|
extraHeaders?: Record<string, string>;
|
|
274
270
|
};
|
|
@@ -295,7 +291,16 @@ type AnthropicChatCompletionProps = {
|
|
|
295
291
|
};
|
|
296
292
|
declare function AnthropicChatCompletion(props: AnthropicChatCompletionProps, ctx: RenderContext): JSX.Element;
|
|
297
293
|
|
|
298
|
-
|
|
294
|
+
/**
|
|
295
|
+
* This component aids in debugging prompt caching breakpoints by showing the content
|
|
296
|
+
* between breakpoints and the hash of the content.
|
|
297
|
+
*/
|
|
298
|
+
type AnthropicPromptCacheDebuggerProps = {
|
|
299
|
+
children: AINode;
|
|
300
|
+
sliceSize?: number;
|
|
301
|
+
hashContent?: boolean;
|
|
302
|
+
};
|
|
303
|
+
declare const AnthropicPromptCacheDebugger: (props: AnthropicPromptCacheDebuggerProps, ctx: RenderContext) => Promise<string>;
|
|
299
304
|
|
|
300
305
|
type GoogleChatCompletionRequest = GenerateContentRequest;
|
|
301
306
|
declare module '@gammatech/aijsx' {
|
|
@@ -325,4 +330,4 @@ type GoogleChatCompletionProps = {
|
|
|
325
330
|
};
|
|
326
331
|
declare function GoogleChatCompletion(props: GoogleChatCompletionProps, ctx: RenderContext): JSX.Element;
|
|
327
332
|
|
|
328
|
-
export { AIComponent, AINode, AISpanAttributes, AISpanProcessor, Accumulate, AnthropicChatCompletion, type AnthropicChatCompletionRequest, AnthropicClientContext, AssistantMessage, type ChatCompletionClientAndProvider, ChatCompletionError, type ChatCompletionRequestPayloads,
|
|
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 };
|