@posthog/ai 6.3.3 → 6.4.0
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/anthropic/index.cjs +1 -1
- package/dist/anthropic/index.cjs.map +1 -1
- package/dist/anthropic/index.d.ts +2 -2
- package/dist/anthropic/index.mjs +1 -1
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/gemini/index.cjs +1 -1
- package/dist/gemini/index.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +19 -19
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/langchain/index.cjs +1 -1
- package/dist/langchain/index.cjs.map +1 -1
- package/dist/langchain/index.mjs +1 -1
- package/dist/langchain/index.mjs.map +1 -1
- package/dist/openai/index.cjs +1 -1
- package/dist/openai/index.mjs +1 -1
- package/dist/vercel/index.cjs +1 -1
- package/dist/vercel/index.mjs +1 -1
- package/package.json +10 -10
package/dist/index.d.ts
CHANGED
|
@@ -3,8 +3,7 @@ import { PostHog } from 'posthog-node';
|
|
|
3
3
|
import { Stream } from 'openai/streaming';
|
|
4
4
|
import { ParsedResponse } from 'openai/resources/responses/responses';
|
|
5
5
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
6
|
-
import AnthropicOriginal from '@anthropic-ai/sdk';
|
|
7
|
-
import { RequestOptions as RequestOptions$2, APIPromise as APIPromise$1 } from '@anthropic-ai/sdk/core';
|
|
6
|
+
import AnthropicOriginal, { APIPromise as APIPromise$1 } from '@anthropic-ai/sdk';
|
|
8
7
|
import { Stream as Stream$1 } from '@anthropic-ai/sdk/streaming';
|
|
9
8
|
import { GoogleGenAI, GenerateContentParameters, GenerateContentResponse } from '@google/genai';
|
|
10
9
|
import { BaseCallbackHandler } from '@langchain/core/callbacks/base';
|
|
@@ -54,7 +53,7 @@ interface MonitoringOpenAIConfig$1 extends ClientOptions$1 {
|
|
|
54
53
|
posthog: PostHog;
|
|
55
54
|
baseURL?: string;
|
|
56
55
|
}
|
|
57
|
-
type RequestOptions$
|
|
56
|
+
type RequestOptions$2 = Record<string, any>;
|
|
58
57
|
declare class PostHogOpenAI extends OpenAI {
|
|
59
58
|
private readonly phClient;
|
|
60
59
|
chat: WrappedChat$1;
|
|
@@ -70,24 +69,24 @@ declare class WrappedCompletions$1 extends Completions {
|
|
|
70
69
|
private readonly phClient;
|
|
71
70
|
private readonly baseURL;
|
|
72
71
|
constructor(client: OpenAI, phClient: PostHog);
|
|
73
|
-
create(body: ChatCompletionCreateParamsNonStreaming$1 & MonitoringParams, options?: RequestOptions$
|
|
74
|
-
create(body: ChatCompletionCreateParamsStreaming$1 & MonitoringParams, options?: RequestOptions$
|
|
75
|
-
create(body: ChatCompletionCreateParamsBase$1 & MonitoringParams, options?: RequestOptions$
|
|
72
|
+
create(body: ChatCompletionCreateParamsNonStreaming$1 & MonitoringParams, options?: RequestOptions$2): APIPromise<ChatCompletion$1>;
|
|
73
|
+
create(body: ChatCompletionCreateParamsStreaming$1 & MonitoringParams, options?: RequestOptions$2): APIPromise<Stream<ChatCompletionChunk$1>>;
|
|
74
|
+
create(body: ChatCompletionCreateParamsBase$1 & MonitoringParams, options?: RequestOptions$2): APIPromise<ChatCompletion$1 | Stream<ChatCompletionChunk$1>>;
|
|
76
75
|
}
|
|
77
76
|
declare class WrappedResponses extends Responses {
|
|
78
77
|
private readonly phClient;
|
|
79
78
|
private readonly baseURL;
|
|
80
79
|
constructor(client: OpenAI, phClient: PostHog);
|
|
81
|
-
create(body: ResponsesCreateParamsNonStreaming & MonitoringParams, options?: RequestOptions$
|
|
82
|
-
create(body: ResponsesCreateParamsStreaming & MonitoringParams, options?: RequestOptions$
|
|
83
|
-
create(body: ResponsesCreateParamsBase & MonitoringParams, options?: RequestOptions$
|
|
84
|
-
parse<Params extends ResponsesCreateParamsBase, ParsedT = any>(body: Params & MonitoringParams, options?: RequestOptions$
|
|
80
|
+
create(body: ResponsesCreateParamsNonStreaming & MonitoringParams, options?: RequestOptions$2): APIPromise<OpenAI.Responses.Response>;
|
|
81
|
+
create(body: ResponsesCreateParamsStreaming & MonitoringParams, options?: RequestOptions$2): APIPromise<Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
82
|
+
create(body: ResponsesCreateParamsBase & MonitoringParams, options?: RequestOptions$2): APIPromise<OpenAI.Responses.Response | Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
83
|
+
parse<Params extends ResponsesCreateParamsBase, ParsedT = any>(body: Params & MonitoringParams, options?: RequestOptions$2): APIPromise<ParsedResponse<ParsedT>>;
|
|
85
84
|
}
|
|
86
85
|
declare class WrappedEmbeddings$1 extends Embeddings {
|
|
87
86
|
private readonly phClient;
|
|
88
87
|
private readonly baseURL;
|
|
89
88
|
constructor(client: OpenAI, phClient: PostHog);
|
|
90
|
-
create(body: EmbeddingCreateParams$1 & MonitoringParams, options?: RequestOptions$
|
|
89
|
+
create(body: EmbeddingCreateParams$1 & MonitoringParams, options?: RequestOptions$2): APIPromise<CreateEmbeddingResponse$1>;
|
|
91
90
|
}
|
|
92
91
|
|
|
93
92
|
type ChatCompletion = OpenAIOrignal.ChatCompletion;
|
|
@@ -102,7 +101,7 @@ interface MonitoringOpenAIConfig {
|
|
|
102
101
|
posthog: PostHog;
|
|
103
102
|
baseURL?: string;
|
|
104
103
|
}
|
|
105
|
-
type RequestOptions = Record<string, any>;
|
|
104
|
+
type RequestOptions$1 = Record<string, any>;
|
|
106
105
|
declare class PostHogAzureOpenAI extends AzureOpenAI {
|
|
107
106
|
private readonly phClient;
|
|
108
107
|
chat: WrappedChat;
|
|
@@ -117,15 +116,15 @@ declare class WrappedCompletions extends AzureOpenAI.Chat.Completions {
|
|
|
117
116
|
private readonly phClient;
|
|
118
117
|
private readonly baseURL;
|
|
119
118
|
constructor(client: AzureOpenAI, phClient: PostHog);
|
|
120
|
-
create(body: ChatCompletionCreateParamsNonStreaming & MonitoringParams, options?: RequestOptions): APIPromise<ChatCompletion>;
|
|
121
|
-
create(body: ChatCompletionCreateParamsStreaming & MonitoringParams, options?: RequestOptions): APIPromise<Stream<ChatCompletionChunk>>;
|
|
122
|
-
create(body: ChatCompletionCreateParamsBase & MonitoringParams, options?: RequestOptions): APIPromise<ChatCompletion | Stream<ChatCompletionChunk>>;
|
|
119
|
+
create(body: ChatCompletionCreateParamsNonStreaming & MonitoringParams, options?: RequestOptions$1): APIPromise<ChatCompletion>;
|
|
120
|
+
create(body: ChatCompletionCreateParamsStreaming & MonitoringParams, options?: RequestOptions$1): APIPromise<Stream<ChatCompletionChunk>>;
|
|
121
|
+
create(body: ChatCompletionCreateParamsBase & MonitoringParams, options?: RequestOptions$1): APIPromise<ChatCompletion | Stream<ChatCompletionChunk>>;
|
|
123
122
|
}
|
|
124
123
|
declare class WrappedEmbeddings extends AzureOpenAI.Embeddings {
|
|
125
124
|
private readonly phClient;
|
|
126
125
|
private readonly baseURL;
|
|
127
126
|
constructor(client: AzureOpenAI, phClient: PostHog);
|
|
128
|
-
create(body: EmbeddingCreateParams & MonitoringParams, options?: RequestOptions): APIPromise<CreateEmbeddingResponse>;
|
|
127
|
+
create(body: EmbeddingCreateParams & MonitoringParams, options?: RequestOptions$1): APIPromise<CreateEmbeddingResponse>;
|
|
129
128
|
}
|
|
130
129
|
|
|
131
130
|
interface ClientOptions {
|
|
@@ -146,6 +145,7 @@ type MessageCreateParamsStreaming = AnthropicOriginal.Messages.MessageCreatePara
|
|
|
146
145
|
type Message = AnthropicOriginal.Messages.Message;
|
|
147
146
|
type RawMessageStreamEvent = AnthropicOriginal.Messages.RawMessageStreamEvent;
|
|
148
147
|
type MessageCreateParamsBase = AnthropicOriginal.Messages.MessageCreateParams;
|
|
148
|
+
type RequestOptions = AnthropicOriginal.RequestOptions;
|
|
149
149
|
|
|
150
150
|
interface MonitoringAnthropicConfig {
|
|
151
151
|
apiKey: string;
|
|
@@ -161,9 +161,9 @@ declare class WrappedMessages extends AnthropicOriginal.Messages {
|
|
|
161
161
|
private readonly phClient;
|
|
162
162
|
private readonly baseURL;
|
|
163
163
|
constructor(parentClient: PostHogAnthropic, phClient: PostHog);
|
|
164
|
-
create(body: MessageCreateParamsNonStreaming, options?: RequestOptions
|
|
165
|
-
create(body: MessageCreateParamsStreaming & MonitoringParams, options?: RequestOptions
|
|
166
|
-
create(body: MessageCreateParamsBase & MonitoringParams, options?: RequestOptions
|
|
164
|
+
create(body: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise$1<Message>;
|
|
165
|
+
create(body: MessageCreateParamsStreaming & MonitoringParams, options?: RequestOptions): APIPromise$1<Stream$1<RawMessageStreamEvent>>;
|
|
166
|
+
create(body: MessageCreateParamsBase & MonitoringParams, options?: RequestOptions): APIPromise$1<Stream$1<RawMessageStreamEvent> | Message>;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
interface MonitoringGeminiConfig {
|
package/dist/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import { wrapLanguageModel } from 'ai';
|
|
|
6
6
|
import AnthropicOriginal from '@anthropic-ai/sdk';
|
|
7
7
|
import { GoogleGenAI } from '@google/genai';
|
|
8
8
|
|
|
9
|
-
var version = "6.
|
|
9
|
+
var version = "6.4.0";
|
|
10
10
|
|
|
11
11
|
// limit large outputs by truncating to 200kb (approx 200k bytes)
|
|
12
12
|
const MAX_OUTPUT_SIZE = 200000;
|