@posthog/ai 6.4.0 → 6.4.1
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.mjs +1 -1
- package/dist/anthropic/index.mjs.map +1 -1
- package/dist/gemini/index.cjs +1 -1
- package/dist/gemini/index.cjs.map +1 -1
- package/dist/gemini/index.mjs +1 -1
- package/dist/gemini/index.mjs.map +1 -1
- package/dist/index.cjs +7 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +7 -13
- 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 +5 -10
- package/dist/openai/index.cjs.map +1 -1
- package/dist/openai/index.d.ts +2 -1
- package/dist/openai/index.mjs +5 -10
- package/dist/openai/index.mjs.map +1 -1
- package/dist/vercel/index.cjs +1 -1
- package/dist/vercel/index.cjs.map +1 -1
- package/dist/vercel/index.mjs +1 -1
- package/dist/vercel/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import OpenAIOrignal, { OpenAI, APIPromise, ClientOptions as ClientOptions$1, Az
|
|
|
2
2
|
import { PostHog } from 'posthog-node';
|
|
3
3
|
import { Stream } from 'openai/streaming';
|
|
4
4
|
import { ParsedResponse } from 'openai/resources/responses/responses';
|
|
5
|
+
import { ResponseCreateParamsWithTools, ExtractParsedContentFromParams } from 'openai/lib/ResponsesParser';
|
|
5
6
|
import { LanguageModelV2 } from '@ai-sdk/provider';
|
|
6
7
|
import AnthropicOriginal, { APIPromise as APIPromise$1 } from '@anthropic-ai/sdk';
|
|
7
8
|
import { Stream as Stream$1 } from '@anthropic-ai/sdk/streaming';
|
|
@@ -80,7 +81,7 @@ declare class WrappedResponses extends Responses {
|
|
|
80
81
|
create(body: ResponsesCreateParamsNonStreaming & MonitoringParams, options?: RequestOptions$2): APIPromise<OpenAI.Responses.Response>;
|
|
81
82
|
create(body: ResponsesCreateParamsStreaming & MonitoringParams, options?: RequestOptions$2): APIPromise<Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
82
83
|
create(body: ResponsesCreateParamsBase & MonitoringParams, options?: RequestOptions$2): APIPromise<OpenAI.Responses.Response | Stream<OpenAI.Responses.ResponseStreamEvent>>;
|
|
83
|
-
parse<Params extends
|
|
84
|
+
parse<Params extends ResponseCreateParamsWithTools, ParsedT = ExtractParsedContentFromParams<Params>>(body: Params & MonitoringParams, options?: RequestOptions$2): APIPromise<ParsedResponse<ParsedT>>;
|
|
84
85
|
}
|
|
85
86
|
declare class WrappedEmbeddings$1 extends Embeddings {
|
|
86
87
|
private readonly phClient;
|
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.4.
|
|
9
|
+
var version = "6.4.1";
|
|
10
10
|
|
|
11
11
|
// limit large outputs by truncating to 200kb (approx 200k bytes)
|
|
12
12
|
const MAX_OUTPUT_SIZE = 200000;
|
|
@@ -822,7 +822,7 @@ let WrappedCompletions$1 = class WrappedCompletions extends Completions {
|
|
|
822
822
|
await sendEventToPosthog({
|
|
823
823
|
client: this.phClient,
|
|
824
824
|
...posthogParams,
|
|
825
|
-
model: openAIParams.model,
|
|
825
|
+
model: String(openAIParams.model ?? ''),
|
|
826
826
|
provider: 'openai',
|
|
827
827
|
input: sanitizeOpenAI(openAIParams.messages),
|
|
828
828
|
output: [],
|
|
@@ -959,8 +959,7 @@ let WrappedResponses$1 = class WrappedResponses extends Responses {
|
|
|
959
959
|
await sendEventToPosthog({
|
|
960
960
|
client: this.phClient,
|
|
961
961
|
...posthogParams,
|
|
962
|
-
|
|
963
|
-
model: openAIParams.model,
|
|
962
|
+
model: String(openAIParams.model ?? ''),
|
|
964
963
|
provider: 'openai',
|
|
965
964
|
input: sanitizeOpenAIResponse(openAIParams.input),
|
|
966
965
|
output: [],
|
|
@@ -986,7 +985,6 @@ let WrappedResponses$1 = class WrappedResponses extends Responses {
|
|
|
986
985
|
posthogParams
|
|
987
986
|
} = extractPosthogParams(body);
|
|
988
987
|
const startTime = Date.now();
|
|
989
|
-
// Create a temporary instance that bypasses our wrapped create method
|
|
990
988
|
const originalCreate = super.create.bind(this);
|
|
991
989
|
const originalSelf = this;
|
|
992
990
|
const tempCreate = originalSelf.create;
|
|
@@ -998,8 +996,7 @@ let WrappedResponses$1 = class WrappedResponses extends Responses {
|
|
|
998
996
|
await sendEventToPosthog({
|
|
999
997
|
client: this.phClient,
|
|
1000
998
|
...posthogParams,
|
|
1001
|
-
|
|
1002
|
-
model: openAIParams.model,
|
|
999
|
+
model: String(openAIParams.model ?? ''),
|
|
1003
1000
|
provider: 'openai',
|
|
1004
1001
|
input: sanitizeOpenAIResponse(openAIParams.input),
|
|
1005
1002
|
output: result.output,
|
|
@@ -1020,8 +1017,7 @@ let WrappedResponses$1 = class WrappedResponses extends Responses {
|
|
|
1020
1017
|
await sendEventToPosthog({
|
|
1021
1018
|
client: this.phClient,
|
|
1022
1019
|
...posthogParams,
|
|
1023
|
-
|
|
1024
|
-
model: openAIParams.model,
|
|
1020
|
+
model: String(openAIParams.model ?? ''),
|
|
1025
1021
|
provider: 'openai',
|
|
1026
1022
|
input: sanitizeOpenAIResponse(openAIParams.input),
|
|
1027
1023
|
output: [],
|
|
@@ -1463,8 +1459,7 @@ class WrappedResponses extends AzureOpenAI.Responses {
|
|
|
1463
1459
|
await sendEventToPosthog({
|
|
1464
1460
|
client: this.phClient,
|
|
1465
1461
|
...posthogParams,
|
|
1466
|
-
|
|
1467
|
-
model: openAIParams.model,
|
|
1462
|
+
model: String(openAIParams.model ?? ''),
|
|
1468
1463
|
provider: 'azure',
|
|
1469
1464
|
input: openAIParams.input,
|
|
1470
1465
|
output: result.output,
|
|
@@ -1484,8 +1479,7 @@ class WrappedResponses extends AzureOpenAI.Responses {
|
|
|
1484
1479
|
await sendEventToPosthog({
|
|
1485
1480
|
client: this.phClient,
|
|
1486
1481
|
...posthogParams,
|
|
1487
|
-
|
|
1488
|
-
model: openAIParams.model,
|
|
1482
|
+
model: String(openAIParams.model ?? ''),
|
|
1489
1483
|
provider: 'azure',
|
|
1490
1484
|
input: openAIParams.input,
|
|
1491
1485
|
output: [],
|