@posthog/ai 8.10.0 → 8.10.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/adk/index.cjs +908 -1198
- package/dist/adk/index.cjs.map +1 -1
- package/dist/adk/index.d.ts +109 -109
- package/dist/adk/index.mjs +907 -1196
- package/dist/adk/index.mjs.map +1 -1
- package/dist/anthropic/index.cjs +927 -1111
- package/dist/anthropic/index.cjs.map +1 -1
- package/dist/anthropic/index.d.ts +34 -33
- package/dist/anthropic/index.mjs +899 -1102
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/gemini/index.cjs +863 -1108
- package/dist/gemini/index.cjs.map +1 -1
- package/dist/gemini/index.d.ts +38 -35
- package/dist/gemini/index.mjs +858 -1103
- package/dist/gemini/index.mjs.map +1 -1
- package/dist/index.cjs +1218 -1546
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +170 -163
- package/dist/index.mjs +1216 -1544
- package/dist/index.mjs.map +1 -1
- package/dist/langchain/index.cjs +851 -1029
- package/dist/langchain/index.cjs.map +1 -1
- package/dist/langchain/index.d.ts +75 -75
- package/dist/langchain/index.mjs +850 -1027
- package/dist/langchain/index.mjs.map +1 -1
- package/dist/langchain/middleware/index.cjs +1016 -1225
- package/dist/langchain/middleware/index.cjs.map +1 -1
- package/dist/langchain/middleware/index.d.ts +29 -25
- package/dist/langchain/middleware/index.mjs +1015 -1223
- package/dist/langchain/middleware/index.mjs.map +1 -1
- package/dist/openai/index.cjs +1990 -2523
- package/dist/openai/index.cjs.map +1 -1
- package/dist/openai/index.d.ts +106 -104
- package/dist/openai/index.mjs +1985 -2518
- package/dist/openai/index.mjs.map +1 -1
- package/dist/openai-agents/index.cjs +745 -827
- package/dist/openai-agents/index.cjs.map +1 -1
- package/dist/openai-agents/index.d.ts +48 -47
- package/dist/openai-agents/index.mjs +744 -825
- package/dist/openai-agents/index.mjs.map +1 -1
- package/dist/otel/index.cjs +427 -486
- package/dist/otel/index.cjs.map +1 -1
- package/dist/otel/index.d.ts +36 -35
- package/dist/otel/index.mjs +426 -484
- package/dist/otel/index.mjs.map +1 -1
- package/dist/vercel/index.cjs +992 -1343
- package/dist/vercel/index.cjs.map +1 -1
- package/dist/vercel/index.d.ts +21 -16
- package/dist/vercel/index.mjs +991 -1341
- package/dist/vercel/index.mjs.map +1 -1
- package/package.json +15 -14
package/dist/openai/index.d.ts
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import OpenAIOrignal, { AzureOpenAI,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
1
|
+
import OpenAIOrignal, { APIPromise, AzureOpenAI, ClientOptions, OpenAI } from "openai";
|
|
2
|
+
import { Stream } from "openai/streaming";
|
|
3
|
+
import { PostHog } from "posthog-node";
|
|
4
|
+
import "@anthropic-ai/sdk";
|
|
5
|
+
import { ExtractParsedContentFromParams, ResponseCreateParamsWithTools } from "openai/lib/ResponsesParser";
|
|
6
|
+
import { ParsedResponse, ResponseRetrieveParamsBase, ResponseRetrieveParamsNonStreaming, ResponseRetrieveParamsStreaming } from "openai/resources/responses/responses";
|
|
7
|
+
import { AzureClientOptions } from "openai/azure";
|
|
8
|
+
//#region src/utils.d.ts
|
|
8
9
|
interface MonitoringEventPropertiesWithDefaults {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
distinctId?: string;
|
|
11
|
+
traceId: string;
|
|
12
|
+
properties?: Record<string, any>;
|
|
13
|
+
privacyMode: boolean;
|
|
14
|
+
groups?: Record<string, any>;
|
|
15
|
+
modelOverride?: string;
|
|
16
|
+
providerOverride?: string;
|
|
17
|
+
costOverride?: CostOverride;
|
|
18
|
+
captureImmediate?: boolean;
|
|
18
19
|
}
|
|
19
20
|
type MonitoringEventProperties = Partial<MonitoringEventPropertiesWithDefaults>;
|
|
20
|
-
type MonitoringParams = {
|
|
21
|
-
[K in keyof MonitoringEventProperties as `posthog${Capitalize<string & K>}`]: MonitoringEventProperties[K];
|
|
22
|
-
};
|
|
21
|
+
type MonitoringParams = { [K in keyof MonitoringEventProperties as `posthog${Capitalize<string & K>}`]: MonitoringEventProperties[K]; };
|
|
23
22
|
interface CostOverride {
|
|
24
|
-
|
|
25
|
-
|
|
23
|
+
inputCost: number;
|
|
24
|
+
outputCost: number;
|
|
26
25
|
}
|
|
27
|
-
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/openai/azure.d.ts
|
|
28
28
|
type ChatCompletion$1 = OpenAIOrignal.ChatCompletion;
|
|
29
29
|
type ChatCompletionChunk$1 = OpenAIOrignal.ChatCompletionChunk;
|
|
30
30
|
type ChatCompletionCreateParamsBase$1 = OpenAIOrignal.Chat.Completions.ChatCompletionCreateParams;
|
|
@@ -36,51 +36,52 @@ type ResponsesCreateParamsStreaming$1 = OpenAIOrignal.Responses.ResponseCreatePa
|
|
|
36
36
|
type CreateEmbeddingResponse$1 = OpenAIOrignal.CreateEmbeddingResponse;
|
|
37
37
|
type EmbeddingCreateParams$1 = OpenAIOrignal.EmbeddingCreateParams;
|
|
38
38
|
interface MonitoringOpenAIConfig$1 extends AzureClientOptions {
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
apiKey: string;
|
|
40
|
+
posthog: PostHog;
|
|
41
41
|
}
|
|
42
42
|
type RequestOptions$1 = Record<string, any>;
|
|
43
43
|
declare class PostHogAzureOpenAI extends AzureOpenAI {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
private readonly phClient;
|
|
45
|
+
chat: WrappedChat$1;
|
|
46
|
+
responses: WrappedResponses$1;
|
|
47
|
+
embeddings: WrappedEmbeddings$1;
|
|
48
|
+
constructor(config: MonitoringOpenAIConfig$1);
|
|
49
49
|
}
|
|
50
50
|
declare class WrappedChat$1 extends AzureOpenAI.Chat {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
constructor(parentClient: PostHogAzureOpenAI, phClient: PostHog);
|
|
52
|
+
completions: WrappedCompletions$1;
|
|
53
53
|
}
|
|
54
54
|
declare class WrappedCompletions$1 extends AzureOpenAI.Chat.Completions {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
55
|
+
private readonly phClient;
|
|
56
|
+
private readonly baseURL;
|
|
57
|
+
constructor(client: AzureOpenAI, phClient: PostHog);
|
|
58
|
+
create(body: ChatCompletionCreateParamsNonStreaming$1 & MonitoringParams, options?: RequestOptions$1): APIPromise<ChatCompletion$1>;
|
|
59
|
+
create(body: ChatCompletionCreateParamsStreaming$1 & MonitoringParams, options?: RequestOptions$1): APIPromise<Stream<ChatCompletionChunk$1>>;
|
|
60
|
+
create(body: ChatCompletionCreateParamsBase$1 & MonitoringParams, options?: RequestOptions$1): APIPromise<ChatCompletion$1 | Stream<ChatCompletionChunk$1>>;
|
|
61
61
|
}
|
|
62
62
|
declare class WrappedResponses$1 extends AzureOpenAI.Responses {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
63
|
+
private readonly phClient;
|
|
64
|
+
private readonly baseURL;
|
|
65
|
+
private readonly backgroundResponses;
|
|
66
|
+
constructor(client: AzureOpenAI, phClient: PostHog);
|
|
67
|
+
private captureBackgroundResponse;
|
|
68
|
+
create(body: ResponsesCreateParamsNonStreaming$1 & MonitoringParams, options?: RequestOptions$1): APIPromise<OpenAIOrignal.Responses.Response>;
|
|
69
|
+
create(body: ResponsesCreateParamsStreaming$1 & MonitoringParams, options?: RequestOptions$1): APIPromise<Stream<OpenAIOrignal.Responses.ResponseStreamEvent>>;
|
|
70
|
+
create(body: ResponsesCreateParamsBase$1 & MonitoringParams, options?: RequestOptions$1): APIPromise<OpenAIOrignal.Responses.Response | Stream<OpenAIOrignal.Responses.ResponseStreamEvent>>;
|
|
71
|
+
retrieve(responseID: string, query?: ResponseRetrieveParamsNonStreaming, options?: RequestOptions$1): APIPromise<OpenAIOrignal.Responses.Response>;
|
|
72
|
+
retrieve(responseID: string, query: ResponseRetrieveParamsStreaming, options?: RequestOptions$1): APIPromise<Stream<OpenAIOrignal.Responses.ResponseStreamEvent>>;
|
|
73
|
+
retrieve(responseID: string, query?: ResponseRetrieveParamsBase, options?: RequestOptions$1): APIPromise<OpenAIOrignal.Responses.Response | Stream<OpenAIOrignal.Responses.ResponseStreamEvent>>;
|
|
74
|
+
cancel(responseID: string, options?: RequestOptions$1): APIPromise<OpenAIOrignal.Responses.Response>;
|
|
75
|
+
parse<Params extends ResponseCreateParamsWithTools, ParsedT = ExtractParsedContentFromParams<Params>>(body: Params & MonitoringParams, options?: RequestOptions$1): APIPromise<ParsedResponse<ParsedT>>;
|
|
76
76
|
}
|
|
77
77
|
declare class WrappedEmbeddings$1 extends AzureOpenAI.Embeddings {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
private readonly phClient;
|
|
79
|
+
private readonly baseURL;
|
|
80
|
+
constructor(client: AzureOpenAI, phClient: PostHog);
|
|
81
|
+
create(body: EmbeddingCreateParams$1 & MonitoringParams, options?: RequestOptions$1): APIPromise<CreateEmbeddingResponse$1>;
|
|
82
82
|
}
|
|
83
|
-
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/openai/index.d.ts
|
|
84
85
|
declare const Chat: typeof OpenAI.Chat;
|
|
85
86
|
declare const Completions: typeof OpenAI.Chat.Completions;
|
|
86
87
|
declare const Responses: typeof OpenAI.Responses;
|
|
@@ -98,67 +99,68 @@ type ResponsesCreateParamsStreaming = OpenAI.Responses.ResponseCreateParamsStrea
|
|
|
98
99
|
type CreateEmbeddingResponse = OpenAI.CreateEmbeddingResponse;
|
|
99
100
|
type EmbeddingCreateParams = OpenAI.EmbeddingCreateParams;
|
|
100
101
|
interface MonitoringOpenAIConfig extends ClientOptions {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
apiKey: string;
|
|
103
|
+
posthog: PostHog;
|
|
104
|
+
baseURL?: string;
|
|
104
105
|
}
|
|
105
106
|
type RequestOptions = Record<string, unknown>;
|
|
106
107
|
declare class PostHogOpenAI extends OpenAI {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
private readonly phClient;
|
|
109
|
+
chat: WrappedChat;
|
|
110
|
+
responses: WrappedResponses;
|
|
111
|
+
embeddings: WrappedEmbeddings;
|
|
112
|
+
audio: WrappedAudio;
|
|
113
|
+
constructor(config: MonitoringOpenAIConfig);
|
|
113
114
|
}
|
|
114
115
|
declare class WrappedChat extends Chat {
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
constructor(parentClient: PostHogOpenAI, phClient: PostHog);
|
|
117
|
+
completions: WrappedCompletions;
|
|
117
118
|
}
|
|
118
119
|
declare class WrappedCompletions extends Completions {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
120
|
+
private readonly phClient;
|
|
121
|
+
private readonly baseURL;
|
|
122
|
+
constructor(client: OpenAI, phClient: PostHog);
|
|
123
|
+
create(body: ChatCompletionCreateParamsNonStreaming & MonitoringParams, options?: RequestOptions): APIPromise<ChatCompletion>;
|
|
124
|
+
create(body: ChatCompletionCreateParamsStreaming & MonitoringParams, options?: RequestOptions): APIPromise<Stream<ChatCompletionChunk>>;
|
|
125
|
+
create(body: ChatCompletionCreateParamsBase & MonitoringParams, options?: RequestOptions): APIPromise<ChatCompletion | Stream<ChatCompletionChunk>>;
|
|
125
126
|
}
|
|
126
127
|
declare class WrappedResponses extends Responses {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
private readonly phClient;
|
|
129
|
+
private readonly baseURL;
|
|
130
|
+
private readonly backgroundResponses;
|
|
131
|
+
constructor(client: OpenAI, phClient: PostHog);
|
|
132
|
+
private captureBackgroundResponse;
|
|
133
|
+
create(body: ResponsesCreateParamsNonStreaming & MonitoringParams, options?: RequestOptions): APIPromise<OpenAI.Responses.Response>;
|
|
134
|
+
create(body: ResponsesCreateParamsStreaming & MonitoringParams, options?: RequestOptions): APIPromise<Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
135
|
+
create(body: ResponsesCreateParamsBase & MonitoringParams, options?: RequestOptions): APIPromise<OpenAI.Responses.Response | Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
136
|
+
retrieve(responseID: string, query?: ResponseRetrieveParamsNonStreaming, options?: RequestOptions): APIPromise<OpenAI.Responses.Response>;
|
|
137
|
+
retrieve(responseID: string, query: ResponseRetrieveParamsStreaming, options?: RequestOptions): APIPromise<Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
138
|
+
retrieve(responseID: string, query?: ResponseRetrieveParamsBase, options?: RequestOptions): APIPromise<OpenAI.Responses.Response | Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
139
|
+
cancel(responseID: string, options?: RequestOptions): APIPromise<OpenAI.Responses.Response>;
|
|
140
|
+
parse<Params extends ResponseCreateParamsWithTools, ParsedT = ExtractParsedContentFromParams<Params>>(body: Params & MonitoringParams, options?: RequestOptions): APIPromise<ParsedResponse<ParsedT>>;
|
|
140
141
|
}
|
|
141
142
|
declare class WrappedEmbeddings extends Embeddings {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
private readonly phClient;
|
|
144
|
+
private readonly baseURL;
|
|
145
|
+
constructor(client: OpenAI, phClient: PostHog);
|
|
146
|
+
create(body: EmbeddingCreateParams & MonitoringParams, options?: RequestOptions): APIPromise<CreateEmbeddingResponse>;
|
|
146
147
|
}
|
|
147
148
|
declare class WrappedAudio extends Audio {
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
constructor(parentClient: PostHogOpenAI, phClient: PostHog);
|
|
150
|
+
transcriptions: WrappedTranscriptions;
|
|
150
151
|
}
|
|
151
152
|
declare class WrappedTranscriptions extends Transcriptions {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
export { PostHogAzureOpenAI as AzureOpenAI, PostHogOpenAI as OpenAI, PostHogOpenAI, WrappedAudio, WrappedChat, WrappedCompletions, WrappedEmbeddings, WrappedResponses, WrappedTranscriptions
|
|
153
|
+
private readonly phClient;
|
|
154
|
+
private readonly baseURL;
|
|
155
|
+
constructor(client: OpenAI, phClient: PostHog);
|
|
156
|
+
create(body: OpenAI.Audio.Transcriptions.TranscriptionCreateParamsNonStreaming<'json' | undefined> & MonitoringParams, options?: RequestOptions): APIPromise<OpenAI.Audio.Transcriptions.Transcription>;
|
|
157
|
+
create(body: OpenAI.Audio.Transcriptions.TranscriptionCreateParamsNonStreaming<'verbose_json'> & MonitoringParams, options?: RequestOptions): APIPromise<OpenAI.Audio.Transcriptions.TranscriptionVerbose>;
|
|
158
|
+
create(body: OpenAI.Audio.Transcriptions.TranscriptionCreateParamsNonStreaming<'srt' | 'vtt' | 'text'> & MonitoringParams, options?: RequestOptions): APIPromise<string>;
|
|
159
|
+
create(body: OpenAI.Audio.Transcriptions.TranscriptionCreateParamsNonStreaming, options?: RequestOptions): APIPromise<OpenAI.Audio.Transcriptions.Transcription>;
|
|
160
|
+
create(body: OpenAI.Audio.Transcriptions.TranscriptionCreateParamsStreaming & MonitoringParams, options?: RequestOptions): APIPromise<Stream<OpenAI.Audio.Transcriptions.TranscriptionStreamEvent>>;
|
|
161
|
+
create(body: OpenAI.Audio.Transcriptions.TranscriptionCreateParamsStreaming & MonitoringParams, options?: RequestOptions): APIPromise<OpenAI.Audio.Transcriptions.TranscriptionCreateResponse | string | Stream<OpenAI.Audio.Transcriptions.TranscriptionStreamEvent>>;
|
|
162
|
+
create(body: OpenAI.Audio.Transcriptions.TranscriptionCreateParams & MonitoringParams, options?: RequestOptions): APIPromise<OpenAI.Audio.Transcriptions.TranscriptionCreateResponse | string | Stream<OpenAI.Audio.Transcriptions.TranscriptionStreamEvent>>;
|
|
163
|
+
}
|
|
164
|
+
//#endregion
|
|
165
|
+
export { PostHogAzureOpenAI as AzureOpenAI, PostHogOpenAI as OpenAI, PostHogOpenAI, PostHogOpenAI as default, WrappedAudio, WrappedChat, WrappedCompletions, WrappedEmbeddings, WrappedResponses, WrappedTranscriptions };
|
|
166
|
+
//# sourceMappingURL=index.d.ts.map
|