@posthog/ai 8.22.5 → 8.23.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/README.md +10 -1
- package/dist/adk/index.cjs +1 -1
- package/dist/adk/index.mjs +1 -1
- package/dist/anthropic/index.cjs +1 -1
- package/dist/anthropic/index.mjs +1 -1
- package/dist/claude-agent-sdk/index.cjs +1 -1
- package/dist/claude-agent-sdk/index.mjs +1 -1
- package/dist/evaluations/index.cjs +87 -24
- package/dist/evaluations/index.cjs.map +1 -1
- package/dist/evaluations/index.d.ts +39 -7
- package/dist/evaluations/index.mjs +87 -24
- package/dist/evaluations/index.mjs.map +1 -1
- package/dist/gemini/index.cjs +1 -1
- package/dist/gemini/index.mjs +1 -1
- package/dist/genkit/index.cjs +1 -1
- package/dist/genkit/index.mjs +1 -1
- package/dist/index.cjs +3 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/langchain/index.cjs +1 -1
- package/dist/langchain/index.mjs +1 -1
- package/dist/langchain/middleware/index.cjs +1 -1
- package/dist/langchain/middleware/index.mjs +1 -1
- package/dist/openai/index.cjs +1 -1
- package/dist/openai/index.mjs +1 -1
- package/dist/openai-agents/index.cjs +1 -1
- package/dist/openai-agents/index.mjs +1 -1
- package/dist/vercel/index.cjs +1 -1
- package/dist/vercel/index.mjs +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,7 @@ type PromptVariables = Record<string, string | number | boolean>;
|
|
|
80
80
|
* Direct options for initializing Prompts without a PostHog client
|
|
81
81
|
*/
|
|
82
82
|
interface PromptsDirectOptions {
|
|
83
|
+
/** A personal API key (`phx_`) or a project secret API key (`phs_`) with the `llm_prompt:read` scope. */
|
|
83
84
|
personalApiKey: string;
|
|
84
85
|
projectApiKey: string;
|
|
85
86
|
host?: string;
|
package/dist/index.mjs
CHANGED
|
@@ -603,7 +603,7 @@ function sanitizeValues(obj) {
|
|
|
603
603
|
}
|
|
604
604
|
//#endregion
|
|
605
605
|
//#region package.json
|
|
606
|
-
var version = "8.
|
|
606
|
+
var version = "8.23.1";
|
|
607
607
|
//#endregion
|
|
608
608
|
//#region src/serializeError.ts
|
|
609
609
|
const DEFAULT_MAX_DEPTH = 3;
|
|
@@ -1835,7 +1835,7 @@ var Prompts = class {
|
|
|
1835
1835
|
if (pages >= MAX_PROMPT_LIST_PAGES) throw new Error(`[PostHog Prompts] ${reference} spans more than ${MAX_PROMPT_LIST_PAGES} pages. Refusing to return an incomplete result.`);
|
|
1836
1836
|
const { response, data } = await fetchJsonWithTimeout(url, this.personalApiKey, reference);
|
|
1837
1837
|
if (!response.ok) {
|
|
1838
|
-
if (response.status === 403) throw new Error(`[PostHog Prompts] Access denied for ${reference}. Check that
|
|
1838
|
+
if (response.status === 403) throw new Error(`[PostHog Prompts] Access denied for ${reference}. Check that the key in personalApiKey has the llm_prompt:read scope and the LLM prompts feature is enabled.`);
|
|
1839
1839
|
throw new PromptFetchError(`[PostHog Prompts] Failed to fetch ${reference}: HTTP ${response.status}`, response.status === 429 ? parseRetryAfterSeconds(response.headers?.get("Retry-After")) : void 0);
|
|
1840
1840
|
}
|
|
1841
1841
|
if (typeof data !== "object" || data === null || !Array.isArray(data.results)) throw new Error(`[PostHog Prompts] Invalid response format for ${reference}`);
|
|
@@ -1857,7 +1857,7 @@ var Prompts = class {
|
|
|
1857
1857
|
const { response, data } = await fetchJsonWithTimeout(`${this.host}/api/environments/@current/llm_prompts/name/${encodedPromptName}/?token=${encodedProjectApiKey}${versionQuery}${labelQuery}`, this.personalApiKey, `prompt ${promptReference}`);
|
|
1858
1858
|
if (!response.ok) {
|
|
1859
1859
|
if (response.status === 404) throw new Error(`[PostHog Prompts] Prompt ${promptReference} not found`);
|
|
1860
|
-
if (response.status === 403) throw new Error(`[PostHog Prompts] Access denied for prompt ${promptReference}. Check that
|
|
1860
|
+
if (response.status === 403) throw new Error(`[PostHog Prompts] Access denied for prompt ${promptReference}. Check that the key in personalApiKey has the llm_prompt:read scope and the LLM prompts feature is enabled.`);
|
|
1861
1861
|
throw new PromptFetchError(`[PostHog Prompts] Failed to fetch prompt ${promptReference}: HTTP ${response.status}`, response.status === 429 ? parseRetryAfterSeconds(response.headers?.get("Retry-After")) : void 0);
|
|
1862
1862
|
}
|
|
1863
1863
|
if (!isPromptApiResponse(data)) throw new Error(`[PostHog Prompts] Invalid response format for prompt ${promptReference}`);
|