feat: organize tools and enable qwen realtime calls
This commit is contained in:
+81
-26
@@ -177,11 +177,21 @@ export type InterfaceDefinition = {
|
||||
interfaceType: string;
|
||||
name: string;
|
||||
capability: ModelType;
|
||||
fieldSchema: { fields: InterfaceField[] };
|
||||
fieldSchema: {
|
||||
fields: InterfaceField[];
|
||||
features?: {
|
||||
realtimePromptTools?: RealtimePromptToolFeatures;
|
||||
};
|
||||
};
|
||||
enabled: boolean;
|
||||
version: number;
|
||||
};
|
||||
|
||||
export type RealtimePromptToolFeatures = {
|
||||
externalTypes: Array<"http" | "mcp" | "client">;
|
||||
builtIns: Array<keyof BuiltInTools>;
|
||||
};
|
||||
|
||||
export type ModelResource = {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -271,8 +281,7 @@ export type TurnConfig = {
|
||||
export type StartupAction = {
|
||||
id: string;
|
||||
phase: "preflight" | "opening";
|
||||
toolId: string;
|
||||
arguments: Record<string, unknown>;
|
||||
toolBinding: ToolBinding;
|
||||
required: boolean;
|
||||
};
|
||||
|
||||
@@ -288,11 +297,70 @@ export type StartupConfig = {
|
||||
} | null;
|
||||
};
|
||||
|
||||
export type SystemToolKind =
|
||||
| "end_conversation"
|
||||
| "update_state"
|
||||
| "skip_turn"
|
||||
| "request_human_handoff";
|
||||
export type ValueSource =
|
||||
| { source: "model" }
|
||||
| { source: "variable"; variableName: string }
|
||||
| { source: "literal"; value: unknown }
|
||||
| { source: "template"; value: unknown };
|
||||
|
||||
export type NonModelValueSource = Exclude<ValueSource, { source: "model" }>;
|
||||
|
||||
export type ToolBinding = {
|
||||
toolId: string;
|
||||
argumentBindings: Record<string, ValueSource>;
|
||||
templateBindings: Record<string, NonModelValueSource>;
|
||||
resultAssignments: Record<string, string>;
|
||||
};
|
||||
|
||||
export type StateExpression =
|
||||
| { type: "constant"; value: string | number | boolean }
|
||||
| { type: "variable"; variableName: string }
|
||||
| {
|
||||
type: "llm";
|
||||
parameterName: string;
|
||||
valueType: "string" | "number" | "boolean";
|
||||
description: string;
|
||||
}
|
||||
| {
|
||||
type:
|
||||
| "and"
|
||||
| "or"
|
||||
| "eq"
|
||||
| "neq"
|
||||
| "gt"
|
||||
| "gte"
|
||||
| "lt"
|
||||
| "lte"
|
||||
| "add"
|
||||
| "subtract"
|
||||
| "multiply"
|
||||
| "divide";
|
||||
operands: StateExpression[];
|
||||
}
|
||||
| {
|
||||
type: "if";
|
||||
condition: StateExpression;
|
||||
then: StateExpression;
|
||||
otherwise: StateExpression;
|
||||
};
|
||||
|
||||
export type StateUpdateRule = {
|
||||
variableName: string;
|
||||
expression: StateExpression;
|
||||
};
|
||||
|
||||
export type BuiltInTools = {
|
||||
endConversation?: {
|
||||
description: string;
|
||||
messageType: "none" | "custom";
|
||||
customMessage: string;
|
||||
captureReason: boolean;
|
||||
allowEndInterruption: boolean;
|
||||
} | null;
|
||||
updateState?: { description: string; updates: StateUpdateRule[] } | null;
|
||||
skipTurn?: { description: string } | null;
|
||||
requestHumanHandoff?: { description: string } | null;
|
||||
};
|
||||
|
||||
export type AnalysisFieldType =
|
||||
| "string"
|
||||
@@ -334,7 +402,8 @@ export type Assistant = {
|
||||
modelResourceIds: Partial<Record<ModelType, string>>;
|
||||
knowledgeBaseId: string | null;
|
||||
knowledgeRetrievalConfig: KnowledgeRetrievalConfig;
|
||||
toolIds: string[];
|
||||
toolBindings: ToolBinding[];
|
||||
builtInTools: BuiltInTools;
|
||||
prompt: string;
|
||||
dynamicVariableDefinitions: Record<string, DynamicVariableDefinition>;
|
||||
analysisConfig: AnalysisConfig;
|
||||
@@ -509,18 +578,6 @@ export type ToolParameter = {
|
||||
required: boolean;
|
||||
};
|
||||
|
||||
export type SystemToolDefinition = {
|
||||
schemaVersion: number;
|
||||
type: "system";
|
||||
config: {
|
||||
kind: SystemToolKind;
|
||||
messageType: "none" | "custom";
|
||||
customMessage: string;
|
||||
captureReason: boolean;
|
||||
allowEndInterruption?: boolean;
|
||||
};
|
||||
};
|
||||
|
||||
export type HttpToolDefinition = {
|
||||
schemaVersion: number;
|
||||
type: "http";
|
||||
@@ -532,8 +589,8 @@ export type HttpToolDefinition = {
|
||||
timeoutSeconds: number;
|
||||
headers: Record<string, string>;
|
||||
parameters: ToolParameter[];
|
||||
templateInputs: ToolParameter[];
|
||||
body: Record<string, unknown>;
|
||||
dynamicVariableAssignments: Record<string, string>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -547,7 +604,6 @@ export type ClientToolDefinition = {
|
||||
responseWaitMode?: ClientToolResponseWaitMode;
|
||||
parameters: ToolParameter[];
|
||||
timeoutSeconds: number;
|
||||
dynamicVariableAssignments: Record<string, string>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -560,7 +616,7 @@ export type McpToolDefinition = {
|
||||
remoteToolName: string;
|
||||
inputSchema: Record<string, unknown>;
|
||||
schemaHash: string;
|
||||
dynamicVariableAssignments: Record<string, string>;
|
||||
templateInputs: ToolParameter[];
|
||||
};
|
||||
};
|
||||
|
||||
@@ -568,10 +624,9 @@ export type Tool = {
|
||||
id: string;
|
||||
name: string;
|
||||
functionName: string;
|
||||
type: "system" | "http" | "mcp" | "client";
|
||||
type: "http" | "mcp" | "client";
|
||||
description: string;
|
||||
definition:
|
||||
| SystemToolDefinition
|
||||
| HttpToolDefinition
|
||||
| ClientToolDefinition
|
||||
| McpToolDefinition;
|
||||
|
||||
Reference in New Issue
Block a user