@yushaw/sanqian-sdk 0.3.8 → 0.3.9
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 +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -468,6 +468,17 @@ interface EmbeddingConfigResult {
|
|
|
468
468
|
/** Embedding dimensions */
|
|
469
469
|
dimensions?: number;
|
|
470
470
|
}
|
|
471
|
+
/** Rerank configuration returned from Sanqian */
|
|
472
|
+
interface RerankConfigResult {
|
|
473
|
+
/** Whether rerank is configured in Sanqian */
|
|
474
|
+
available: boolean;
|
|
475
|
+
/** API URL for rerank service */
|
|
476
|
+
apiUrl?: string;
|
|
477
|
+
/** API key (decrypted) */
|
|
478
|
+
apiKey?: string;
|
|
479
|
+
/** Model name */
|
|
480
|
+
modelName?: string;
|
|
481
|
+
}
|
|
471
482
|
/** Capability type */
|
|
472
483
|
type CapabilityType = "tool" | "skill" | "agent" | "context";
|
|
473
484
|
/** Tool capability info */
|
|
@@ -533,6 +544,16 @@ interface AgentCapability {
|
|
|
533
544
|
sourceId?: string;
|
|
534
545
|
/** Agent icon/emoji */
|
|
535
546
|
icon?: string;
|
|
547
|
+
/** Display name (localized) */
|
|
548
|
+
display?: {
|
|
549
|
+
zh?: string;
|
|
550
|
+
en?: string;
|
|
551
|
+
};
|
|
552
|
+
/** Short description (localized) */
|
|
553
|
+
shortDesc?: {
|
|
554
|
+
zh?: string;
|
|
555
|
+
en?: string;
|
|
556
|
+
};
|
|
536
557
|
}
|
|
537
558
|
/** Context capability info */
|
|
538
559
|
interface ContextCapability {
|
|
@@ -975,6 +996,23 @@ declare class SanqianSDK {
|
|
|
975
996
|
* @returns Embedding configuration or { available: false } if not configured
|
|
976
997
|
*/
|
|
977
998
|
getEmbeddingConfig(): Promise<EmbeddingConfigResult>;
|
|
999
|
+
/**
|
|
1000
|
+
* Get rerank configuration from Sanqian
|
|
1001
|
+
*
|
|
1002
|
+
* Returns the current rerank model configuration including API URL, key, and model name.
|
|
1003
|
+
* This allows external apps to use the same rerank service configured in Sanqian.
|
|
1004
|
+
*
|
|
1005
|
+
* @example
|
|
1006
|
+
* ```typescript
|
|
1007
|
+
* const config = await sdk.getRerankConfig()
|
|
1008
|
+
* if (config.available) {
|
|
1009
|
+
* // Use config.apiUrl, config.apiKey, config.modelName
|
|
1010
|
+
* }
|
|
1011
|
+
* ```
|
|
1012
|
+
*
|
|
1013
|
+
* @returns Rerank configuration or { available: false } if not configured
|
|
1014
|
+
*/
|
|
1015
|
+
getRerankConfig(): Promise<RerankConfigResult>;
|
|
978
1016
|
/**
|
|
979
1017
|
* Push a session resource to Sanqian
|
|
980
1018
|
*
|
|
@@ -1329,4 +1367,4 @@ declare class SanqianSDKError extends Error {
|
|
|
1329
1367
|
*/
|
|
1330
1368
|
declare function createSDKError(code: SDKErrorCode, details?: string): SanqianSDKError;
|
|
1331
1369
|
|
|
1332
|
-
export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextCapability, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationHistoryResult, type ConversationInfo, type ConversationMessage, DiscoveryManager, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type RemoteToolDefinition, type ResourceListOptions, type ResourceListResult, type ResourceType, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, type SDKExtendedMethods, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, createSDKError };
|
|
1370
|
+
export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextCapability, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationHistoryResult, type ConversationInfo, type ConversationMessage, DiscoveryManager, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type RemoteToolDefinition, type RerankConfigResult, type ResourceListOptions, type ResourceListResult, type ResourceType, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, type SDKExtendedMethods, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, createSDKError };
|
package/dist/index.d.ts
CHANGED
|
@@ -468,6 +468,17 @@ interface EmbeddingConfigResult {
|
|
|
468
468
|
/** Embedding dimensions */
|
|
469
469
|
dimensions?: number;
|
|
470
470
|
}
|
|
471
|
+
/** Rerank configuration returned from Sanqian */
|
|
472
|
+
interface RerankConfigResult {
|
|
473
|
+
/** Whether rerank is configured in Sanqian */
|
|
474
|
+
available: boolean;
|
|
475
|
+
/** API URL for rerank service */
|
|
476
|
+
apiUrl?: string;
|
|
477
|
+
/** API key (decrypted) */
|
|
478
|
+
apiKey?: string;
|
|
479
|
+
/** Model name */
|
|
480
|
+
modelName?: string;
|
|
481
|
+
}
|
|
471
482
|
/** Capability type */
|
|
472
483
|
type CapabilityType = "tool" | "skill" | "agent" | "context";
|
|
473
484
|
/** Tool capability info */
|
|
@@ -533,6 +544,16 @@ interface AgentCapability {
|
|
|
533
544
|
sourceId?: string;
|
|
534
545
|
/** Agent icon/emoji */
|
|
535
546
|
icon?: string;
|
|
547
|
+
/** Display name (localized) */
|
|
548
|
+
display?: {
|
|
549
|
+
zh?: string;
|
|
550
|
+
en?: string;
|
|
551
|
+
};
|
|
552
|
+
/** Short description (localized) */
|
|
553
|
+
shortDesc?: {
|
|
554
|
+
zh?: string;
|
|
555
|
+
en?: string;
|
|
556
|
+
};
|
|
536
557
|
}
|
|
537
558
|
/** Context capability info */
|
|
538
559
|
interface ContextCapability {
|
|
@@ -975,6 +996,23 @@ declare class SanqianSDK {
|
|
|
975
996
|
* @returns Embedding configuration or { available: false } if not configured
|
|
976
997
|
*/
|
|
977
998
|
getEmbeddingConfig(): Promise<EmbeddingConfigResult>;
|
|
999
|
+
/**
|
|
1000
|
+
* Get rerank configuration from Sanqian
|
|
1001
|
+
*
|
|
1002
|
+
* Returns the current rerank model configuration including API URL, key, and model name.
|
|
1003
|
+
* This allows external apps to use the same rerank service configured in Sanqian.
|
|
1004
|
+
*
|
|
1005
|
+
* @example
|
|
1006
|
+
* ```typescript
|
|
1007
|
+
* const config = await sdk.getRerankConfig()
|
|
1008
|
+
* if (config.available) {
|
|
1009
|
+
* // Use config.apiUrl, config.apiKey, config.modelName
|
|
1010
|
+
* }
|
|
1011
|
+
* ```
|
|
1012
|
+
*
|
|
1013
|
+
* @returns Rerank configuration or { available: false } if not configured
|
|
1014
|
+
*/
|
|
1015
|
+
getRerankConfig(): Promise<RerankConfigResult>;
|
|
978
1016
|
/**
|
|
979
1017
|
* Push a session resource to Sanqian
|
|
980
1018
|
*
|
|
@@ -1329,4 +1367,4 @@ declare class SanqianSDKError extends Error {
|
|
|
1329
1367
|
*/
|
|
1330
1368
|
declare function createSDKError(code: SDKErrorCode, details?: string): SanqianSDKError;
|
|
1331
1369
|
|
|
1332
|
-
export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextCapability, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationHistoryResult, type ConversationInfo, type ConversationMessage, DiscoveryManager, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type RemoteToolDefinition, type ResourceListOptions, type ResourceListResult, type ResourceType, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, type SDKExtendedMethods, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, createSDKError };
|
|
1370
|
+
export { type AgentCapability, type AgentConfig, type AgentInfo, type AgentUpdateConfig, type Capability, type CapabilitySearchResult, type CapabilityType, type ChatMessage, type ChatRequest, type ChatResponse, type ChatStreamEvent, type ConnectionInfo, type ConnectionState, type ContextCapability, type ContextData, type ContextListItem, type ContextProvider, Conversation, type ConversationDetail, type ConversationHistoryResult, type ConversationInfo, type ConversationMessage, DiscoveryManager, type EmbeddingConfigResult, ErrorMessages, type HitlInterruptPayload, type HitlInterruptType, type HitlResponse, type HitlRiskLevel, type JSONSchema, type JSONSchemaProperty, type ListCapabilitiesOptions, type RemoteToolDefinition, type RerankConfigResult, type ResourceListOptions, type ResourceListResult, type ResourceType, SANQIAN_WEBSITE, type SDKConfig, SDKErrorCode, type SDKEventName, type SDKEvents, type SDKExtendedMethods, SanqianSDK, SanqianSDKError, type SearchCapabilitiesOptions, type SessionResource, type SkillCapability, type StoredSessionResource, type ToolCall, type ToolCapability, type ToolDefinition, createSDKError };
|
package/dist/index.js
CHANGED
|
@@ -1770,6 +1770,39 @@ var SanqianSDK = class _SanqianSDK {
|
|
|
1770
1770
|
return response.config || { available: false };
|
|
1771
1771
|
}
|
|
1772
1772
|
// ============================================
|
|
1773
|
+
// Rerank Config API
|
|
1774
|
+
// ============================================
|
|
1775
|
+
/**
|
|
1776
|
+
* Get rerank configuration from Sanqian
|
|
1777
|
+
*
|
|
1778
|
+
* Returns the current rerank model configuration including API URL, key, and model name.
|
|
1779
|
+
* This allows external apps to use the same rerank service configured in Sanqian.
|
|
1780
|
+
*
|
|
1781
|
+
* @example
|
|
1782
|
+
* ```typescript
|
|
1783
|
+
* const config = await sdk.getRerankConfig()
|
|
1784
|
+
* if (config.available) {
|
|
1785
|
+
* // Use config.apiUrl, config.apiKey, config.modelName
|
|
1786
|
+
* }
|
|
1787
|
+
* ```
|
|
1788
|
+
*
|
|
1789
|
+
* @returns Rerank configuration or { available: false } if not configured
|
|
1790
|
+
*/
|
|
1791
|
+
async getRerankConfig() {
|
|
1792
|
+
await this.ensureReady();
|
|
1793
|
+
const msgId = this.generateId();
|
|
1794
|
+
const message = {
|
|
1795
|
+
id: msgId,
|
|
1796
|
+
type: "get_rerank_config"
|
|
1797
|
+
};
|
|
1798
|
+
const response = await this.sendAndWait(message, msgId, 1e4);
|
|
1799
|
+
if (!response.success) {
|
|
1800
|
+
this.log(`getRerankConfig failed: ${response.error}`);
|
|
1801
|
+
return { available: false };
|
|
1802
|
+
}
|
|
1803
|
+
return response.config || { available: false };
|
|
1804
|
+
}
|
|
1805
|
+
// ============================================
|
|
1773
1806
|
// Session Resources API
|
|
1774
1807
|
// ============================================
|
|
1775
1808
|
/**
|