@codesoul-co/hypha-inference / types
- 包索引:
@codesoul-co/hypha-inference - 源码:
packages/inference/src/types.ts - 导出数: 41
模块用法
用于声明并运行时校验契约。Types 模块公开 34 接口、7 类型。
从包入口导入
import type {
CompiledPrompt,
InferenceBackend,
InferenceBackendCapabilities,
InferenceBackendRegistryEntry,
InferenceBackendRequest,
InferenceBackendResponse,
InferenceCacheIssue,
InferenceCachePolicy,
} from '@codesoul-co/hypha-inference';
// 完整导出列表见下方。使用要点
- 41 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用
import type,运行时不应依赖它们。
公共导出
| Symbol | 种类 | 签名 | 说明 |
|---|---|---|---|
CompiledPrompt | 接口 | interface CompiledPrompt | Compiled Prompt 接口,共包含 4 个公开字段或方法。 |
InferenceBackend | 接口 | interface InferenceBackend | Inference Backend 接口,共包含 5 个公开字段或方法。 |
InferenceBackendCapabilities | 接口 | interface InferenceBackendCapabilities | Inference Backend Capabilities 接口,共包含 6 个公开字段或方法。 |
InferenceBackendRegistryEntry | 接口 | interface InferenceBackendRegistryEntry | Inference Backend Registry Entry 接口,共包含 3 个公开字段或方法。 |
InferenceBackendRequest | 接口 | interface InferenceBackendRequest | Inference Backend Request 接口,共包含 14 个公开字段或方法。 |
InferenceBackendResponse | 接口 | interface InferenceBackendResponse | Inference Backend Response 接口,共包含 6 个公开字段或方法。 |
InferenceCacheIssue | 接口 | interface InferenceCacheIssue | Inference Cache Issue 接口,共包含 4 个公开字段或方法。 |
InferenceCachePolicy | 接口 | interface InferenceCachePolicy | Inference Cache Policy 接口,共包含 3 个公开字段或方法。 |
InferenceCacheScope | 接口 | interface InferenceCacheScope | Inference Cache Scope 接口,共包含 3 个公开字段或方法。 |
InferenceCacheUsage | 接口 | interface InferenceCacheUsage | Inference Cache Usage 接口,共包含 11 个公开字段或方法。 |
InferenceGenerationOptions | 接口 | interface InferenceGenerationOptions | Inference Generation Options 接口,共包含 9 个公开字段或方法。 |
InferenceManagerOptions | 接口 | interface InferenceManagerOptions | Inference Manager Options 接口,共包含 8 个公开字段或方法。 |
InferenceProvider | 接口 | interface InferenceProvider | Inference Provider 接口,共包含 3 个公开字段或方法。 |
InferenceRequest | 接口 | interface InferenceRequest | Inference Request 接口,共包含 18 个公开字段或方法。 |
InferenceResponse | 接口 | interface InferenceResponse | Inference Response 接口,共包含 7 个公开字段或方法。 |
InferenceToolDescriptor | 接口 | interface InferenceToolDescriptor | Inference Tool Descriptor 接口,共包含 4 个公开字段或方法。 |
InferenceUsage | 接口 | interface InferenceUsage | Inference Usage 接口,共包含 3 个公开字段或方法。 |
KvCacheProvider | 接口 | interface KvCacheProvider | Kv Cache Provider 接口,共包含 3 个公开字段或方法。 |
KvCacheRef | 接口 | interface KvCacheRef | Kv Cache Ref 接口,共包含 7 个公开字段或方法。 |
KvCacheWritePolicy | 接口 | interface KvCacheWritePolicy | Kv Cache Write Policy 接口,共包含 3 个公开字段或方法。 |
PlasmodCacheMetadata | 接口 | interface PlasmodCacheMetadata | Plasmod Cache Metadata 接口,共包含 10 个公开字段或方法。 |
PlasmodHotLayer | 接口 | interface PlasmodHotLayer | Plasmod Hot Layer 接口,共包含 4 个公开字段或方法。 |
PlasmodHotLayerPrepareInput | 接口 | interface PlasmodHotLayerPrepareInput | Plasmod Hot Layer Prepare Input 接口,共包含 12 个公开字段或方法。 |
PlasmodHotLayerPrepareResult | 接口 | interface PlasmodHotLayerPrepareResult | Plasmod Hot Layer Prepare Result 接口,共包含 6 个公开字段或方法。 |
PlasmodReusePolicy | 接口 | interface PlasmodReusePolicy | Plasmod Reuse Policy 接口,共包含 5 个公开字段或方法。 |
PlasmodSessionState | 接口 | interface PlasmodSessionState | Plasmod Session State 接口,共包含 10 个公开字段或方法。 |
PrefixCacheProvider | 接口 | interface PrefixCacheProvider | Prefix Cache Provider 接口,共包含 3 个公开字段或方法。 |
PrefixCacheRef | 接口 | interface PrefixCacheRef | Prefix Cache Ref 接口,共包含 6 个公开字段或方法。 |
PrefixSegment | 接口 | interface PrefixSegment | Prefix Segment 接口,共包含 9 个公开字段或方法。 |
PrefixSegmentationResult | 接口 | interface PrefixSegmentationResult | Prefix Segmentation Result 接口,共包含 5 个公开字段或方法。 |
PrefixSegmenter | 接口 | interface PrefixSegmenter | Prefix Segmenter 接口,共包含 1 个公开字段或方法。 |
PromptCompileInput | 接口 | interface PromptCompileInput | Prompt Compile Input 接口,共包含 11 个公开字段或方法。 |
PromptCompiler | 接口 | interface PromptCompiler | Prompt Compiler 接口,共包含 1 个公开字段或方法。 |
PromptMessage | 接口 | interface PromptMessage | Prompt Message 接口,共包含 4 个公开字段或方法。 |
InferenceBackendKind | 类型 | type InferenceBackendKind = 'ollama' | 'sglang' | 'vllm' | 'llama.cpp' | 'openai-api' | Inference Backend Kind 公共类型别名;完整类型表达式见声明。 |
InferenceCacheMissReason | 类型 | type InferenceCacheMissReason = 'missing' | 'expired' | 'not_configured' | 'error' | Inference Cache Miss Reason 公共类型别名;完整类型表达式见声明。 |
KvCacheScope | 类型 | type KvCacheScope = 'run' | 'session' | 'workspace' | Kv Cache Scope 公共类型别名;完整类型表达式见声明。 |
KvCacheWriteMode | 类型 | type KvCacheWriteMode = 'write_through' | 'write_if_missing' | 'refresh' | Kv Cache Write Mode 公共类型别名;完整类型表达式见声明。 |
PrefixSegmentKind | 类型 | type PrefixSegmentKind = 'system' | 'developer' | 'context' | 'memory' | 'tool' | 'user' | 'assistant' | Prefix Segment Kind 公共类型别名;完整类型表达式见声明。 |
PrefixSegmentScope | 类型 | type PrefixSegmentScope = 'global' | 'agent' | 'session' | 'run' | 'dynamic' | Prefix Segment Scope 公共类型别名;完整类型表达式见声明。 |
PromptRole | 类型 | type PromptRole = 'system' | 'developer' | 'user' | 'assistant' | 'tool' | 'context' | 'memory' | Prompt Role 公共类型别名;完整类型表达式见声明。 |
CompiledPrompt
Compiled Prompt 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { CompiledPrompt } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface CompiledPrompt {
id: string;
messages: PromptMessage[];
text: string;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
messages | 属性 | messages: PromptMessage[] | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
text | 属性 | text: string | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceBackend
Inference Backend 接口,共包含 5 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceBackend } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceBackend {
id: string;
kind: InferenceBackendKind;
capabilities(): InferenceBackendCapabilities;
infer(request: InferenceBackendRequest): Promise<InferenceBackendResponse>;
stream?(request: InferenceBackendRequest): AsyncIterable<InferenceBackendResponse>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
capabilities | 方法 | capabilities(): InferenceBackendCapabilities | 公开方法;参数与返回类型以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
infer | 方法 | infer(request: InferenceBackendRequest): Promise<InferenceBackendResponse> | 公开方法;参数与返回类型以签名列为准。 |
kind | 属性 | kind: InferenceBackendKind | 公开属性;类型、只读和可选状态以签名列为准。 |
stream | 方法 | stream?(request: InferenceBackendRequest): AsyncIterable<InferenceBackendResponse> | 公开方法;参数与返回类型以签名列为准。 |
InferenceBackendCapabilities
Inference Backend Capabilities 接口,共包含 6 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceBackendCapabilities } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceBackendCapabilities {
streaming: boolean;
chatCompletions: boolean;
textCompletions: boolean;
prefixCaching: boolean;
kvCaching: boolean;
cacheInvalidation: boolean;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
cacheInvalidation | 属性 | cacheInvalidation: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
chatCompletions | 属性 | chatCompletions: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCaching | 属性 | kvCaching: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
prefixCaching | 属性 | prefixCaching: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
streaming | 属性 | streaming: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
textCompletions | 属性 | textCompletions: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceBackendRegistryEntry
Inference Backend Registry Entry 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceBackendRegistryEntry } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceBackendRegistryEntry {
id: string;
backend: InferenceBackend;
default?: boolean;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
backend | 属性 | backend: InferenceBackend | 公开属性;类型、只读和可选状态以签名列为准。 |
default | 属性 | default?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceBackendRequest
Inference Backend Request 接口,共包含 14 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceBackendRequest } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceBackendRequest {
runId: string;
stepId: string;
sessionId?: string;
agentId?: string;
modelAlias: string;
compiledPrompt: CompiledPrompt;
segmentation: PrefixSegmentationResult;
prefixRefs: PrefixCacheRef[];
kvCache?: KvCacheRef;
resolvedKvCacheValue?: unknown;
physicalKvCache?: unknown;
options?: InferenceGenerationOptions;
tools?: InferenceToolDescriptor[];
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
agentId | 属性 | agentId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
compiledPrompt | 属性 | compiledPrompt: CompiledPrompt | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCache | 属性 | kvCache?: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
modelAlias | 属性 | modelAlias: string | 公开属性;类型、只读和可选状态以签名列为准。 |
options | 属性 | options?: InferenceGenerationOptions | 公开属性;类型、只读和可选状态以签名列为准。 |
physicalKvCache | 属性 | physicalKvCache?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
prefixRefs | 属性 | prefixRefs: PrefixCacheRef[] | 公开属性;类型、只读和可选状态以签名列为准。 |
resolvedKvCacheValue | 属性 | resolvedKvCacheValue?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
runId | 属性 | runId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
segmentation | 属性 | segmentation: PrefixSegmentationResult | 公开属性;类型、只读和可选状态以签名列为准。 |
sessionId | 属性 | sessionId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
stepId | 属性 | stepId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
tools | 属性 | tools?: InferenceToolDescriptor[] | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceBackendResponse
Inference Backend Response 接口,共包含 6 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceBackendResponse } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceBackendResponse<TOutput = unknown> {
id: string;
output: TOutput;
usage?: InferenceUsage;
physicalKvCache?: unknown;
metadata?: Record<string, unknown>;
raw?: unknown;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
output | 属性 | output: TOutput | 公开属性;类型、只读和可选状态以签名列为准。 |
physicalKvCache | 属性 | physicalKvCache?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
raw | 属性 | raw?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
usage | 属性 | usage?: InferenceUsage | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceCacheIssue
Inference Cache Issue 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceCacheIssue } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceCacheIssue {
operation: 'prefix_read' | 'kv_read' | 'kv_write' | 'invalidate';
code: string;
message: string;
bypassed: boolean;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
bypassed | 属性 | bypassed: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
code | 属性 | code: string | 公开属性;类型、只读和可选状态以签名列为准。 |
message | 属性 | message: string | 公开属性;类型、只读和可选状态以签名列为准。 |
operation | 属性 | operation: "prefix_read" | "kv_read" | "kv_write" | "invalidate" | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceCachePolicy
Inference Cache Policy 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceCachePolicy } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceCachePolicy {
prefix?: PrefixCacheRef;
kvCache?: KvCacheRef;
writeKvCache?: KvCacheWritePolicy;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
kvCache | 属性 | kvCache?: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
prefix | 属性 | prefix?: PrefixCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
writeKvCache | 属性 | writeKvCache?: KvCacheWritePolicy | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceCacheScope
Inference Cache Scope 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceCacheScope } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceCacheScope {
tenantId?: string;
userId: string;
workspaceId?: string;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
tenantId | 属性 | tenantId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
userId | 属性 | userId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
workspaceId | 属性 | workspaceId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceCacheUsage
Inference Cache Usage 接口,共包含 11 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceCacheUsage } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceCacheUsage {
prefixHit?: boolean;
kvCacheHit?: boolean;
servingCache?: Record<string, unknown>;
prefixRef?: PrefixCacheRef;
kvCacheRef?: KvCacheRef;
kvCacheMissReason?: InferenceCacheMissReason;
kvCacheWritten?: boolean;
kvCacheWriteRef?: KvCacheRef;
reusedTokens?: number;
bypassed?: boolean;
issues?: InferenceCacheIssue[];
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
bypassed | 属性 | bypassed?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
issues | 属性 | issues?: InferenceCacheIssue[] | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCacheHit | 属性 | kvCacheHit?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCacheMissReason | 属性 | kvCacheMissReason?: InferenceCacheMissReason | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCacheRef | 属性 | kvCacheRef?: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCacheWriteRef | 属性 | kvCacheWriteRef?: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCacheWritten | 属性 | kvCacheWritten?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
prefixHit | 属性 | prefixHit?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
prefixRef | 属性 | prefixRef?: PrefixCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
reusedTokens | 属性 | reusedTokens?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
servingCache | 属性 | servingCache?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceGenerationOptions
Inference Generation Options 接口,共包含 9 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceGenerationOptions } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceGenerationOptions {
temperature?: number;
maxTokens?: number;
topP?: number;
topK?: number;
stop?: string[];
seed?: number;
stream?: boolean;
responseFormat?: 'text' | 'json_object' | {
type: string;
schema?: unknown;
};
extra?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
extra | 属性 | extra?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
maxTokens | 属性 | maxTokens?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
responseFormat | 属性 | responseFormat?: "text" | "json_object" | { type: string; schema?: unknown; } | 公开属性;类型、只读和可选状态以签名列为准。 |
seed | 属性 | seed?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
stop | 属性 | stop?: string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
stream | 属性 | stream?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
temperature | 属性 | temperature?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
topK | 属性 | topK?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
topP | 属性 | topP?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceManagerOptions
Inference Manager Options 接口,共包含 8 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceManagerOptions } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceManagerOptions {
prefixCache?: PrefixCacheProvider;
kvCache?: KvCacheProvider;
cacheFailureMode?: 'bypass' | 'strict';
cacheOperationTimeoutMs?: number;
providerRevision?: string;
policyRevision?: string;
specRevision?: string;
onRecoveryFailure?: (failure: RecoveryFailure) => void | Promise<void>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
cacheFailureMode | 属性 | cacheFailureMode?: "strict" | "bypass" | 公开属性;类型、只读和可选状态以签名列为准。 |
cacheOperationTimeoutMs | 属性 | cacheOperationTimeoutMs?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCache | 属性 | kvCache?: KvCacheProvider | 公开属性;类型、只读和可选状态以签名列为准。 |
onRecoveryFailure | 方法 | onRecoveryFailure?(failure: RecoveryFailure): void | Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
policyRevision | 属性 | policyRevision?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
prefixCache | 属性 | prefixCache?: PrefixCacheProvider | 公开属性;类型、只读和可选状态以签名列为准。 |
providerRevision | 属性 | providerRevision?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
specRevision | 属性 | specRevision?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceProvider
Inference Provider 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceProvider } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceProvider {
id: string;
infer(request: InferenceRequest): Promise<InferenceResponse>;
stream?(request: InferenceRequest): AsyncIterable<InferenceResponse>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
infer | 方法 | infer(request: InferenceRequest): Promise<InferenceResponse> | 公开方法;参数与返回类型以签名列为准。 |
stream | 方法 | stream?(request: InferenceRequest): AsyncIterable<InferenceResponse> | 公开方法;参数与返回类型以签名列为准。 |
InferenceRequest
Inference Request 接口,共包含 18 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceRequest } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceRequest<TInput = unknown> {
runId: string;
stepId: string;
sessionId?: string;
agentId?: string;
modelAlias: string;
providerId?: string;
backendId?: string;
input: TInput;
options?: InferenceGenerationOptions;
tools?: InferenceToolDescriptor[];
cachePolicy?: InferenceCachePolicy;
cacheScope?: InferenceCacheScope;
prefix?: PrefixCacheRef;
resolvedPrefixContent?: string;
kvCache?: KvCacheRef;
resolvedKvCacheValue?: unknown;
trace?: boolean;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
agentId | 属性 | agentId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
backendId | 属性 | backendId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
cachePolicy | 属性 | cachePolicy?: InferenceCachePolicy | 公开属性;类型、只读和可选状态以签名列为准。 |
cacheScope | 属性 | cacheScope?: InferenceCacheScope | 公开属性;类型、只读和可选状态以签名列为准。 |
input | 属性 | input: TInput | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCache | 属性 | kvCache?: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
modelAlias | 属性 | modelAlias: string | 公开属性;类型、只读和可选状态以签名列为准。 |
options | 属性 | options?: InferenceGenerationOptions | 公开属性;类型、只读和可选状态以签名列为准。 |
prefix | 属性 | prefix?: PrefixCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
providerId | 属性 | providerId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
resolvedKvCacheValue | 属性 | resolvedKvCacheValue?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
resolvedPrefixContent | 属性 | resolvedPrefixContent?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
runId | 属性 | runId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
sessionId | 属性 | sessionId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
stepId | 属性 | stepId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
tools | 属性 | tools?: InferenceToolDescriptor[] | 公开属性;类型、只读和可选状态以签名列为准。 |
trace | 属性 | trace?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceResponse
Inference Response 接口,共包含 7 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceResponse } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceResponse<TOutput = unknown> {
id: string;
output: TOutput;
usage?: InferenceUsage;
cache?: InferenceCacheUsage;
nextKvCacheValue?: unknown;
metadata?: Record<string, unknown>;
raw?: unknown;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
cache | 属性 | cache?: InferenceCacheUsage | 公开属性;类型、只读和可选状态以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
nextKvCacheValue | 属性 | nextKvCacheValue?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
output | 属性 | output: TOutput | 公开属性;类型、只读和可选状态以签名列为准。 |
raw | 属性 | raw?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
usage | 属性 | usage?: InferenceUsage | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceToolDescriptor
Inference Tool Descriptor 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceToolDescriptor } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceToolDescriptor {
id: string;
name: string;
description?: string;
inputSchema: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
description | 属性 | description?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
inputSchema | 属性 | inputSchema: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
name | 属性 | name: string | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceUsage
Inference Usage 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { InferenceUsage } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface InferenceUsage {
inputTokens?: number;
outputTokens?: number;
totalTokens?: number;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
inputTokens | 属性 | inputTokens?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
outputTokens | 属性 | outputTokens?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
totalTokens | 属性 | totalTokens?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
KvCacheProvider
Kv Cache Provider 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { KvCacheProvider } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface KvCacheProvider {
get(ref: KvCacheRef): Promise<unknown | null>;
put(ref: KvCacheRef, value: unknown): Promise<void>;
invalidate(ref: KvCacheRef, reason: string): Promise<void>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
get | 方法 | get(ref: KvCacheRef): Promise<unknown | null> | 公开方法;参数与返回类型以签名列为准。 |
invalidate | 方法 | invalidate(ref: KvCacheRef, reason: string): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
put | 方法 | put(ref: KvCacheRef, value: unknown): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
KvCacheRef
Kv Cache Ref 接口,共包含 7 个公开字段或方法。
- 种类: 接口
- 导入:
import type { KvCacheRef } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface KvCacheRef {
id: string;
provider: string;
modelAlias: string;
scope: KvCacheScope;
cacheScope?: InferenceCacheScope;
expiresAt?: string;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
cacheScope | 属性 | cacheScope?: InferenceCacheScope | 公开属性;类型、只读和可选状态以签名列为准。 |
expiresAt | 属性 | expiresAt?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
modelAlias | 属性 | modelAlias: string | 公开属性;类型、只读和可选状态以签名列为准。 |
provider | 属性 | provider: string | 公开属性;类型、只读和可选状态以签名列为准。 |
scope | 属性 | scope: KvCacheScope | 公开属性;类型、只读和可选状态以签名列为准。 |
KvCacheWritePolicy
Kv Cache Write Policy 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { KvCacheWritePolicy } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface KvCacheWritePolicy {
ref: KvCacheRef;
value?: unknown;
mode?: KvCacheWriteMode;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
mode | 属性 | mode?: KvCacheWriteMode | 公开属性;类型、只读和可选状态以签名列为准。 |
ref | 属性 | ref: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
value | 属性 | value?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
PlasmodCacheMetadata
Plasmod Cache Metadata 接口,共包含 10 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PlasmodCacheMetadata } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PlasmodCacheMetadata {
segmentId: string;
contentHash: string;
backendId: string;
modelAlias: string;
scope: PrefixSegmentScope;
tokenCount?: number;
reused: boolean;
createdAt: string;
updatedAt: string;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
backendId | 属性 | backendId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
contentHash | 属性 | contentHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
createdAt | 属性 | createdAt: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
modelAlias | 属性 | modelAlias: string | 公开属性;类型、只读和可选状态以签名列为准。 |
reused | 属性 | reused: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
scope | 属性 | scope: PrefixSegmentScope | 公开属性;类型、只读和可选状态以签名列为准。 |
segmentId | 属性 | segmentId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
tokenCount | 属性 | tokenCount?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
updatedAt | 属性 | updatedAt: string | 公开属性;类型、只读和可选状态以签名列为准。 |
PlasmodHotLayer
Plasmod Hot Layer 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PlasmodHotLayer } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PlasmodHotLayer {
prepare(input: PlasmodHotLayerPrepareInput): Promise<PlasmodHotLayerPrepareResult>;
invalidateSegment(segmentId: string, reason: string): Promise<void>;
getSessionState(stateId: string): PlasmodSessionState | null;
getCacheMetadata(segmentId: string): PlasmodCacheMetadata | null;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
getCacheMetadata | 方法 | getCacheMetadata(segmentId: string): PlasmodCacheMetadata | null | 公开方法;参数与返回类型以签名列为准。 |
getSessionState | 方法 | getSessionState(stateId: string): PlasmodSessionState | null | 公开方法;参数与返回类型以签名列为准。 |
invalidateSegment | 方法 | invalidateSegment(segmentId: string, reason: string): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
prepare | 方法 | prepare(input: PlasmodHotLayerPrepareInput): Promise<PlasmodHotLayerPrepareResult> | 公开方法;参数与返回类型以签名列为准。 |
PlasmodHotLayerPrepareInput
Plasmod Hot Layer Prepare Input 接口,共包含 12 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PlasmodHotLayerPrepareInput } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PlasmodHotLayerPrepareInput {
runId: string;
stepId: string;
sessionId?: string;
agentId?: string;
modelAlias: string;
backendId: string;
cacheScope?: InferenceCacheScope;
segmentation: PrefixSegmentationResult;
kvCache?: KvCacheRef;
resolvedKvCacheValue?: unknown;
reusePolicy?: PlasmodReusePolicy;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
agentId | 属性 | agentId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
backendId | 属性 | backendId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
cacheScope | 属性 | cacheScope?: InferenceCacheScope | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCache | 属性 | kvCache?: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
modelAlias | 属性 | modelAlias: string | 公开属性;类型、只读和可选状态以签名列为准。 |
resolvedKvCacheValue | 属性 | resolvedKvCacheValue?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
reusePolicy | 属性 | reusePolicy?: PlasmodReusePolicy | 公开属性;类型、只读和可选状态以签名列为准。 |
runId | 属性 | runId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
segmentation | 属性 | segmentation: PrefixSegmentationResult | 公开属性;类型、只读和可选状态以签名列为准。 |
sessionId | 属性 | sessionId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
stepId | 属性 | stepId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
PlasmodHotLayerPrepareResult
Plasmod Hot Layer Prepare Result 接口,共包含 6 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PlasmodHotLayerPrepareResult } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PlasmodHotLayerPrepareResult {
prefixRefs: PrefixCacheRef[];
kvCacheRef?: KvCacheRef;
physicalKvCache?: unknown;
reusedSegmentIds: string[];
invalidatedSegmentIds: string[];
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
invalidatedSegmentIds | 属性 | invalidatedSegmentIds: string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCacheRef | 属性 | kvCacheRef?: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
physicalKvCache | 属性 | physicalKvCache?: unknown | 公开属性;类型、只读和可选状态以签名列为准。 |
prefixRefs | 属性 | prefixRefs: PrefixCacheRef[] | 公开属性;类型、只读和可选状态以签名列为准。 |
reusedSegmentIds | 属性 | reusedSegmentIds: string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
PlasmodReusePolicy
Plasmod Reuse Policy 接口,共包含 5 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PlasmodReusePolicy } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PlasmodReusePolicy {
allowCrossSession?: boolean;
allowCrossAgent?: boolean;
minTokenCount?: number;
requireExactHash?: boolean;
maxPrefixRefs?: number;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
allowCrossAgent | 属性 | allowCrossAgent?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
allowCrossSession | 属性 | allowCrossSession?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
maxPrefixRefs | 属性 | maxPrefixRefs?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
minTokenCount | 属性 | minTokenCount?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
requireExactHash | 属性 | requireExactHash?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
PlasmodSessionState
Plasmod Session State 接口,共包含 10 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PlasmodSessionState } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PlasmodSessionState {
id: string;
sessionId?: string;
runId: string;
agentId?: string;
modelAlias: string;
backendId: string;
prefixRefs: PrefixCacheRef[];
kvCacheRef?: KvCacheRef;
updatedAt: string;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
agentId | 属性 | agentId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
backendId | 属性 | backendId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
kvCacheRef | 属性 | kvCacheRef?: KvCacheRef | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
modelAlias | 属性 | modelAlias: string | 公开属性;类型、只读和可选状态以签名列为准。 |
prefixRefs | 属性 | prefixRefs: PrefixCacheRef[] | 公开属性;类型、只读和可选状态以签名列为准。 |
runId | 属性 | runId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
sessionId | 属性 | sessionId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
updatedAt | 属性 | updatedAt: string | 公开属性;类型、只读和可选状态以签名列为准。 |
PrefixCacheProvider
Prefix Cache Provider 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PrefixCacheProvider } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PrefixCacheProvider {
get(ref: PrefixCacheRef): Promise<string | null>;
put(ref: PrefixCacheRef, content: string): Promise<void>;
invalidate(ref: PrefixCacheRef, reason: string): Promise<void>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
get | 方法 | get(ref: PrefixCacheRef): Promise<string | null> | 公开方法;参数与返回类型以签名列为准。 |
invalidate | 方法 | invalidate(ref: PrefixCacheRef, reason: string): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
put | 方法 | put(ref: PrefixCacheRef, content: string): Promise<void> | 公开方法;参数与返回类型以签名列为准。 |
PrefixCacheRef
Prefix Cache Ref 接口,共包含 6 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PrefixCacheRef } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PrefixCacheRef {
id: string;
version: string;
contentHash: string;
tokenCount?: number;
cacheScope?: InferenceCacheScope;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
cacheScope | 属性 | cacheScope?: InferenceCacheScope | 公开属性;类型、只读和可选状态以签名列为准。 |
contentHash | 属性 | contentHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
tokenCount | 属性 | tokenCount?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
version | 属性 | version: string | 公开属性;类型、只读和可选状态以签名列为准。 |
PrefixSegment
Prefix Segment 接口,共包含 9 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PrefixSegment } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PrefixSegment {
id: string;
kind: PrefixSegmentKind;
scope: PrefixSegmentScope;
content: string;
contentHash: string;
tokenCount?: number;
cacheable: boolean;
dependencies?: string[];
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
cacheable | 属性 | cacheable: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
content | 属性 | content: string | 公开属性;类型、只读和可选状态以签名列为准。 |
contentHash | 属性 | contentHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
dependencies | 属性 | dependencies?: string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
kind | 属性 | kind: PrefixSegmentKind | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
scope | 属性 | scope: PrefixSegmentScope | 公开属性;类型、只读和可选状态以签名列为准。 |
tokenCount | 属性 | tokenCount?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
PrefixSegmentationResult
Prefix Segmentation Result 接口,共包含 5 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PrefixSegmentationResult } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PrefixSegmentationResult {
compiled: CompiledPrompt;
segments: PrefixSegment[];
stablePrefix: string;
dynamicPrompt: string;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
compiled | 属性 | compiled: CompiledPrompt | 公开属性;类型、只读和可选状态以签名列为准。 |
dynamicPrompt | 属性 | dynamicPrompt: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
segments | 属性 | segments: PrefixSegment[] | 公开属性;类型、只读和可选状态以签名列为准。 |
stablePrefix | 属性 | stablePrefix: string | 公开属性;类型、只读和可选状态以签名列为准。 |
PrefixSegmenter
Prefix Segmenter 接口,共包含 1 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PrefixSegmenter } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PrefixSegmenter {
segment(prompt: CompiledPrompt): Promise<PrefixSegmentationResult>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
segment | 方法 | segment(prompt: CompiledPrompt): Promise<PrefixSegmentationResult> | 公开方法;参数与返回类型以签名列为准。 |
PromptCompileInput
Prompt Compile Input 接口,共包含 11 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PromptCompileInput } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PromptCompileInput<TInput = unknown> {
runId: string;
stepId: string;
sessionId?: string;
agentId?: string;
modelAlias: string;
instructions?: string;
messages?: PromptMessage[];
input: TInput;
context?: Record<string, unknown>;
resolvedPrefixContent?: string;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
agentId | 属性 | agentId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
context | 属性 | context?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
input | 属性 | input: TInput | 公开属性;类型、只读和可选状态以签名列为准。 |
instructions | 属性 | instructions?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
messages | 属性 | messages?: PromptMessage[] | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
modelAlias | 属性 | modelAlias: string | 公开属性;类型、只读和可选状态以签名列为准。 |
resolvedPrefixContent | 属性 | resolvedPrefixContent?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
runId | 属性 | runId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
sessionId | 属性 | sessionId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
stepId | 属性 | stepId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
PromptCompiler
Prompt Compiler 接口,共包含 1 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PromptCompiler } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PromptCompiler {
compile<TInput = unknown>(input: PromptCompileInput<TInput>): Promise<CompiledPrompt>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
compile | 方法 | compile<TInput = unknown>(input: PromptCompileInput<TInput>): Promise<CompiledPrompt> | 公开方法;参数与返回类型以签名列为准。 |
PromptMessage
Prompt Message 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PromptMessage } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export interface PromptMessage {
role: PromptRole;
content: string;
name?: string;
metadata?: Record<string, unknown>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
content | 属性 | content: string | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, unknown> | 公开属性;类型、只读和可选状态以签名列为准。 |
name | 属性 | name?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
role | 属性 | role: PromptRole | 公开属性;类型、只读和可选状态以签名列为准。 |
InferenceBackendKind
Inference Backend Kind 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { InferenceBackendKind } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export type InferenceBackendKind = 'ollama' | 'sglang' | 'vllm' | 'llama.cpp' | 'openai-api';InferenceCacheMissReason
Inference Cache Miss Reason 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { InferenceCacheMissReason } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export type InferenceCacheMissReason = 'missing' | 'expired' | 'not_configured' | 'error';KvCacheScope
Kv Cache Scope 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { KvCacheScope } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export type KvCacheScope = 'run' | 'session' | 'workspace';KvCacheWriteMode
Kv Cache Write Mode 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { KvCacheWriteMode } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export type KvCacheWriteMode = 'write_through' | 'write_if_missing' | 'refresh';PrefixSegmentKind
Prefix Segment Kind 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { PrefixSegmentKind } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export type PrefixSegmentKind = 'system' | 'developer' | 'context' | 'memory' | 'tool' | 'user' | 'assistant';PrefixSegmentScope
Prefix Segment Scope 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { PrefixSegmentScope } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export type PrefixSegmentScope = 'global' | 'agent' | 'session' | 'run' | 'dynamic';PromptRole
Prompt Role 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { PromptRole } from '@codesoul-co/hypha-inference'; - 源码模块:
types
声明
export type PromptRole = 'system' | 'developer' | 'user' | 'assistant' | 'tool' | 'context' | 'memory';