@posthog/ai 7.8.11 → 7.8.12
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.mjs +1 -1
- package/dist/gemini/index.cjs +1 -1
- package/dist/gemini/index.mjs +1 -1
- package/dist/index.cjs +10 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.mjs +10 -2
- package/dist/index.mjs.map +1 -1
- package/dist/langchain/index.cjs +1 -1
- package/dist/langchain/index.mjs +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 +6 -4
package/dist/anthropic/index.cjs
CHANGED
|
@@ -10,7 +10,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
|
10
10
|
|
|
11
11
|
var AnthropicOriginal__default = /*#__PURE__*/_interopDefault(AnthropicOriginal);
|
|
12
12
|
|
|
13
|
-
var version = "7.8.
|
|
13
|
+
var version = "7.8.12";
|
|
14
14
|
|
|
15
15
|
// Type guards for safer type checking
|
|
16
16
|
|
package/dist/anthropic/index.mjs
CHANGED
package/dist/gemini/index.cjs
CHANGED
package/dist/gemini/index.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -29,7 +29,7 @@ function _interopNamespace(e) {
|
|
|
29
29
|
var uuid__namespace = /*#__PURE__*/_interopNamespace(uuid);
|
|
30
30
|
var AnthropicOriginal__default = /*#__PURE__*/_interopDefault(AnthropicOriginal);
|
|
31
31
|
|
|
32
|
-
var version = "7.8.
|
|
32
|
+
var version = "7.8.12";
|
|
33
33
|
|
|
34
34
|
// Type guards for safer type checking
|
|
35
35
|
const isString = value => {
|
|
@@ -4399,6 +4399,7 @@ function isPromptsWithPostHog(options) {
|
|
|
4399
4399
|
* // Or with direct options (no PostHog client needed)
|
|
4400
4400
|
* const prompts = new Prompts({
|
|
4401
4401
|
* personalApiKey: 'phx_xxx',
|
|
4402
|
+
* projectApiKey: 'phc_xxx',
|
|
4402
4403
|
* host: 'https://us.posthog.com',
|
|
4403
4404
|
* })
|
|
4404
4405
|
*
|
|
@@ -4421,10 +4422,12 @@ class Prompts {
|
|
|
4421
4422
|
this.defaultCacheTtlSeconds = options.defaultCacheTtlSeconds ?? DEFAULT_CACHE_TTL_SECONDS;
|
|
4422
4423
|
if (isPromptsWithPostHog(options)) {
|
|
4423
4424
|
this.personalApiKey = options.posthog.options.personalApiKey ?? '';
|
|
4425
|
+
this.projectApiKey = options.posthog.apiKey ?? '';
|
|
4424
4426
|
this.host = options.posthog.host;
|
|
4425
4427
|
} else {
|
|
4426
4428
|
// Direct options
|
|
4427
4429
|
this.personalApiKey = options.personalApiKey;
|
|
4430
|
+
this.projectApiKey = options.projectApiKey;
|
|
4428
4431
|
this.host = options.host ?? 'https://us.posthog.com';
|
|
4429
4432
|
}
|
|
4430
4433
|
}
|
|
@@ -4508,7 +4511,12 @@ class Prompts {
|
|
|
4508
4511
|
if (!this.personalApiKey) {
|
|
4509
4512
|
throw new Error('[PostHog Prompts] personalApiKey is required to fetch prompts. ' + 'Please provide it when initializing the Prompts instance.');
|
|
4510
4513
|
}
|
|
4511
|
-
|
|
4514
|
+
if (!this.projectApiKey) {
|
|
4515
|
+
throw new Error('[PostHog Prompts] projectApiKey is required to fetch prompts. ' + 'Please provide it when initializing the Prompts instance.');
|
|
4516
|
+
}
|
|
4517
|
+
const encodedPromptName = encodeURIComponent(name);
|
|
4518
|
+
const encodedProjectApiKey = encodeURIComponent(this.projectApiKey);
|
|
4519
|
+
const url = `${this.host}/api/environments/@current/llm_prompts/name/${encodedPromptName}/?token=${encodedProjectApiKey}`;
|
|
4512
4520
|
const response = await fetch(url, {
|
|
4513
4521
|
method: 'GET',
|
|
4514
4522
|
headers: {
|