@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
|
@@ -1,50 +1,51 @@
|
|
|
1
|
-
import AnthropicOriginal, { APIPromise, ClientOptions } from
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import AnthropicOriginal, { APIPromise, ClientOptions } from "@anthropic-ai/sdk";
|
|
2
|
+
import { Stream } from "@anthropic-ai/sdk/streaming";
|
|
3
|
+
import { PostHog } from "posthog-node";
|
|
4
|
+
import "openai";
|
|
5
|
+
import "openai/lib/ResponsesParser";
|
|
6
|
+
//#region src/utils.d.ts
|
|
5
7
|
interface MonitoringEventPropertiesWithDefaults {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
distinctId?: string;
|
|
9
|
+
traceId: string;
|
|
10
|
+
properties?: Record<string, any>;
|
|
11
|
+
privacyMode: boolean;
|
|
12
|
+
groups?: Record<string, any>;
|
|
13
|
+
modelOverride?: string;
|
|
14
|
+
providerOverride?: string;
|
|
15
|
+
costOverride?: CostOverride;
|
|
16
|
+
captureImmediate?: boolean;
|
|
15
17
|
}
|
|
16
18
|
type MonitoringEventProperties = Partial<MonitoringEventPropertiesWithDefaults>;
|
|
17
|
-
type MonitoringParams = {
|
|
18
|
-
[K in keyof MonitoringEventProperties as `posthog${Capitalize<string & K>}`]: MonitoringEventProperties[K];
|
|
19
|
-
};
|
|
19
|
+
type MonitoringParams = { [K in keyof MonitoringEventProperties as `posthog${Capitalize<string & K>}`]: MonitoringEventProperties[K]; };
|
|
20
20
|
interface CostOverride {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
inputCost: number;
|
|
22
|
+
outputCost: number;
|
|
23
23
|
}
|
|
24
|
-
|
|
24
|
+
//#endregion
|
|
25
|
+
//#region src/anthropic/index.d.ts
|
|
25
26
|
type MessageCreateParamsNonStreaming = AnthropicOriginal.Messages.MessageCreateParamsNonStreaming;
|
|
26
27
|
type MessageCreateParamsStreaming = AnthropicOriginal.Messages.MessageCreateParamsStreaming;
|
|
27
28
|
type Message = AnthropicOriginal.Messages.Message;
|
|
28
29
|
type RawMessageStreamEvent = AnthropicOriginal.Messages.RawMessageStreamEvent;
|
|
29
30
|
type MessageCreateParamsBase = AnthropicOriginal.Messages.MessageCreateParams;
|
|
30
31
|
type RequestOptions = AnthropicOriginal.RequestOptions;
|
|
31
|
-
|
|
32
32
|
interface MonitoringAnthropicConfig extends ClientOptions {
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
apiKey: string;
|
|
34
|
+
posthog: PostHog;
|
|
35
35
|
}
|
|
36
36
|
declare class PostHogAnthropic extends AnthropicOriginal {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
private readonly phClient;
|
|
38
|
+
messages: WrappedMessages;
|
|
39
|
+
constructor(config: MonitoringAnthropicConfig);
|
|
40
40
|
}
|
|
41
41
|
declare class WrappedMessages extends AnthropicOriginal.Messages {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
private readonly phClient;
|
|
43
|
+
private readonly baseURL;
|
|
44
|
+
constructor(parentClient: PostHogAnthropic, phClient: PostHog);
|
|
45
|
+
create(body: MessageCreateParamsNonStreaming, options?: RequestOptions): APIPromise<Message>;
|
|
46
|
+
create(body: MessageCreateParamsStreaming & MonitoringParams, options?: RequestOptions): APIPromise<Stream<RawMessageStreamEvent>>;
|
|
47
|
+
create(body: MessageCreateParamsBase & MonitoringParams, options?: RequestOptions): APIPromise<Stream<RawMessageStreamEvent> | Message>;
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
export { PostHogAnthropic as Anthropic, PostHogAnthropic,
|
|
49
|
+
//#endregion
|
|
50
|
+
export { PostHogAnthropic as Anthropic, PostHogAnthropic, PostHogAnthropic as default, WrappedMessages };
|
|
51
|
+
//# sourceMappingURL=index.d.ts.map
|