@threadplane/langgraph 0.0.51 → 0.0.53
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)
|
|
@@ -2881,6 +2894,12 @@ class MockAgentTransport {
|
|
|
2881
2894
|
*
|
|
2882
2895
|
* Neutral `Agent`-contract signals come from {@link mockAgent}; LangGraph-specific
|
|
2883
2896
|
* signals are declared here and layered on top.
|
|
2897
|
+
*
|
|
2898
|
+
* @example
|
|
2899
|
+
* ```ts
|
|
2900
|
+
* const agent = mockLangGraphAgent({ isThreadLoading: true });
|
|
2901
|
+
* agent.messages.set([{ id: '1', role: 'assistant', content: 'Hi' }]);
|
|
2902
|
+
* ```
|
|
2884
2903
|
*/
|
|
2885
2904
|
function mockLangGraphAgent(initial = {}) {
|
|
2886
2905
|
const base = mockAgent({
|
|
@@ -3054,6 +3073,13 @@ function delay(ms) {
|
|
|
3054
3073
|
* advanced manual scripting (tool calls, interrupts, multi-batch), provide
|
|
3055
3074
|
* the agent yourself with
|
|
3056
3075
|
* `provideAgent({ assistantId, transport: new MockAgentTransport(...) })`.
|
|
3076
|
+
*
|
|
3077
|
+
* @example
|
|
3078
|
+
* ```ts
|
|
3079
|
+
* TestBed.configureTestingModule({
|
|
3080
|
+
* providers: [provideFakeAgent({ responses: ['Hi from the fake LangGraph agent'] })],
|
|
3081
|
+
* });
|
|
3082
|
+
* ```
|
|
3057
3083
|
*/
|
|
3058
3084
|
function provideFakeAgent(config = {}) {
|
|
3059
3085
|
return provideAgent({
|