@threadplane/langgraph 0.0.51 → 0.0.52
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.
|
@@ -1860,6 +1860,19 @@ function findLatestDescendantId(parentId, childrenMap) {
|
|
|
1860
1860
|
return latestId;
|
|
1861
1861
|
}
|
|
1862
1862
|
|
|
1863
|
+
/**
|
|
1864
|
+
* Normalize {@link Citation}s out of a message's `additional_kwargs` (reading
|
|
1865
|
+
* `citations` or `sources`). Exposed for advanced consumers building custom
|
|
1866
|
+
* adapters or bridging non-LangGraph message shapes into the neutral
|
|
1867
|
+
* `Citation[]` form.
|
|
1868
|
+
*
|
|
1869
|
+
* @param msg Any object with an `additional_kwargs` bag (e.g. a LangChain message).
|
|
1870
|
+
* @returns The normalized citations, or `undefined` when none are present.
|
|
1871
|
+
* @example
|
|
1872
|
+
* ```ts
|
|
1873
|
+
* const citations = extractCitations(lcMessage);
|
|
1874
|
+
* ```
|
|
1875
|
+
*/
|
|
1863
1876
|
function extractCitations(msg) {
|
|
1864
1877
|
const raw = msg.additional_kwargs?.['citations'] ?? msg.additional_kwargs?.['sources'];
|
|
1865
1878
|
if (!Array.isArray(raw) || raw.length === 0)
|