@meetsmore-oss/use-ai-core 1.2.2 → 1.2.4
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/citations.d.ts +11 -54
- package/dist/citations.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/citations.d.ts
CHANGED
|
@@ -4,60 +4,8 @@
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const CITATION_EVENT_NAME = "citation";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Format: START + "cite" + SEP + number + END
|
|
11
|
-
* Example: '\ue200cite\ue2021\ue201' for citation 1
|
|
12
|
-
*
|
|
13
|
-
* This format follows the ChatGPT citation style where:
|
|
14
|
-
* - \ue200 marks the start of a citation reference
|
|
15
|
-
* - \ue201 marks the end of a citation reference
|
|
16
|
-
* - \ue202 separates the type from the reference identifier
|
|
17
|
-
* - "cite" and the number are visible text the AI can output
|
|
18
|
-
*/
|
|
19
|
-
export declare const CITATION_MARKER_START = "\uE200";
|
|
20
|
-
export declare const CITATION_MARKER_END = "\uE201";
|
|
21
|
-
export declare const CITATION_MARKER_SEP = "\uE202";
|
|
22
|
-
/**
|
|
23
|
-
* Pattern to match legacy [n] citation markers in text.
|
|
24
|
-
* Used for backwards compatibility.
|
|
25
|
-
*/
|
|
26
|
-
export declare const LEGACY_CITATION_PATTERN: RegExp;
|
|
27
|
-
/**
|
|
28
|
-
* Pattern to match citation markers in text.
|
|
29
|
-
* Uses Markdown footnote syntax [^n] which Claude outputs naturally and rarely appears in code.
|
|
30
|
-
* Examples: [^1], [^2], [^1,2]
|
|
31
|
-
*/
|
|
32
|
-
export declare const CITATION_PATTERN: RegExp;
|
|
33
|
-
/**
|
|
34
|
-
* Creates a citation marker for a given number.
|
|
35
|
-
* @param num The citation number (1, 2, 3, etc.)
|
|
36
|
-
* @returns The marker string (e.g., '[^1]')
|
|
37
|
-
*/
|
|
38
|
-
export declare function createCitationMarker(num: number): string;
|
|
39
|
-
/**
|
|
40
|
-
* Transforms legacy [n] citation markers to footnote format.
|
|
41
|
-
* @param text Text containing [1], [2], etc. markers
|
|
42
|
-
* @returns Text with footnote markers ([^1], [^2], etc.)
|
|
43
|
-
*/
|
|
44
|
-
export declare function transformLegacyCitations(text: string): string;
|
|
45
|
-
/**
|
|
46
|
-
* System prompt instruction for AI models to use citation markers.
|
|
47
|
-
* Uses Markdown footnote syntax [^n] which Claude outputs naturally.
|
|
48
|
-
*
|
|
49
|
-
* @example
|
|
50
|
-
* ```typescript
|
|
51
|
-
* new AISDKAgent({
|
|
52
|
-
* model: anthropic('claude-sonnet-4-20250514'),
|
|
53
|
-
* providerTools: { web_search: webSearch },
|
|
54
|
-
* // Citation instruction is auto-appended when citations: true (default)
|
|
55
|
-
* });
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare const CITATION_SYSTEM_INSTRUCTION = "**CITATION FORMAT (REQUIRED)**\nWhen referencing information from sources, cite using Markdown footnote markers.\n\nFormat: [^N] where N is the source number (1-indexed position in results).\nMultiple sources: [^1,2]\n\nEXAMPLES:\n- \"TypeScript 5.7 was released in November 2024[^1].\"\n- \"React 19 introduced new features[^2] and performance improvements[^1,3].\"\n\nRULES:\n1. Place [^N] IMMEDIATELY after the cited claim.\n2. Every fact from sources MUST have a citation marker.";
|
|
59
|
-
/**
|
|
60
|
-
* A citation reference that can be displayed inline as [n] linking to a source.
|
|
7
|
+
* A citation reference from an AI SDK source chunk.
|
|
8
|
+
* Citations are collected from structured AI SDK source data, not parsed from text.
|
|
61
9
|
*/
|
|
62
10
|
export interface Citation {
|
|
63
11
|
/** Unique identifier for this citation */
|
|
@@ -78,6 +26,15 @@ export interface Citation {
|
|
|
78
26
|
toolName?: string;
|
|
79
27
|
/** Provider-specific metadata */
|
|
80
28
|
metadata?: Record<string, unknown>;
|
|
29
|
+
/**
|
|
30
|
+
* Where this citation should be rendered.
|
|
31
|
+
* - 'inline': Replace an embedded link in the text (OpenAI includes these)
|
|
32
|
+
* - 'trailing': Show at the end of the message (default for most providers)
|
|
33
|
+
*
|
|
34
|
+
* Server normalizes provider-specific behavior into this field.
|
|
35
|
+
* Client renders based on this without knowing about providers.
|
|
36
|
+
*/
|
|
37
|
+
placement?: 'inline' | 'trailing';
|
|
81
38
|
}
|
|
82
39
|
/**
|
|
83
40
|
* Event payload for citation custom events.
|
package/dist/citations.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"citations.d.ts","sourceRoot":"","sources":["../src/citations.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C
|
|
1
|
+
{"version":3,"file":"citations.d.ts","sourceRoot":"","sources":["../src/citations.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,mDAAmD;IACnD,MAAM,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,IAAI,EAAE,KAAK,GAAG,UAAU,GAAG,aAAa,CAAC;IACzC,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sCAAsC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,4CAA4C;IAC5C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;CACnC;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,0CAA0C;IAC1C,SAAS,EAAE,QAAQ,EAAE,CAAC;CACvB"}
|