@xache/langchain 0.4.0 → 0.5.0
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/index.d.mts +57 -15
- package/dist/index.d.ts +57 -15
- package/dist/index.js +26 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/chat_history.ts +12 -3
- package/src/collective.ts +12 -3
- package/src/extraction.ts +12 -3
- package/src/graph.ts +24 -4
- package/src/reputation.ts +12 -3
- package/src/retriever.ts +12 -3
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseMemory, InputValues, MemoryVariables, OutputValues } from '@langchain/core/memory';
|
|
2
2
|
import { BaseListChatMessageHistory } from '@langchain/core/chat_history';
|
|
3
3
|
import { BaseMessage } from '@langchain/core/messages';
|
|
4
|
+
import { XacheSigner, XacheWalletProvider, LLMProvider, LLMApiFormat, SubjectContext } from '@xache/sdk';
|
|
4
5
|
import { BaseRetriever, BaseRetrieverInput } from '@langchain/core/retrievers';
|
|
5
6
|
import { Document } from '@langchain/core/documents';
|
|
6
7
|
import { CallbackManagerForRetrieverRun } from '@langchain/core/callbacks/manager';
|
|
7
|
-
import { LLMProvider, LLMApiFormat, SubjectContext } from '@xache/sdk';
|
|
8
8
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,8 +15,14 @@ import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
|
15
15
|
interface XacheChatMessageHistoryConfig {
|
|
16
16
|
/** Wallet address for authentication */
|
|
17
17
|
walletAddress: string;
|
|
18
|
-
/** Private key for signing */
|
|
19
|
-
privateKey
|
|
18
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
19
|
+
privateKey?: string;
|
|
20
|
+
/** External signer (alternative to privateKey) */
|
|
21
|
+
signer?: XacheSigner;
|
|
22
|
+
/** Wallet provider for lazy signer resolution */
|
|
23
|
+
walletProvider?: XacheWalletProvider;
|
|
24
|
+
/** Encryption key for use with external signers */
|
|
25
|
+
encryptionKey?: string;
|
|
20
26
|
/** Session ID to group messages */
|
|
21
27
|
sessionId?: string;
|
|
22
28
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
@@ -166,8 +172,14 @@ declare class XacheConversationBufferMemory extends XacheMemory {
|
|
|
166
172
|
interface XacheRetrieverConfig extends BaseRetrieverInput {
|
|
167
173
|
/** Wallet address for authentication */
|
|
168
174
|
walletAddress: string;
|
|
169
|
-
/** Private key for signing */
|
|
170
|
-
privateKey
|
|
175
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
176
|
+
privateKey?: string;
|
|
177
|
+
/** External signer (alternative to privateKey) */
|
|
178
|
+
signer?: XacheSigner;
|
|
179
|
+
/** Wallet provider for lazy signer resolution */
|
|
180
|
+
walletProvider?: XacheWalletProvider;
|
|
181
|
+
/** Encryption key for use with external signers */
|
|
182
|
+
encryptionKey?: string;
|
|
171
183
|
/** Number of documents to retrieve */
|
|
172
184
|
k?: number;
|
|
173
185
|
/** Filter by context */
|
|
@@ -238,8 +250,14 @@ interface ExtractionResult {
|
|
|
238
250
|
interface XacheExtractorConfig {
|
|
239
251
|
/** Wallet address for authentication */
|
|
240
252
|
walletAddress: string;
|
|
241
|
-
/** Private key for signing */
|
|
242
|
-
privateKey
|
|
253
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
254
|
+
privateKey?: string;
|
|
255
|
+
/** External signer (alternative to privateKey) */
|
|
256
|
+
signer?: XacheSigner;
|
|
257
|
+
/** Wallet provider for lazy signer resolution */
|
|
258
|
+
walletProvider?: XacheWalletProvider;
|
|
259
|
+
/** Encryption key for use with external signers */
|
|
260
|
+
encryptionKey?: string;
|
|
243
261
|
/**
|
|
244
262
|
* Extraction mode:
|
|
245
263
|
* - 'xache-managed': Xache provides the LLM ($0.011)
|
|
@@ -336,8 +354,14 @@ declare class XacheExtractor {
|
|
|
336
354
|
interface CollectiveToolConfig {
|
|
337
355
|
/** Wallet address for authentication */
|
|
338
356
|
walletAddress: string;
|
|
339
|
-
/** Private key for signing */
|
|
340
|
-
privateKey
|
|
357
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
358
|
+
privateKey?: string;
|
|
359
|
+
/** External signer (alternative to privateKey) */
|
|
360
|
+
signer?: XacheSigner;
|
|
361
|
+
/** Wallet provider for lazy signer resolution */
|
|
362
|
+
walletProvider?: XacheWalletProvider;
|
|
363
|
+
/** Encryption key for use with external signers */
|
|
364
|
+
encryptionKey?: string;
|
|
341
365
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
342
366
|
apiUrl?: string;
|
|
343
367
|
/** Chain: 'base' or 'solana' */
|
|
@@ -400,8 +424,14 @@ declare class XacheCollectiveQueryTool {
|
|
|
400
424
|
interface ReputationToolConfig {
|
|
401
425
|
/** Wallet address for authentication */
|
|
402
426
|
walletAddress: string;
|
|
403
|
-
/** Private key for signing */
|
|
404
|
-
privateKey
|
|
427
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
428
|
+
privateKey?: string;
|
|
429
|
+
/** External signer (alternative to privateKey) */
|
|
430
|
+
signer?: XacheSigner;
|
|
431
|
+
/** Wallet provider for lazy signer resolution */
|
|
432
|
+
walletProvider?: XacheWalletProvider;
|
|
433
|
+
/** Encryption key for use with external signers */
|
|
434
|
+
encryptionKey?: string;
|
|
405
435
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
406
436
|
apiUrl?: string;
|
|
407
437
|
/** Chain: 'base' or 'solana' */
|
|
@@ -484,8 +514,14 @@ declare class XacheReputationChecker {
|
|
|
484
514
|
interface GraphToolConfig {
|
|
485
515
|
/** Wallet address for authentication */
|
|
486
516
|
walletAddress: string;
|
|
487
|
-
/** Private key for signing */
|
|
488
|
-
privateKey
|
|
517
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
518
|
+
privateKey?: string;
|
|
519
|
+
/** External signer (alternative to privateKey) */
|
|
520
|
+
signer?: XacheSigner;
|
|
521
|
+
/** Wallet provider for lazy signer resolution */
|
|
522
|
+
walletProvider?: XacheWalletProvider;
|
|
523
|
+
/** Encryption key for use with external signers */
|
|
524
|
+
encryptionKey?: string;
|
|
489
525
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
490
526
|
apiUrl?: string;
|
|
491
527
|
/** Chain: 'base' or 'solana' */
|
|
@@ -598,8 +634,14 @@ declare class XacheGraphEntityHistoryTool {
|
|
|
598
634
|
interface XacheGraphRetrieverConfig extends BaseRetrieverInput {
|
|
599
635
|
/** Wallet address for authentication */
|
|
600
636
|
walletAddress: string;
|
|
601
|
-
/** Private key for signing */
|
|
602
|
-
privateKey
|
|
637
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
638
|
+
privateKey?: string;
|
|
639
|
+
/** External signer (alternative to privateKey) */
|
|
640
|
+
signer?: XacheSigner;
|
|
641
|
+
/** Wallet provider for lazy signer resolution */
|
|
642
|
+
walletProvider?: XacheWalletProvider;
|
|
643
|
+
/** Encryption key for use with external signers */
|
|
644
|
+
encryptionKey?: string;
|
|
603
645
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
604
646
|
apiUrl?: string;
|
|
605
647
|
/** Chain: 'base' or 'solana' */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { BaseMemory, InputValues, MemoryVariables, OutputValues } from '@langchain/core/memory';
|
|
2
2
|
import { BaseListChatMessageHistory } from '@langchain/core/chat_history';
|
|
3
3
|
import { BaseMessage } from '@langchain/core/messages';
|
|
4
|
+
import { XacheSigner, XacheWalletProvider, LLMProvider, LLMApiFormat, SubjectContext } from '@xache/sdk';
|
|
4
5
|
import { BaseRetriever, BaseRetrieverInput } from '@langchain/core/retrievers';
|
|
5
6
|
import { Document } from '@langchain/core/documents';
|
|
6
7
|
import { CallbackManagerForRetrieverRun } from '@langchain/core/callbacks/manager';
|
|
7
|
-
import { LLMProvider, LLMApiFormat, SubjectContext } from '@xache/sdk';
|
|
8
8
|
import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -15,8 +15,14 @@ import { DynamicStructuredTool } from '@langchain/core/tools';
|
|
|
15
15
|
interface XacheChatMessageHistoryConfig {
|
|
16
16
|
/** Wallet address for authentication */
|
|
17
17
|
walletAddress: string;
|
|
18
|
-
/** Private key for signing */
|
|
19
|
-
privateKey
|
|
18
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
19
|
+
privateKey?: string;
|
|
20
|
+
/** External signer (alternative to privateKey) */
|
|
21
|
+
signer?: XacheSigner;
|
|
22
|
+
/** Wallet provider for lazy signer resolution */
|
|
23
|
+
walletProvider?: XacheWalletProvider;
|
|
24
|
+
/** Encryption key for use with external signers */
|
|
25
|
+
encryptionKey?: string;
|
|
20
26
|
/** Session ID to group messages */
|
|
21
27
|
sessionId?: string;
|
|
22
28
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
@@ -166,8 +172,14 @@ declare class XacheConversationBufferMemory extends XacheMemory {
|
|
|
166
172
|
interface XacheRetrieverConfig extends BaseRetrieverInput {
|
|
167
173
|
/** Wallet address for authentication */
|
|
168
174
|
walletAddress: string;
|
|
169
|
-
/** Private key for signing */
|
|
170
|
-
privateKey
|
|
175
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
176
|
+
privateKey?: string;
|
|
177
|
+
/** External signer (alternative to privateKey) */
|
|
178
|
+
signer?: XacheSigner;
|
|
179
|
+
/** Wallet provider for lazy signer resolution */
|
|
180
|
+
walletProvider?: XacheWalletProvider;
|
|
181
|
+
/** Encryption key for use with external signers */
|
|
182
|
+
encryptionKey?: string;
|
|
171
183
|
/** Number of documents to retrieve */
|
|
172
184
|
k?: number;
|
|
173
185
|
/** Filter by context */
|
|
@@ -238,8 +250,14 @@ interface ExtractionResult {
|
|
|
238
250
|
interface XacheExtractorConfig {
|
|
239
251
|
/** Wallet address for authentication */
|
|
240
252
|
walletAddress: string;
|
|
241
|
-
/** Private key for signing */
|
|
242
|
-
privateKey
|
|
253
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
254
|
+
privateKey?: string;
|
|
255
|
+
/** External signer (alternative to privateKey) */
|
|
256
|
+
signer?: XacheSigner;
|
|
257
|
+
/** Wallet provider for lazy signer resolution */
|
|
258
|
+
walletProvider?: XacheWalletProvider;
|
|
259
|
+
/** Encryption key for use with external signers */
|
|
260
|
+
encryptionKey?: string;
|
|
243
261
|
/**
|
|
244
262
|
* Extraction mode:
|
|
245
263
|
* - 'xache-managed': Xache provides the LLM ($0.011)
|
|
@@ -336,8 +354,14 @@ declare class XacheExtractor {
|
|
|
336
354
|
interface CollectiveToolConfig {
|
|
337
355
|
/** Wallet address for authentication */
|
|
338
356
|
walletAddress: string;
|
|
339
|
-
/** Private key for signing */
|
|
340
|
-
privateKey
|
|
357
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
358
|
+
privateKey?: string;
|
|
359
|
+
/** External signer (alternative to privateKey) */
|
|
360
|
+
signer?: XacheSigner;
|
|
361
|
+
/** Wallet provider for lazy signer resolution */
|
|
362
|
+
walletProvider?: XacheWalletProvider;
|
|
363
|
+
/** Encryption key for use with external signers */
|
|
364
|
+
encryptionKey?: string;
|
|
341
365
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
342
366
|
apiUrl?: string;
|
|
343
367
|
/** Chain: 'base' or 'solana' */
|
|
@@ -400,8 +424,14 @@ declare class XacheCollectiveQueryTool {
|
|
|
400
424
|
interface ReputationToolConfig {
|
|
401
425
|
/** Wallet address for authentication */
|
|
402
426
|
walletAddress: string;
|
|
403
|
-
/** Private key for signing */
|
|
404
|
-
privateKey
|
|
427
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
428
|
+
privateKey?: string;
|
|
429
|
+
/** External signer (alternative to privateKey) */
|
|
430
|
+
signer?: XacheSigner;
|
|
431
|
+
/** Wallet provider for lazy signer resolution */
|
|
432
|
+
walletProvider?: XacheWalletProvider;
|
|
433
|
+
/** Encryption key for use with external signers */
|
|
434
|
+
encryptionKey?: string;
|
|
405
435
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
406
436
|
apiUrl?: string;
|
|
407
437
|
/** Chain: 'base' or 'solana' */
|
|
@@ -484,8 +514,14 @@ declare class XacheReputationChecker {
|
|
|
484
514
|
interface GraphToolConfig {
|
|
485
515
|
/** Wallet address for authentication */
|
|
486
516
|
walletAddress: string;
|
|
487
|
-
/** Private key for signing */
|
|
488
|
-
privateKey
|
|
517
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
518
|
+
privateKey?: string;
|
|
519
|
+
/** External signer (alternative to privateKey) */
|
|
520
|
+
signer?: XacheSigner;
|
|
521
|
+
/** Wallet provider for lazy signer resolution */
|
|
522
|
+
walletProvider?: XacheWalletProvider;
|
|
523
|
+
/** Encryption key for use with external signers */
|
|
524
|
+
encryptionKey?: string;
|
|
489
525
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
490
526
|
apiUrl?: string;
|
|
491
527
|
/** Chain: 'base' or 'solana' */
|
|
@@ -598,8 +634,14 @@ declare class XacheGraphEntityHistoryTool {
|
|
|
598
634
|
interface XacheGraphRetrieverConfig extends BaseRetrieverInput {
|
|
599
635
|
/** Wallet address for authentication */
|
|
600
636
|
walletAddress: string;
|
|
601
|
-
/** Private key for signing */
|
|
602
|
-
privateKey
|
|
637
|
+
/** Private key for signing (optional if signer or walletProvider is provided) */
|
|
638
|
+
privateKey?: string;
|
|
639
|
+
/** External signer (alternative to privateKey) */
|
|
640
|
+
signer?: XacheSigner;
|
|
641
|
+
/** Wallet provider for lazy signer resolution */
|
|
642
|
+
walletProvider?: XacheWalletProvider;
|
|
643
|
+
/** Encryption key for use with external signers */
|
|
644
|
+
encryptionKey?: string;
|
|
603
645
|
/** API URL (defaults to https://api.xache.xyz) */
|
|
604
646
|
apiUrl?: string;
|
|
605
647
|
/** Chain: 'base' or 'solana' */
|
package/dist/index.js
CHANGED
|
@@ -70,6 +70,9 @@ var XacheChatMessageHistory = class extends import_chat_history.BaseListChatMess
|
|
|
70
70
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
71
71
|
did,
|
|
72
72
|
privateKey: config.privateKey,
|
|
73
|
+
signer: config.signer,
|
|
74
|
+
walletProvider: config.walletProvider,
|
|
75
|
+
encryptionKey: config.encryptionKey,
|
|
73
76
|
timeout: config.timeout,
|
|
74
77
|
debug: config.debug
|
|
75
78
|
});
|
|
@@ -264,7 +267,10 @@ var XacheRetriever = class extends import_retrievers.BaseRetriever {
|
|
|
264
267
|
this.client = new import_sdk2.XacheClient({
|
|
265
268
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
266
269
|
did,
|
|
267
|
-
privateKey: config.privateKey
|
|
270
|
+
privateKey: config.privateKey,
|
|
271
|
+
signer: config.signer,
|
|
272
|
+
walletProvider: config.walletProvider,
|
|
273
|
+
encryptionKey: config.encryptionKey
|
|
268
274
|
});
|
|
269
275
|
this.k = config.k ?? 5;
|
|
270
276
|
this.filterContext = config.context;
|
|
@@ -310,6 +316,9 @@ var XacheExtractor = class {
|
|
|
310
316
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
311
317
|
did,
|
|
312
318
|
privateKey: config.privateKey,
|
|
319
|
+
signer: config.signer,
|
|
320
|
+
walletProvider: config.walletProvider,
|
|
321
|
+
encryptionKey: config.encryptionKey,
|
|
313
322
|
timeout: config.timeout,
|
|
314
323
|
debug: config.debug
|
|
315
324
|
});
|
|
@@ -398,7 +407,10 @@ function createClient(config) {
|
|
|
398
407
|
return new import_sdk4.XacheClient({
|
|
399
408
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
400
409
|
did,
|
|
401
|
-
privateKey: config.privateKey
|
|
410
|
+
privateKey: config.privateKey,
|
|
411
|
+
signer: config.signer,
|
|
412
|
+
walletProvider: config.walletProvider,
|
|
413
|
+
encryptionKey: config.encryptionKey
|
|
402
414
|
});
|
|
403
415
|
}
|
|
404
416
|
function createCollectiveContributeTool(config) {
|
|
@@ -507,7 +519,10 @@ function createClient2(config) {
|
|
|
507
519
|
return new import_sdk5.XacheClient({
|
|
508
520
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
509
521
|
did,
|
|
510
|
-
privateKey: config.privateKey
|
|
522
|
+
privateKey: config.privateKey,
|
|
523
|
+
signer: config.signer,
|
|
524
|
+
walletProvider: config.walletProvider,
|
|
525
|
+
encryptionKey: config.encryptionKey
|
|
511
526
|
});
|
|
512
527
|
}
|
|
513
528
|
function createReputationTool(config) {
|
|
@@ -602,7 +617,10 @@ function createClient3(config) {
|
|
|
602
617
|
return new import_sdk6.XacheClient({
|
|
603
618
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
604
619
|
did,
|
|
605
|
-
privateKey: config.privateKey
|
|
620
|
+
privateKey: config.privateKey,
|
|
621
|
+
signer: config.signer,
|
|
622
|
+
walletProvider: config.walletProvider,
|
|
623
|
+
encryptionKey: config.encryptionKey
|
|
606
624
|
});
|
|
607
625
|
}
|
|
608
626
|
function getSubject(config) {
|
|
@@ -912,7 +930,10 @@ var XacheGraphRetriever = class extends import_retrievers2.BaseRetriever {
|
|
|
912
930
|
this.client = new import_sdk6.XacheClient({
|
|
913
931
|
apiUrl: config.apiUrl || "https://api.xache.xyz",
|
|
914
932
|
did,
|
|
915
|
-
privateKey: config.privateKey
|
|
933
|
+
privateKey: config.privateKey,
|
|
934
|
+
signer: config.signer,
|
|
935
|
+
walletProvider: config.walletProvider,
|
|
936
|
+
encryptionKey: config.encryptionKey
|
|
916
937
|
});
|
|
917
938
|
this.subject = config.subject || { scope: "GLOBAL" };
|
|
918
939
|
this.startEntity = config.startEntity;
|